@erpsquad/common 1.10.57 → 1.10.58
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/{ERPUIProvider-DNIk_P9N.js → ERPUIProvider-C9xsCdz8.js} +4 -4
- package/dist/chunks/{ERPUIProvider-DNIk_P9N.js.map → ERPUIProvider-C9xsCdz8.js.map} +1 -1
- package/dist/chunks/{ERPUIProvider-BJM1qtBf.esm.js → ERPUIProvider-DUpktqXA.esm.js} +4 -4
- package/dist/chunks/{ERPUIProvider-BJM1qtBf.esm.js.map → ERPUIProvider-DUpktqXA.esm.js.map} +1 -1
- package/dist/chunks/{android-12-switch-SPfvwO74.esm.js → android-12-switch-BFYF5yWP.esm.js} +8 -7
- package/dist/chunks/{android-12-switch-SPfvwO74.esm.js.map → android-12-switch-BFYF5yWP.esm.js.map} +1 -1
- package/dist/chunks/{android-12-switch-DPYQqw4U.js → android-12-switch-_UhYJwIo.js} +8 -7
- package/dist/chunks/{android-12-switch-DPYQqw4U.js.map → android-12-switch-_UhYJwIo.js.map} +1 -1
- package/dist/chunks/{appbar-CJ_YiTaE.esm.js → appbar-5TrpZMbY.esm.js} +3 -3
- package/dist/chunks/{appbar-CJ_YiTaE.esm.js.map → appbar-5TrpZMbY.esm.js.map} +1 -1
- package/dist/chunks/{appbar-B7Don9mm.js → appbar-C9ey8q7A.js} +3 -3
- package/dist/chunks/{appbar-B7Don9mm.js.map → appbar-C9ey8q7A.js.map} +1 -1
- package/dist/chunks/{checkbox-C1ZTJUlQ.js → checkbox-BGOe79Cy.js} +3 -3
- package/dist/chunks/{checkbox-C1ZTJUlQ.js.map → checkbox-BGOe79Cy.js.map} +1 -1
- package/dist/chunks/{checkbox-BhH6VEUa.esm.js → checkbox-Nrx4n_Th.esm.js} +3 -3
- package/dist/chunks/{checkbox-BhH6VEUa.esm.js.map → checkbox-Nrx4n_Th.esm.js.map} +1 -1
- package/dist/chunks/{default-data-Ci8MCe7E.js → default-data-CKE51uFF.js} +6 -6
- package/dist/chunks/{default-data-Ci8MCe7E.js.map → default-data-CKE51uFF.js.map} +1 -1
- package/dist/chunks/{default-data-DoAHAkBR.esm.js → default-data-D6k6H-p7.esm.js} +6 -6
- package/dist/chunks/{default-data-DoAHAkBR.esm.js.map → default-data-D6k6H-p7.esm.js.map} +1 -1
- package/dist/chunks/{fullScreen-CVRwgry_.esm.js → fullScreen-BAoq_e7y.esm.js} +2 -2
- package/dist/chunks/{fullScreen-CVRwgry_.esm.js.map → fullScreen-BAoq_e7y.esm.js.map} +1 -1
- package/dist/chunks/{fullScreen-B2LsVuQY.js → fullScreen-BfwTymyU.js} +2 -2
- package/dist/chunks/{fullScreen-B2LsVuQY.js.map → fullScreen-BfwTymyU.js.map} +1 -1
- package/dist/chunks/{modules-BstDoVbN.js → modules-BLLiy7lE.js} +2 -2
- package/dist/chunks/{modules-BstDoVbN.js.map → modules-BLLiy7lE.js.map} +1 -1
- package/dist/chunks/{modules-gZ7sN3SY.esm.js → modules-iMRqZ5uM.esm.js} +2 -2
- package/dist/chunks/{modules-gZ7sN3SY.esm.js.map → modules-iMRqZ5uM.esm.js.map} +1 -1
- package/dist/chunks/{page-context-OVe_dHlX.esm.js → page-context-BmxkvLgp.esm.js} +2 -2
- package/dist/chunks/{page-context-OVe_dHlX.esm.js.map → page-context-BmxkvLgp.esm.js.map} +1 -1
- package/dist/chunks/{page-context-ChBO0RIs.js → page-context-oSxL8_xq.js} +2 -2
- package/dist/chunks/{page-context-ChBO0RIs.js.map → page-context-oSxL8_xq.js.map} +1 -1
- package/dist/chunks/{route-page-map-7BVft1HF.js → route-page-map-DiM8kR2P.js} +25 -1
- package/dist/chunks/{route-page-map-7BVft1HF.js.map → route-page-map-DiM8kR2P.js.map} +1 -1
- package/dist/chunks/{route-page-map-BHHss936.esm.js → route-page-map-zIIGZHIH.esm.js} +125 -101
- package/dist/chunks/{route-page-map-BHHss936.esm.js.map → route-page-map-zIIGZHIH.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-Dhnfy7is.esm.js → sidebar-BbOMMvki.esm.js} +2 -2
- package/dist/chunks/{sidebar-Dhnfy7is.esm.js.map → sidebar-BbOMMvki.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-DDy7Ao3K.js → sidebar-mRDqCVsd.js} +2 -2
- package/dist/chunks/{sidebar-DDy7Ao3K.js.map → sidebar-mRDqCVsd.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-DuLhKJQB.js → sidebarScreen-CSErMH2c.js} +3 -3
- package/dist/chunks/{sidebarScreen-DuLhKJQB.js.map → sidebarScreen-CSErMH2c.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-Lox6-RBs.esm.js → sidebarScreen-Cf__OCj5.esm.js} +3 -3
- package/dist/chunks/{sidebarScreen-Lox6-RBs.esm.js.map → sidebarScreen-Cf__OCj5.esm.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-D_c8mueN.js → uom-field-wrapper-BwBGeG5I.js} +29 -10
- package/dist/chunks/uom-field-wrapper-BwBGeG5I.js.map +1 -0
- package/dist/chunks/{uom-field-wrapper-CsRIQR4E.esm.js → uom-field-wrapper-oWX1Kcwg.esm.js} +29 -10
- package/dist/chunks/uom-field-wrapper-oWX1Kcwg.esm.js.map +1 -0
- package/dist/chunks/{useAddressContact-BI2XYnuW.esm.js → useAddressContact-CiCCkuNT.esm.js} +3 -3
- package/dist/chunks/{useAddressContact-BI2XYnuW.esm.js.map → useAddressContact-CiCCkuNT.esm.js.map} +1 -1
- package/dist/chunks/{useAddressContact-DEl4_ZBi.js → useAddressContact-jfZLI0ck.js} +3 -3
- package/dist/chunks/{useAddressContact-DEl4_ZBi.js.map → useAddressContact-jfZLI0ck.js.map} +1 -1
- package/dist/components/index.esm.js +7 -7
- package/dist/components/index.js +7 -7
- package/dist/components/material-table/material-table.d.ts +2 -1
- package/dist/components/reports-title-bar/reports-title-bar.d.ts +1 -0
- package/dist/constants/defaultColumns.d.ts +1 -0
- package/dist/constants/index.esm.js +101 -100
- package/dist/constants/index.js +3 -2
- package/dist/constants/index.js.map +1 -1
- 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 +114 -113
- package/dist/index.js +14 -13
- 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/material-table/material-table.d.ts +2 -1
- package/dist/src/components/reports-title-bar/reports-title-bar.d.ts +1 -0
- package/dist/src/constants/defaultColumns.d.ts +1 -0
- package/dist/views/index.esm.js +9 -9
- package/dist/views/index.js +6 -6
- package/package.json +1 -1
- package/dist/chunks/uom-field-wrapper-CsRIQR4E.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-D_c8mueN.js.map +0 -1
|
@@ -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-C9ey8q7A.js");
|
|
5
|
+
const sidebar = require("./sidebar-mRDqCVsd.js");
|
|
6
6
|
const mui_constants = require("./mui.constants-CJEIUmWO.js");
|
|
7
7
|
const useLangauge = require("./useLangauge-DwpLau6o.js");
|
|
8
8
|
const common = require("./common-JwQWCeAL.js");
|
|
@@ -196,4 +196,4 @@ const SidebarLayout = (props) => {
|
|
|
196
196
|
);
|
|
197
197
|
};
|
|
198
198
|
exports.SidebarLayout = SidebarLayout;
|
|
199
|
-
//# sourceMappingURL=sidebarScreen-
|
|
199
|
+
//# sourceMappingURL=sidebarScreen-CSErMH2c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-DuLhKJQB.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';\nimport ChatBot from '../../components/chat-bot/chat-bot';\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\t// setOpen(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\t<ChatBot />\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","ChatBot"],"mappings":";;;;;;;;;;AAkBA,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,kBAAc,KAAK;AACnB,WAAO,aAAa,QAAQ,mBAAmB,OAAO;AAAA,EACvD,GAAG,CAAA,CAAE;AAEL,QAAM,CAAC,iBAAiB,kBAAkB,IAAIF,MAAAA,SAAc,IAAI;AAEhE,QAAM,cAAcE,MAAAA,YAAY,YAAY;;AAE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A,UACT,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,gBAAgB;AAAA,QAAA;AAAA,QAGjB,UAAAD,2BAAAA,kBAAAA,IAACC,OAAAA,OAAI,UAAA,aAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlB;AAEA,SACCC,2BAAAA,kBAAAA;AAAAA,IAACD,OAAAA;AAAAA,IAAA;AAAA,MACA,IAAI;AAAA,QACH,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,2BAAAA,kBAAAA;AAAAA,UAACG,OAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOC,cAAAA;AAAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDJ,2BAAAA,kBAAAA;AAAAA,UAACK,QAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOD,cAAAA;AAAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBJ,2BAAAA,kBAAAA;AAAAA,UAACM,OAAAA;AAAAA,UAAA;AAAA,YACA;AAAA,YAAA,aACAF,cAAAA;AAAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,yDAEPG,OAAAA,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;;"}
|
|
1
|
+
{"version":3,"file":"sidebarScreen-CSErMH2c.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';\nimport ChatBot from '../../components/chat-bot/chat-bot';\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\t// setOpen(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\t<ChatBot />\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","ChatBot"],"mappings":";;;;;;;;;;AAkBA,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,kBAAc,KAAK;AACnB,WAAO,aAAa,QAAQ,mBAAmB,OAAO;AAAA,EACvD,GAAG,CAAA,CAAE;AAEL,QAAM,CAAC,iBAAiB,kBAAkB,IAAIF,MAAAA,SAAc,IAAI;AAEhE,QAAM,cAAcE,MAAAA,YAAY,YAAY;;AAE3C,UAAM,YAAYC,OAAAA,SAAA;AAClB,UAAM,YAAY;AAAA,MACjB,WAAW,UAAU,SAAS;AA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D,2BAAAA,kBAAAA,IAACC,OAAAA,OAAI,UAAA,aAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlB;AAEA,SACCC,2BAAAA,kBAAAA;AAAAA,IAACD,OAAAA;AAAAA,IAAA;AAAA,MACA,IAAI;AAAA,QACH,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,2BAAAA,kBAAAA;AAAAA,UAACG,OAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOC,cAAAA;AAAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDJ,2BAAAA,kBAAAA;AAAAA,UAACK,QAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOD,cAAAA;AAAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBJ,2BAAAA,kBAAAA;AAAAA,UAACM,OAAAA;AAAAA,UAAA;AAAA,YACA;AAAA,YAAA,aACAF,cAAAA;AAAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,yDAEPG,OAAAA,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;;"}
|
|
@@ -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, C as ChatBot } from "./appbar-
|
|
4
|
-
import { S as Sidebar } from "./sidebar-
|
|
3
|
+
import { u as useTheme, f as Box, a as AppBarWrapper, A as ActivityArea, C as ChatBot } from "./appbar-5TrpZMbY.esm.js";
|
|
4
|
+
import { S as Sidebar } from "./sidebar-BbOMMvki.esm.js";
|
|
5
5
|
import { d as drawerWidth } from "./mui.constants-BFBzxaiA.esm.js";
|
|
6
6
|
import { u as useLanguage } from "./useLangauge-CetGgXqk.esm.js";
|
|
7
7
|
import { at as getToken } from "./common-BxysM2Z3.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-Cf__OCj5.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-Lox6-RBs.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';\nimport ChatBot from '../../components/chat-bot/chat-bot';\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\t// setOpen(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\t<ChatBot />\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["jsx","jsxs","AppBar","SideBar"],"mappings":";;;;;;;;;AAkBA,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,M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;"}
|
|
1
|
+
{"version":3,"file":"sidebarScreen-Cf__OCj5.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';\nimport ChatBot from '../../components/chat-bot/chat-bot';\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\t// setOpen(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\t<ChatBot />\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["jsx","jsxs","AppBar","SideBar"],"mappings":";;;;;;;;;AAkBA,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,OAAO;AAAA,EACvD,GAAG,CAAA,CAAE;AAEL,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAc,IAAI;AAEhE,QAAM,cAAc,YAAY,YAAY;;AAE3C,UAAM,YAAY,SAAA;AAClB,UAAM,YAAY;AAAA,MACjB,WAAW,UAAU,SAAS;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,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,8CAEP,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -3,8 +3,8 @@ const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
|
|
|
3
3
|
const reactHookForm = require("react-hook-form");
|
|
4
4
|
const identifier = require("./identifier-CaTy7Osd.js");
|
|
5
5
|
const useAuth = require("./useAuth-B3lJDoed.js");
|
|
6
|
-
const android12Switch = require("./android-12-switch-
|
|
7
|
-
const appbar = require("./appbar-
|
|
6
|
+
const android12Switch = require("./android-12-switch-_UhYJwIo.js");
|
|
7
|
+
const appbar = require("./appbar-C9ey8q7A.js");
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const DatePicker = require("react-datepicker");
|
|
10
10
|
;/* empty css */
|
|
@@ -23,12 +23,12 @@ const marked = require("marked");
|
|
|
23
23
|
const api = require("./api-PQmwG2-a.js");
|
|
24
24
|
const apiConfig = require("./api-config-DXwDMFn-.js");
|
|
25
25
|
const Yup = require("yup");
|
|
26
|
-
const checkbox = require("./checkbox-
|
|
26
|
+
const checkbox = require("./checkbox-BGOe79Cy.js");
|
|
27
27
|
const formBuilderDeconversion = require("./form-builder-deconversion-Cvk9TQ1b.js");
|
|
28
28
|
const radioButton = require("./radio-button-Z203yCd7.js");
|
|
29
29
|
const notistack = require("notistack");
|
|
30
30
|
const reactRedux = require("react-redux");
|
|
31
|
-
const ERPUIProvider = require("./ERPUIProvider-
|
|
31
|
+
const ERPUIProvider = require("./ERPUIProvider-C9xsCdz8.js");
|
|
32
32
|
const Board = require("@asseinfo/react-kanban");
|
|
33
33
|
const translations = require("./translations-jBUvz7sG.js");
|
|
34
34
|
const FullCalendar = require("@fullcalendar/react");
|
|
@@ -44,20 +44,20 @@ const arrowUp = require("./arrow-up-Dg35LjrD.js");
|
|
|
44
44
|
const ReactFlagsSelect = require("react-flags-select");
|
|
45
45
|
const reactRouterDom = require("react-router-dom");
|
|
46
46
|
const navigationUtils = require("./navigation-utils-CjGqJQmS.js");
|
|
47
|
-
const pageContext = require("./page-context-
|
|
47
|
+
const pageContext = require("./page-context-oSxL8_xq.js");
|
|
48
48
|
const ganttTaskReact = require("gantt-task-react");
|
|
49
49
|
const reactDateRange = require("react-date-range");
|
|
50
50
|
const actionBar = require("./action-bar-DMv6sqDP.js");
|
|
51
51
|
const DataEditor = require("@glideapps/glide-data-grid");
|
|
52
52
|
const glideDataGridCells = require("@glideapps/glide-data-grid-cells");
|
|
53
53
|
const ReactDOM = require("react-dom");
|
|
54
|
-
const sidebar = require("./sidebar-
|
|
54
|
+
const sidebar = require("./sidebar-mRDqCVsd.js");
|
|
55
55
|
const materialReactTable = require("material-react-table");
|
|
56
56
|
const trash = require("./trash-C63VDmtW.js");
|
|
57
57
|
const _$1 = require("lodash");
|
|
58
|
-
const modules = require("./modules-
|
|
58
|
+
const modules = require("./modules-BLLiy7lE.js");
|
|
59
59
|
const pathname_rental = require("./pathname.rental-C0Yjyyx7.js");
|
|
60
|
-
const routePageMap = require("./route-page-map-
|
|
60
|
+
const routePageMap = require("./route-page-map-DiM8kR2P.js");
|
|
61
61
|
const hooks = require("./hooks-DsdahmnZ.js");
|
|
62
62
|
const store = require("./store-DZMbCH9Y.js");
|
|
63
63
|
const reactDropzone = require("react-dropzone");
|
|
@@ -10237,7 +10237,8 @@ const ReportsTitleBar = (props) => {
|
|
|
10237
10237
|
filterKeys = {},
|
|
10238
10238
|
searchBar,
|
|
10239
10239
|
/** Custom ReactNode components rendered after the standard filters. */
|
|
10240
|
-
customFilterComponents = []
|
|
10240
|
+
customFilterComponents = [],
|
|
10241
|
+
autoShowFiltersWithValue = false
|
|
10241
10242
|
} = props;
|
|
10242
10243
|
const startDateKey = (filterKeys == null ? void 0 : filterKeys.start_date) || "start_date";
|
|
10243
10244
|
const endDateKey = (filterKeys == null ? void 0 : filterKeys.end_date) || "end_date";
|
|
@@ -10398,6 +10399,24 @@ const ReportsTitleBar = (props) => {
|
|
|
10398
10399
|
multiple: filter.multiple || false,
|
|
10399
10400
|
options: filter.options || void 0
|
|
10400
10401
|
}))) || [];
|
|
10402
|
+
React.useEffect(() => {
|
|
10403
|
+
if (!autoShowFiltersWithValue) return;
|
|
10404
|
+
setSelectedItems((prev) => {
|
|
10405
|
+
const visibleKeys = new Set(prev.map((item) => item == null ? void 0 : item.value));
|
|
10406
|
+
let changed = false;
|
|
10407
|
+
const next = [...prev];
|
|
10408
|
+
filtersConfig.forEach((config) => {
|
|
10409
|
+
if (visibleKeys.has(config.key)) return;
|
|
10410
|
+
const val = filters == null ? void 0 : filters[config.valueKey];
|
|
10411
|
+
const hasValue = Array.isArray(val) ? val.length > 0 : val !== void 0 && val !== null && val !== "";
|
|
10412
|
+
if (hasValue) {
|
|
10413
|
+
next.push({ value: config.key });
|
|
10414
|
+
changed = true;
|
|
10415
|
+
}
|
|
10416
|
+
});
|
|
10417
|
+
return changed ? next : prev;
|
|
10418
|
+
});
|
|
10419
|
+
}, [filters, filtersConfig, autoShowFiltersWithValue]);
|
|
10401
10420
|
const options = [
|
|
10402
10421
|
{
|
|
10403
10422
|
label: navigationUtils.RANGE.TODAY,
|
|
@@ -16799,4 +16818,4 @@ exports.dynamicFields = dynamicFields;
|
|
|
16799
16818
|
exports.fields = fields;
|
|
16800
16819
|
exports.useDynamicLayout = useDynamicLayout;
|
|
16801
16820
|
exports.validator = validator;
|
|
16802
|
-
//# sourceMappingURL=uom-field-wrapper-
|
|
16821
|
+
//# sourceMappingURL=uom-field-wrapper-BwBGeG5I.js.map
|