@erpsquad/common 1.9.97 → 1.9.98
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/chunks/{android-12-switch-D3fU6Qtm.esm.js → android-12-switch-C3WlgdKQ.esm.js} +11 -9
- package/dist/chunks/{android-12-switch-D3fU6Qtm.esm.js.map → android-12-switch-C3WlgdKQ.esm.js.map} +1 -1
- package/dist/chunks/{android-12-switch-B5UmJZxg.js → android-12-switch-CVH-tc4s.js} +11 -9
- package/dist/chunks/{android-12-switch-B5UmJZxg.js.map → android-12-switch-CVH-tc4s.js.map} +1 -1
- package/dist/chunks/{apiHelper-BvnhN2uo.esm.js → apiHelper-DOCeCGD-.esm.js} +9 -4
- package/dist/chunks/apiHelper-DOCeCGD-.esm.js.map +1 -0
- package/dist/chunks/{apiHelper-BrzRrxpx.js → apiHelper-DSbRnRC1.js} +9 -4
- package/dist/chunks/apiHelper-DSbRnRC1.js.map +1 -0
- package/dist/chunks/{appbar-Dn00gF0A.esm.js → appbar-CrH_SjSo.esm.js} +2 -2
- package/dist/chunks/{appbar-Dn00gF0A.esm.js.map → appbar-CrH_SjSo.esm.js.map} +1 -1
- package/dist/chunks/{appbar-dBRF2bDa.js → appbar-D6bWAv8x.js} +2 -2
- package/dist/chunks/{appbar-dBRF2bDa.js.map → appbar-D6bWAv8x.js.map} +1 -1
- package/dist/chunks/{default-data-BCroqbYg.js → default-data-9-BQ_0wq.js} +7 -7
- package/dist/chunks/{default-data-BCroqbYg.js.map → default-data-9-BQ_0wq.js.map} +1 -1
- package/dist/chunks/{default-data-otyfdCNu.esm.js → default-data-D1f8nbl6.esm.js} +7 -7
- package/dist/chunks/{default-data-otyfdCNu.esm.js.map → default-data-D1f8nbl6.esm.js.map} +1 -1
- package/dist/chunks/{fullScreen-BHrQ0vTa.js → fullScreen-BtbOZq50.js} +2 -2
- package/dist/chunks/{fullScreen-BHrQ0vTa.js.map → fullScreen-BtbOZq50.js.map} +1 -1
- package/dist/chunks/{fullScreen-BdyRsEBm.esm.js → fullScreen-DSPrY2tY.esm.js} +2 -2
- package/dist/chunks/{fullScreen-BdyRsEBm.esm.js.map → fullScreen-DSPrY2tY.esm.js.map} +1 -1
- package/dist/chunks/module-routes-config-B8IucBuj.js +19 -0
- package/dist/chunks/module-routes-config-B8IucBuj.js.map +1 -0
- package/dist/chunks/module-routes-config-CCkZEtfg.esm.js +20 -0
- package/dist/chunks/module-routes-config-CCkZEtfg.esm.js.map +1 -0
- package/dist/chunks/{modules-BDHGBfwa.js → modules-C3T2Pnwc.js} +10 -5
- package/dist/chunks/modules-C3T2Pnwc.js.map +1 -0
- package/dist/chunks/{modules-UIv-lDBW.esm.js → modules-D5_hDIg9.esm.js} +10 -5
- package/dist/chunks/modules-D5_hDIg9.esm.js.map +1 -0
- package/dist/chunks/{page-context-DRbgpYFO.js → page-context-BKgBvHxw.js} +2 -2
- package/dist/chunks/{page-context-DRbgpYFO.js.map → page-context-BKgBvHxw.js.map} +1 -1
- package/dist/chunks/{page-context-DLUB4Qx9.esm.js → page-context-DATjzley.esm.js} +2 -2
- package/dist/chunks/{page-context-DLUB4Qx9.esm.js.map → page-context-DATjzley.esm.js.map} +1 -1
- package/dist/chunks/pathname.hrms-2_BEXO_r.js +262 -0
- package/dist/chunks/pathname.hrms-2_BEXO_r.js.map +1 -0
- package/dist/chunks/pathname.hrms-C5ojsho0.esm.js +263 -0
- package/dist/chunks/pathname.hrms-C5ojsho0.esm.js.map +1 -0
- package/dist/chunks/{route-page-map-DPlRjCJm.esm.js → route-page-map-C4wM0M4A.esm.js} +2 -2
- package/dist/chunks/{route-page-map-DPlRjCJm.esm.js.map → route-page-map-C4wM0M4A.esm.js.map} +1 -1
- package/dist/chunks/{route-page-map-Btth_lp5.js → route-page-map-CJLyl6P1.js} +2 -2
- package/dist/chunks/{route-page-map-Btth_lp5.js.map → route-page-map-CJLyl6P1.js.map} +1 -1
- package/dist/chunks/{sidebar-Dcw_6aQ7.js → sidebar-D2Q9rQrz.js} +2 -2
- package/dist/chunks/{sidebar-Dcw_6aQ7.js.map → sidebar-D2Q9rQrz.js.map} +1 -1
- package/dist/chunks/{sidebar-PZqii53B.esm.js → sidebar-gl6ML9FB.esm.js} +2 -2
- package/dist/chunks/{sidebar-PZqii53B.esm.js.map → sidebar-gl6ML9FB.esm.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-DY4Uklrh.esm.js → sidebarScreen-57BCIH9V.esm.js} +3 -3
- package/dist/chunks/{sidebarScreen-DY4Uklrh.esm.js.map → sidebarScreen-57BCIH9V.esm.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-FH1CEH8k.js → sidebarScreen-CnsblLHN.js} +3 -3
- package/dist/chunks/{sidebarScreen-FH1CEH8k.js.map → sidebarScreen-CnsblLHN.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-UBPKubPh.js → uom-field-wrapper-CjqCwlbR.js} +9 -9
- package/dist/chunks/{uom-field-wrapper-UBPKubPh.js.map → uom-field-wrapper-CjqCwlbR.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-CeeTt3Ph.esm.js → uom-field-wrapper-CzXOP8fb.esm.js} +9 -9
- package/dist/chunks/{uom-field-wrapper-CeeTt3Ph.esm.js.map → uom-field-wrapper-CzXOP8fb.esm.js.map} +1 -1
- package/dist/chunks/{useAccountSetting-B5qXSiGa.js → useAccountSetting-ChWinjqQ.js} +2 -2
- package/dist/chunks/{useAccountSetting-B5qXSiGa.js.map → useAccountSetting-ChWinjqQ.js.map} +1 -1
- package/dist/chunks/{useAccountSetting-BcPg1o6H.esm.js → useAccountSetting-nBdUAbgS.esm.js} +2 -2
- package/dist/chunks/{useAccountSetting-BcPg1o6H.esm.js.map → useAccountSetting-nBdUAbgS.esm.js.map} +1 -1
- package/dist/chunks/{useReduxIntegration-CPPcf1p7.esm.js → useReduxIntegration--sS2yQ4F.esm.js} +2 -2
- package/dist/chunks/{useReduxIntegration-CPPcf1p7.esm.js.map → useReduxIntegration--sS2yQ4F.esm.js.map} +1 -1
- package/dist/chunks/{useReduxIntegration-DvUNoDIr.js → useReduxIntegration-D6MZKdkS.js} +2 -2
- package/dist/chunks/{useReduxIntegration-DvUNoDIr.js.map → useReduxIntegration-D6MZKdkS.js.map} +1 -1
- package/dist/components/index.esm.js +6 -6
- package/dist/components/index.js +6 -6
- package/dist/components/providers/ERPUIProvider.d.ts +1 -0
- package/dist/constants/index.esm.js +3 -3
- package/dist/constants/index.js +3 -3
- package/dist/constants/pathnames/pathname.hrms.d.ts +61 -3
- package/dist/contexts/index.esm.js +1 -1
- package/dist/contexts/index.js +1 -1
- package/dist/hooks/index.esm.js +3 -3
- package/dist/hooks/index.js +3 -3
- package/dist/index.esm.js +45 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/layout/index.esm.js +2 -2
- package/dist/layout/index.js +2 -2
- package/dist/src/components/providers/ERPUIProvider.d.ts +1 -0
- package/dist/src/constants/pathnames/pathname.hrms.d.ts +61 -3
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/module-routes-config.d.ts +34 -0
- package/dist/src/views/form-builder/utils/common.d.ts +1 -1
- package/dist/utils/index.esm.js +5 -0
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/module-routes-config.d.ts +34 -0
- package/dist/views/form-builder/utils/common.d.ts +1 -1
- package/dist/views/index.esm.js +7 -7
- package/dist/views/index.js +6 -6
- package/package.json +1 -1
- package/dist/chunks/apiHelper-BrzRrxpx.js.map +0 -1
- package/dist/chunks/apiHelper-BvnhN2uo.esm.js.map +0 -1
- package/dist/chunks/modules-BDHGBfwa.js.map +0 -1
- package/dist/chunks/modules-UIv-lDBW.esm.js.map +0 -1
- package/dist/chunks/pathname.hrms-BVwbtB1M.js +0 -109
- package/dist/chunks/pathname.hrms-BVwbtB1M.js.map +0 -1
- package/dist/chunks/pathname.hrms-BiL7sQv0.esm.js +0 -110
- package/dist/chunks/pathname.hrms-BiL7sQv0.esm.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-ClFauRgV.esm.js";
|
|
2
2
|
import { useMemo, useState, useCallback, useEffect } from "react";
|
|
3
|
-
import { u as useTheme, f as Box, a as AppBarWrapper, A as ActivityArea } from "./appbar-
|
|
4
|
-
import { S as Sidebar } from "./sidebar-
|
|
3
|
+
import { u as useTheme, f as Box, a as AppBarWrapper, A as ActivityArea } from "./appbar-CrH_SjSo.esm.js";
|
|
4
|
+
import { S as Sidebar } from "./sidebar-gl6ML9FB.esm.js";
|
|
5
5
|
import { d as drawerWidth } from "./mui.constants-BFBzxaiA.esm.js";
|
|
6
6
|
import { u as useLanguage } from "./useLangauge-Bie5anLS.esm.js";
|
|
7
7
|
import { ar as getToken } from "./common-B-nmtH5r.esm.js";
|
|
@@ -197,4 +197,4 @@ const SidebarLayout = (props) => {
|
|
|
197
197
|
export {
|
|
198
198
|
SidebarLayout as S
|
|
199
199
|
};
|
|
200
|
-
//# sourceMappingURL=sidebarScreen-
|
|
200
|
+
//# sourceMappingURL=sidebarScreen-57BCIH9V.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-DY4Uklrh.esm.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\tsetOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["jsx","jsxs","AppBar","SideBar"],"mappings":";;;;;;;;;AAiBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQ,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoB,YAAA;AAC5B,QAAM,QAAQ;AAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,I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AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBH,kCAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MACR;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
1
|
+
{"version":3,"file":"sidebarScreen-57BCIH9V.esm.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\tsetOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["jsx","jsxs","AppBar","SideBar"],"mappings":";;;;;;;;;AAiBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQ,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoB,YAAA;AAC5B,QAAM,QAAQ;AAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,WAAW,YAAA;AACjB,QAAM,cAAc,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmB,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QAAQ,kBAAkB,MAAM;AAAA,IACrD,SAAS,OAAO;AACf,cAAQ,KAAK,gDAAgD,KAAK;AAAA,IACnE;AAAA,EACD,GAAG,CAAA,CAAE;AAEL,QAAM,oBAAoB,YAAY,MAAM;AAC3C,kBAAc,KAAK;AACnB,WAAO,aAAa,QAAQ,mBAAmB,O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AAA,MAAA;AAAA,QACA,IAAI;AAAA,UACH,SAAS;AAAA,UACT,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,gBAAgB;AAAA,QAAA;AAAA,QAGjB,UAAAA,kCAAAA,IAAC,OAAI,UAAA,aAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlB;AAEA,SACCC,kCAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACA,IAAI;AAAA,QACH,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,kCAAAA;AAAAA,UAACE;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDF,kCAAAA;AAAAA,UAACG;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBH,kCAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MACR;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const appbar = require("./appbar-
|
|
5
|
-
const sidebar = require("./sidebar-
|
|
4
|
+
const appbar = require("./appbar-D6bWAv8x.js");
|
|
5
|
+
const sidebar = require("./sidebar-D2Q9rQrz.js");
|
|
6
6
|
const mui_constants = require("./mui.constants-CJEIUmWO.js");
|
|
7
7
|
const useLangauge = require("./useLangauge-BtG3kyRv.js");
|
|
8
8
|
const common = require("./common-QvMCr1xx.js");
|
|
@@ -196,4 +196,4 @@ const SidebarLayout = (props) => {
|
|
|
196
196
|
);
|
|
197
197
|
};
|
|
198
198
|
exports.SidebarLayout = SidebarLayout;
|
|
199
|
-
//# sourceMappingURL=sidebarScreen-
|
|
199
|
+
//# sourceMappingURL=sidebarScreen-CnsblLHN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-FH1CEH8k.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\tsetOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["useTheme","useLanguage","useMemo","useState","useLocation","useCallback","getToken","getV1Settings","useEffect","jsx","Box","jsxs","AppBar","drawerWidth","SideBar","ActivityArea"],"mappings":";;;;;;;;;;AAiBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQA,OAAAA,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoBC,wBAAA;AAC5B,QAAM,QAAQC,MAAAA;AAAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAIA,MAAAA,SAAS,KAAK;AACxD,QAAM,WAAWC,eAAAA,YAAA;AACjB,QAAM,cAAcF,MAAAA,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmBG,MAAAA,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QA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AAA,UAAA;AAAA,YACA;AAAA,YAAA,aACAF,cAAAA;AAAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MACR;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
|
|
1
|
+
{"version":3,"file":"sidebarScreen-CnsblLHN.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\tsetOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["useTheme","useLanguage","useMemo","useState","useLocation","useCallback","getToken","getV1Settings","useEffect","jsx","Box","jsxs","AppBar","drawerWidth","SideBar","ActivityArea"],"mappings":";;;;;;;;;;AAiBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQA,OAAAA,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoBC,wBAAA;AAC5B,QAAM,QAAQC,MAAAA;AAAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAIA,MAAAA,SAAS,KAAK;AACxD,QAAM,WAAWC,eAAAA,YAAA;AACjB,QAAM,cAAcF,MAAAA,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmBG,MAAAA,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QAAQ,kBAAkB,MAAM;AAAA,IACrD,SAAS,OAAO;AACf,cAAQ,KAAK,gDAAgD,KAAK;AAAA,IACnE;AAAA,EACD,GAAG,CAAA,CAAE;AAEL,QAAM,oBAAoBA,MAAAA,YAAY,MAAM;AAC3C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8 +3,8 @@ const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
|
|
|
3
3
|
const reactHookForm = require("react-hook-form");
|
|
4
4
|
const identifier = require("./identifier-B8P9ZGxG.js");
|
|
5
5
|
const useAuth = require("./useAuth-BhsPEB2T.js");
|
|
6
|
-
const android12Switch = require("./android-12-switch-
|
|
7
|
-
const appbar = require("./appbar-
|
|
6
|
+
const android12Switch = require("./android-12-switch-CVH-tc4s.js");
|
|
7
|
+
const appbar = require("./appbar-D6bWAv8x.js");
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const DatePicker = require("react-datepicker");
|
|
10
10
|
;/* empty css */
|
|
@@ -25,7 +25,7 @@ const trash = require("./trash-CUP1jXNo.js");
|
|
|
25
25
|
const api = require("./api-DJMpbRRM.js");
|
|
26
26
|
const notistack = require("notistack");
|
|
27
27
|
const reactRedux = require("react-redux");
|
|
28
|
-
const apiHelper = require("./apiHelper-
|
|
28
|
+
const apiHelper = require("./apiHelper-DSbRnRC1.js");
|
|
29
29
|
const Board = require("@asseinfo/react-kanban");
|
|
30
30
|
const navigationUtils = require("./navigation-utils-CG-S6RJB.js");
|
|
31
31
|
const FullCalendar = require("@fullcalendar/react");
|
|
@@ -39,20 +39,20 @@ const resourceTimelinePlugin = require("@fullcalendar/resource-timeline");
|
|
|
39
39
|
const tick = require("./tick-By8O3yMK.js");
|
|
40
40
|
const ReactFlagsSelect = require("react-flags-select");
|
|
41
41
|
const reactRouterDom = require("react-router-dom");
|
|
42
|
-
const pageContext = require("./page-context-
|
|
42
|
+
const pageContext = require("./page-context-BKgBvHxw.js");
|
|
43
43
|
const ganttTaskReact = require("gantt-task-react");
|
|
44
44
|
const reactDateRange = require("react-date-range");
|
|
45
45
|
const actionBar = require("./action-bar-DMv6sqDP.js");
|
|
46
46
|
const DataEditor = require("@glideapps/glide-data-grid");
|
|
47
47
|
const glideDataGridCells = require("@glideapps/glide-data-grid-cells");
|
|
48
48
|
const ReactDOM = require("react-dom");
|
|
49
|
-
const sidebar = require("./sidebar-
|
|
49
|
+
const sidebar = require("./sidebar-D2Q9rQrz.js");
|
|
50
50
|
const materialReactTable = require("material-react-table");
|
|
51
51
|
const _$1 = require("lodash");
|
|
52
|
-
const useAccountSetting = require("./useAccountSetting-
|
|
53
|
-
const modules = require("./modules-
|
|
52
|
+
const useAccountSetting = require("./useAccountSetting-ChWinjqQ.js");
|
|
53
|
+
const modules = require("./modules-C3T2Pnwc.js");
|
|
54
54
|
const pathname_rental = require("./pathname.rental-C9fm1WTq.js");
|
|
55
|
-
const pathname_hrms = require("./pathname.hrms-
|
|
55
|
+
const pathname_hrms = require("./pathname.hrms-2_BEXO_r.js");
|
|
56
56
|
const hooks = require("./hooks-DsdahmnZ.js");
|
|
57
57
|
const store = require("./store-DEoLcgbp.js");
|
|
58
58
|
const reactDropzone = require("react-dropzone");
|
|
@@ -15990,4 +15990,4 @@ exports.dynamicFields = dynamicFields;
|
|
|
15990
15990
|
exports.fields = fields;
|
|
15991
15991
|
exports.useDynamicLayout = useDynamicLayout;
|
|
15992
15992
|
exports.validator = validator;
|
|
15993
|
-
//# sourceMappingURL=uom-field-wrapper-
|
|
15993
|
+
//# sourceMappingURL=uom-field-wrapper-CjqCwlbR.js.map
|