@erpsquad/common 1.9.100 → 1.9.101
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-DSBIf4t0.esm.js → android-12-switch-DNPEmult.esm.js} +13 -12
- package/dist/chunks/android-12-switch-DNPEmult.esm.js.map +1 -0
- package/dist/chunks/{android-12-switch-DvCF0gyx.js → android-12-switch-cTw1ou6B.js} +13 -12
- package/dist/chunks/android-12-switch-cTw1ou6B.js.map +1 -0
- package/dist/chunks/{apiHelper-Cv_qWaYo.esm.js → apiHelper-73EBSKIp.esm.js} +5 -5
- package/dist/chunks/{apiHelper-Cv_qWaYo.esm.js.map → apiHelper-73EBSKIp.esm.js.map} +1 -1
- package/dist/chunks/{apiHelper-5tNsUtSY.js → apiHelper-BVJa3_k8.js} +5 -5
- package/dist/chunks/{apiHelper-5tNsUtSY.js.map → apiHelper-BVJa3_k8.js.map} +1 -1
- package/dist/chunks/{appbar-DM2iBqb4.esm.js → appbar-CqjkuAGQ.esm.js} +3 -3
- package/dist/chunks/{appbar-DM2iBqb4.esm.js.map → appbar-CqjkuAGQ.esm.js.map} +1 -1
- package/dist/chunks/{appbar-rfkAYQdQ.js → appbar-pTs1Yhzo.js} +3 -3
- package/dist/chunks/{appbar-rfkAYQdQ.js.map → appbar-pTs1Yhzo.js.map} +1 -1
- package/dist/chunks/{default-data-DQ7VPUoj.js → default-data-BDDKiXW_.js} +7 -7
- package/dist/chunks/{default-data-DQ7VPUoj.js.map → default-data-BDDKiXW_.js.map} +1 -1
- package/dist/chunks/{default-data-BV_r59U9.esm.js → default-data-Btk_wk18.esm.js} +7 -7
- package/dist/chunks/{default-data-BV_r59U9.esm.js.map → default-data-Btk_wk18.esm.js.map} +1 -1
- package/dist/chunks/{form-builder-deconversion-v5GvXDZ9.js → form-builder-deconversion-C4DFp-Jv.js} +2 -2
- package/dist/chunks/{form-builder-deconversion-v5GvXDZ9.js.map → form-builder-deconversion-C4DFp-Jv.js.map} +1 -1
- package/dist/chunks/{form-builder-deconversion-CUwBfP4C.esm.js → form-builder-deconversion-CIJWMHun.esm.js} +2 -2
- package/dist/chunks/{form-builder-deconversion-CUwBfP4C.esm.js.map → form-builder-deconversion-CIJWMHun.esm.js.map} +1 -1
- package/dist/chunks/{fullScreen-Bfrr-bT2.js → fullScreen-BNlY6F_Z.js} +2 -2
- package/dist/chunks/{fullScreen-Bfrr-bT2.js.map → fullScreen-BNlY6F_Z.js.map} +1 -1
- package/dist/chunks/{fullScreen-BO0UA3Zr.esm.js → fullScreen-CV8aHM8J.esm.js} +2 -2
- package/dist/chunks/{fullScreen-BO0UA3Zr.esm.js.map → fullScreen-CV8aHM8J.esm.js.map} +1 -1
- package/dist/chunks/{languageContext-BP7EvzMv.js → languageContext-BSEvKGy9.js} +2 -2
- package/dist/chunks/{languageContext-BP7EvzMv.js.map → languageContext-BSEvKGy9.js.map} +1 -1
- package/dist/chunks/{languageContext-DM_LTp53.esm.js → languageContext-D_khAb2z.esm.js} +2 -2
- package/dist/chunks/{languageContext-DM_LTp53.esm.js.map → languageContext-D_khAb2z.esm.js.map} +1 -1
- package/dist/chunks/{migration-utils-D9TSOBR0.esm.js → migration-utils-ChJDhzct.esm.js} +96 -15
- package/dist/chunks/migration-utils-ChJDhzct.esm.js.map +1 -0
- package/dist/chunks/{migration-utils-DwLXzWtr.js → migration-utils-D_sKDk5V.js} +96 -15
- package/dist/chunks/migration-utils-D_sKDk5V.js.map +1 -0
- package/dist/chunks/{page-context-B_wK6kLR.esm.js → page-context-D0QJui88.esm.js} +154 -57
- package/dist/chunks/page-context-D0QJui88.esm.js.map +1 -0
- package/dist/chunks/{page-context-h7LEMAG0.js → page-context-fgpShY8H.js} +153 -56
- package/dist/chunks/page-context-fgpShY8H.js.map +1 -0
- package/dist/chunks/{pathname.quotes-B-KBD2nK.js → pathname.quotes-B3uFEZQS.js} +8 -2
- package/dist/chunks/{pathname.quotes-B-KBD2nK.js.map → pathname.quotes-B3uFEZQS.js.map} +1 -1
- package/dist/chunks/{pathname.quotes-BJy0IzWu.esm.js → pathname.quotes-Y66LAPf2.esm.js} +8 -2
- package/dist/chunks/{pathname.quotes-BJy0IzWu.esm.js.map → pathname.quotes-Y66LAPf2.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-l49eLo8p.esm.js → sidebar-DGGqCL8z.esm.js} +4 -4
- package/dist/chunks/{sidebar-l49eLo8p.esm.js.map → sidebar-DGGqCL8z.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-C2zkLZyA.js → sidebar-DZ3SNJU4.js} +4 -4
- package/dist/chunks/{sidebar-C2zkLZyA.js.map → sidebar-DZ3SNJU4.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-BQN2N8jx.esm.js → sidebarScreen-D0v7aHxc.esm.js} +4 -4
- package/dist/chunks/{sidebarScreen-BQN2N8jx.esm.js.map → sidebarScreen-D0v7aHxc.esm.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-PoYXto7E.js → sidebarScreen-usZhvsdA.js} +4 -4
- package/dist/chunks/{sidebarScreen-PoYXto7E.js.map → sidebarScreen-usZhvsdA.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-w7UsTsC3.js → uom-field-wrapper-C_fC_3cE.js} +18 -14
- package/dist/chunks/uom-field-wrapper-C_fC_3cE.js.map +1 -0
- package/dist/chunks/{uom-field-wrapper-DT4aQVEz.esm.js → uom-field-wrapper-Wz8rJ_Zi.esm.js} +18 -14
- package/dist/chunks/uom-field-wrapper-Wz8rJ_Zi.esm.js.map +1 -0
- package/dist/chunks/{useAccountSetting-ngzko7sX.js → useAccountSetting-BUtKbR7D.js} +2 -2
- package/dist/chunks/{useAccountSetting-ngzko7sX.js.map → useAccountSetting-BUtKbR7D.js.map} +1 -1
- package/dist/chunks/{useAccountSetting-D6Hhq1Pz.esm.js → useAccountSetting-YwdjGrxs.esm.js} +2 -2
- package/dist/chunks/{useAccountSetting-D6Hhq1Pz.esm.js.map → useAccountSetting-YwdjGrxs.esm.js.map} +1 -1
- package/dist/chunks/{useAuth-HvZ6U960.js → useAuth-Bn-Dk5iL.js} +3 -1
- package/dist/chunks/{useAuth-HvZ6U960.js.map → useAuth-Bn-Dk5iL.js.map} +1 -1
- package/dist/chunks/{useAuth-Tfx2guEJ.esm.js → useAuth-DatwJNOz.esm.js} +3 -1
- package/dist/chunks/{useAuth-Tfx2guEJ.esm.js.map → useAuth-DatwJNOz.esm.js.map} +1 -1
- package/dist/chunks/{useLangauge-DwsR1jcv.js → useLangauge-CZdmpat2.js} +2 -2
- package/dist/chunks/{useLangauge-DwsR1jcv.js.map → useLangauge-CZdmpat2.js.map} +1 -1
- package/dist/chunks/{useLangauge-BU_fP3ZM.esm.js → useLangauge-ko-Wm4Qq.esm.js} +2 -2
- package/dist/chunks/{useLangauge-BU_fP3ZM.esm.js.map → useLangauge-ko-Wm4Qq.esm.js.map} +1 -1
- package/dist/chunks/{useReduxIntegration-VgWJGErE.esm.js → useReduxIntegration-B8otN3ek.esm.js} +3 -3
- package/dist/chunks/{useReduxIntegration-VgWJGErE.esm.js.map → useReduxIntegration-B8otN3ek.esm.js.map} +1 -1
- package/dist/chunks/{useReduxIntegration-JMVTp0lq.js → useReduxIntegration-CZkiPDYL.js} +3 -3
- package/dist/chunks/{useReduxIntegration-JMVTp0lq.js.map → useReduxIntegration-CZkiPDYL.js.map} +1 -1
- package/dist/components/index.esm.js +8 -8
- package/dist/components/index.js +8 -8
- package/dist/components/protected-route.d.ts +1 -1
- package/dist/constants/index.esm.js +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/lang/en.d.ts +6 -0
- package/dist/constants/resource-lang.d.ts +6 -0
- package/dist/contexts/index.esm.js +3 -3
- package/dist/contexts/index.js +3 -3
- package/dist/hooks/index.esm.js +5 -5
- package/dist/hooks/index.js +5 -5
- package/dist/index.esm.js +17 -17
- package/dist/index.js +17 -17
- package/dist/layout/index.esm.js +2 -2
- package/dist/layout/index.js +2 -2
- package/dist/src/components/protected-route.d.ts +1 -1
- package/dist/src/constants/lang/en.d.ts +6 -0
- package/dist/src/constants/resource-lang.d.ts +6 -0
- package/dist/src/utils/format-permissions.d.ts +23 -0
- package/dist/src/utils/format-permissions_old.d.ts +11 -0
- package/dist/src/utils/menu-filter.d.ts +4 -2
- package/dist/utils/format-permissions.d.ts +23 -0
- package/dist/utils/format-permissions_old.d.ts +11 -0
- package/dist/utils/index.esm.js +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/menu-filter.d.ts +4 -2
- package/dist/views/index.esm.js +6 -6
- package/dist/views/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunks/android-12-switch-DSBIf4t0.esm.js.map +0 -1
- package/dist/chunks/android-12-switch-DvCF0gyx.js.map +0 -1
- package/dist/chunks/migration-utils-D9TSOBR0.esm.js.map +0 -1
- package/dist/chunks/migration-utils-DwLXzWtr.js.map +0 -1
- package/dist/chunks/page-context-B_wK6kLR.esm.js.map +0 -1
- package/dist/chunks/page-context-h7LEMAG0.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-DT4aQVEz.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-w7UsTsC3.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
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-CqjkuAGQ.esm.js";
|
|
4
|
+
import { S as Sidebar } from "./sidebar-DGGqCL8z.esm.js";
|
|
5
5
|
import { d as drawerWidth } from "./mui.constants-BFBzxaiA.esm.js";
|
|
6
|
-
import { u as useLanguage } from "./useLangauge-
|
|
6
|
+
import { u as useLanguage } from "./useLangauge-ko-Wm4Qq.esm.js";
|
|
7
7
|
import { ar as getToken } from "./common-B6euWODJ.esm.js";
|
|
8
8
|
import { m as getV1Settings } from "./api-BAbF3OU7.esm.js";
|
|
9
9
|
import { useLocation } from "react-router-dom";
|
|
@@ -197,4 +197,4 @@ const SidebarLayout = (props) => {
|
|
|
197
197
|
export {
|
|
198
198
|
SidebarLayout as S
|
|
199
199
|
};
|
|
200
|
-
//# sourceMappingURL=sidebarScreen-
|
|
200
|
+
//# sourceMappingURL=sidebarScreen-D0v7aHxc.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-BQN2N8jx.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,CA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AA,EACD,GAAG,CAAC,UAAU,CAAC;AAGf,MAAI,CAAC,eAAe;AACnB,WACCA,kCAAAA;AAAAA,MAAC;AAAA,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
|
+
{"version":3,"file":"sidebarScreen-D0v7aHxc.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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A;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,10 +1,10 @@
|
|
|
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-pTs1Yhzo.js");
|
|
5
|
+
const sidebar = require("./sidebar-DZ3SNJU4.js");
|
|
6
6
|
const mui_constants = require("./mui.constants-CJEIUmWO.js");
|
|
7
|
-
const useLangauge = require("./useLangauge-
|
|
7
|
+
const useLangauge = require("./useLangauge-CZdmpat2.js");
|
|
8
8
|
const common = require("./common-6VUrYJDq.js");
|
|
9
9
|
const api = require("./api-DJMpbRRM.js");
|
|
10
10
|
const reactRouterDom = require("react-router-dom");
|
|
@@ -196,4 +196,4 @@ const SidebarLayout = (props) => {
|
|
|
196
196
|
);
|
|
197
197
|
};
|
|
198
198
|
exports.SidebarLayout = SidebarLayout;
|
|
199
|
-
//# sourceMappingURL=sidebarScreen-
|
|
199
|
+
//# sourceMappingURL=sidebarScreen-usZhvsdA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarScreen-PoYXto7E.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,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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AI;AAAA,UACH,SAAS;AAAA,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,MACR;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
|
|
1
|
+
{"version":3,"file":"sidebarScreen-usZhvsdA.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","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AA,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,MACR;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
|
|
3
3
|
const reactHookForm = require("react-hook-form");
|
|
4
4
|
const identifier = require("./identifier-B8P9ZGxG.js");
|
|
5
|
-
const useAuth = require("./useAuth-
|
|
6
|
-
const android12Switch = require("./android-12-switch-
|
|
7
|
-
const appbar = require("./appbar-
|
|
5
|
+
const useAuth = require("./useAuth-Bn-Dk5iL.js");
|
|
6
|
+
const android12Switch = require("./android-12-switch-cTw1ou6B.js");
|
|
7
|
+
const appbar = require("./appbar-pTs1Yhzo.js");
|
|
8
8
|
const React = require("react");
|
|
9
9
|
const DatePicker = require("react-datepicker");
|
|
10
10
|
;/* empty css */
|
|
11
11
|
const images = require("./images-Cmybjd2S.js");
|
|
12
12
|
const iconsMaterial = require("@mui/icons-material");
|
|
13
13
|
const material = require("@mui/material");
|
|
14
|
-
const useLangauge = require("./useLangauge-
|
|
14
|
+
const useLangauge = require("./useLangauge-CZdmpat2.js");
|
|
15
15
|
const dayjs = require("dayjs");
|
|
16
16
|
;/* empty css */
|
|
17
17
|
const common = require("./common-6VUrYJDq.js");
|
|
@@ -20,12 +20,12 @@ const notification = require("./notification-lAbbtOBF.js");
|
|
|
20
20
|
const lucideReact = require("lucide-react");
|
|
21
21
|
const d3 = require("d3");
|
|
22
22
|
const Yup = require("yup");
|
|
23
|
-
const formBuilderDeconversion = require("./form-builder-deconversion-
|
|
23
|
+
const formBuilderDeconversion = require("./form-builder-deconversion-C4DFp-Jv.js");
|
|
24
24
|
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-BVJa3_k8.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,17 +39,17 @@ 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-fgpShY8H.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-DZ3SNJU4.js");
|
|
50
50
|
const materialReactTable = require("material-react-table");
|
|
51
51
|
const _$1 = require("lodash");
|
|
52
|
-
const useAccountSetting = require("./useAccountSetting-
|
|
52
|
+
const useAccountSetting = require("./useAccountSetting-BUtKbR7D.js");
|
|
53
53
|
const modules = require("./modules-C3T2Pnwc.js");
|
|
54
54
|
const pathname_rental = require("./pathname.rental-C9fm1WTq.js");
|
|
55
55
|
const pathname_hrms = require("./pathname.hrms-2_BEXO_r.js");
|
|
@@ -7308,6 +7308,8 @@ const InlineEditFields = ({
|
|
|
7308
7308
|
syncFieldValue
|
|
7309
7309
|
}) => {
|
|
7310
7310
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7311
|
+
console.log("🚀 ~ InlineEditFields ~ row:", row);
|
|
7312
|
+
console.log("🚀 ~ InlineEditFields ~ col:", col);
|
|
7311
7313
|
const [inputValue, setInputValue] = React.useState();
|
|
7312
7314
|
const [isInitialSet, setIsInitialSet] = React.useState(false);
|
|
7313
7315
|
const customFilter = React.useRef(null);
|
|
@@ -7429,14 +7431,15 @@ const InlineEditFields = ({
|
|
|
7429
7431
|
const editFields = Object.keys(row._valuesCache || {});
|
|
7430
7432
|
const dValues = {};
|
|
7431
7433
|
row.getAllCells().forEach((cell) => {
|
|
7432
|
-
var _a2, _b2, _c2;
|
|
7434
|
+
var _a2, _b2, _c2, _d2;
|
|
7433
7435
|
if (((_a2 = cell.column.columnDef) == null ? void 0 : _a2.enableEditing) === void 0 || ((_b2 = cell.column.columnDef) == null ? void 0 : _b2.enableEditing) === true) {
|
|
7434
7436
|
const { is_multiple, valueKey: valueKey2 } = ((_c2 = cell.column.columnDef) == null ? void 0 : _c2.editProperties) || {};
|
|
7437
|
+
const cellEditVariant = (_d2 = cell.column.columnDef) == null ? void 0 : _d2.editVariant;
|
|
7435
7438
|
if (editFields.includes(cell.column.id)) {
|
|
7436
7439
|
const vl = _$1.get(row.original, valueKey2);
|
|
7437
|
-
if (
|
|
7440
|
+
if (cellEditVariant === "select" && is_multiple) {
|
|
7438
7441
|
dValues[cell.column.id] = vl ? Array.isArray(vl) ? vl : [vl] : [];
|
|
7439
|
-
} else if (
|
|
7442
|
+
} else if (cellEditVariant === "date" || cellEditVariant === "date_time" || cellEditVariant === "time") {
|
|
7440
7443
|
dValues[cell.column.id] = vl ? dayjs(vl).isValid() ? dayjs(vl) : void 0 : dayjs(row.original[cell.column.id]).isValid() ? dayjs(row.original[cell.column.id]) : void 0;
|
|
7441
7444
|
} else {
|
|
7442
7445
|
dValues[cell.column.id] = _$1.get(
|
|
@@ -15823,7 +15826,8 @@ const useUomFieldUpdater = ({
|
|
|
15823
15826
|
if (location_quantity) {
|
|
15824
15827
|
switch (sourceKey) {
|
|
15825
15828
|
case "total_on_hand_quantity":
|
|
15826
|
-
|
|
15829
|
+
const totalOnHand = location_quantity.total_available_quantity - location_quantity.total_reserved_quantity;
|
|
15830
|
+
convertedValue = totalOnHand > 0 ? totalOnHand / factor : 0;
|
|
15827
15831
|
break;
|
|
15828
15832
|
case "total_available_quantity":
|
|
15829
15833
|
convertedValue = location_quantity.total_available_quantity / factor;
|
|
@@ -15992,4 +15996,4 @@ exports.dynamicFields = dynamicFields;
|
|
|
15992
15996
|
exports.fields = fields;
|
|
15993
15997
|
exports.useDynamicLayout = useDynamicLayout;
|
|
15994
15998
|
exports.validator = validator;
|
|
15995
|
-
//# sourceMappingURL=uom-field-wrapper-
|
|
15999
|
+
//# sourceMappingURL=uom-field-wrapper-C_fC_3cE.js.map
|