Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/dd662a1eaf74585145ec2dce55b3b5ec1e8d1a454970eb465a2e57f504e740ac.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
14 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\nimport { useGridLogger } from '../../utils/useGridLogger';\nimport { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';\nimport { gridPreferencePanelStateSelector } from './gridPreferencePanelSelector';\nexport const preferencePanelStateInitializer = (state, props) => {\n var _props$initialState$p, _props$initialState;\n return _extends({}, state, {\n preferencePanel: (_props$initialState$p = (_props$initialState = props.initialState) == null ? void 0 : _props$initialState.preferencePanel) != null ? _props$initialState$p : {\n open: false\n }\n });\n};\n/**\n * TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`\n */\n\nexport const useGridPreferencesPanel = (apiRef, props) => {\n var _props$initialState3;\n const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');\n const hideTimeout = React.useRef();\n const immediateTimeout = React.useRef();\n /**\n * API METHODS\n */\n\n const hidePreferences = React.useCallback(() => {\n logger.debug('Hiding Preferences Panel');\n const preferencePanelState = gridPreferencePanelStateSelector(apiRef.current.state);\n if (preferencePanelState.openedPanelValue) {\n apiRef.current.publishEvent('preferencePanelClose', {\n openedPanelValue: preferencePanelState.openedPanelValue\n });\n }\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel: {\n open: false\n }\n }));\n apiRef.current.forceUpdate();\n }, [apiRef, logger]); // This is to prevent the preferences from closing when you open a select box or another panel,\n // The issue is in MUI core V4 => Fixed in V5\n\n const doNotHidePanel = React.useCallback(() => {\n immediateTimeout.current = setTimeout(() => clearTimeout(hideTimeout.current), 0);\n }, []); // This is a hack for the issue with Core V4, by delaying hiding the panel on the clickAwayListener,\n // we can cancel the action if the trigger element still need the panel...\n\n const hidePreferencesDelayed = React.useCallback(() => {\n hideTimeout.current = setTimeout(hidePreferences, 100);\n }, [hidePreferences]);\n const showPreferences = React.useCallback(newValue => {\n logger.debug('Opening Preferences Panel');\n doNotHidePanel();\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel: _extends({}, state.preferencePanel, {\n open: true,\n openedPanelValue: newValue\n })\n }));\n apiRef.current.publishEvent('preferencePanelOpen', {\n openedPanelValue: newValue\n });\n apiRef.current.forceUpdate();\n }, [logger, doNotHidePanel, apiRef]);\n useGridApiMethod(apiRef, {\n showPreferences,\n hidePreferences: hidePreferencesDelayed\n }, 'ColumnMenuApi');\n /**\n * PRE-PROCESSING\n */\n\n const stateExportPreProcessing = React.useCallback((prevState, context) => {\n var _props$initialState2;\n const preferencePanelToExport = gridPreferencePanelStateSelector(apiRef.current.state);\n const shouldExportPreferencePanel =\n // Always export if the `exportOnlyDirtyModels` property is activated\n !context.exportOnlyDirtyModels ||\n // Always export if the panel was initialized\n ((_props$initialState2 = props.initialState) == null ? void 0 : _props$initialState2.preferencePanel) != null ||\n // Always export if the panel is opened\n preferencePanelToExport.open;\n if (!shouldExportPreferencePanel) {\n return prevState;\n }\n return _extends({}, prevState, {\n preferencePanel: preferencePanelToExport\n });\n }, [apiRef, (_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.preferencePanel]);\n const stateRestorePreProcessing = React.useCallback((params, context) => {\n const preferencePanel = context.stateToRestore.preferencePanel;\n if (preferencePanel != null) {\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel\n }));\n }\n return params;\n }, [apiRef]);\n useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);\n useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);\n /**\n * EFFECTS\n */\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hideTimeout.current);\n clearTimeout(immediateTimeout.current);\n };\n }, []);\n};","map":{"version":3,"names":["_extends","React","useGridApiMethod","useGridLogger","useGridRegisterPipeProcessor","gridPreferencePanelStateSelector","preferencePanelStateInitializer","state","props","_props$initialState$p","_props$initialState","preferencePanel","initialState","open","useGridPreferencesPanel","apiRef","_props$initialState3","logger","hideTimeout","useRef","immediateTimeout","hidePreferences","useCallback","debug","preferencePanelState","current","openedPanelValue","publishEvent","setState","forceUpdate","doNotHidePanel","setTimeout","clearTimeout","hidePreferencesDelayed","showPreferences","newValue","stateExportPreProcessing","prevState","context","_props$initialState2","preferencePanelToExport","shouldExportPreferencePanel","exportOnlyDirtyModels","stateRestorePreProcessing","params","stateToRestore","useEffect"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/features/preferencesPanel/useGridPreferencesPanel.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\nimport { useGridLogger } from '../../utils/useGridLogger';\nimport { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';\nimport { gridPreferencePanelStateSelector } from './gridPreferencePanelSelector';\nexport const preferencePanelStateInitializer = (state, props) => {\n var _props$initialState$p, _props$initialState;\n\n return _extends({}, state, {\n preferencePanel: (_props$initialState$p = (_props$initialState = props.initialState) == null ? void 0 : _props$initialState.preferencePanel) != null ? _props$initialState$p : {\n open: false\n }\n });\n};\n/**\n * TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`\n */\n\nexport const useGridPreferencesPanel = (apiRef, props) => {\n var _props$initialState3;\n\n const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');\n const hideTimeout = React.useRef();\n const immediateTimeout = React.useRef();\n /**\n * API METHODS\n */\n\n const hidePreferences = React.useCallback(() => {\n logger.debug('Hiding Preferences Panel');\n const preferencePanelState = gridPreferencePanelStateSelector(apiRef.current.state);\n\n if (preferencePanelState.openedPanelValue) {\n apiRef.current.publishEvent('preferencePanelClose', {\n openedPanelValue: preferencePanelState.openedPanelValue\n });\n }\n\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel: {\n open: false\n }\n }));\n apiRef.current.forceUpdate();\n }, [apiRef, logger]); // This is to prevent the preferences from closing when you open a select box or another panel,\n // The issue is in MUI core V4 => Fixed in V5\n\n const doNotHidePanel = React.useCallback(() => {\n immediateTimeout.current = setTimeout(() => clearTimeout(hideTimeout.current), 0);\n }, []); // This is a hack for the issue with Core V4, by delaying hiding the panel on the clickAwayListener,\n // we can cancel the action if the trigger element still need the panel...\n\n const hidePreferencesDelayed = React.useCallback(() => {\n hideTimeout.current = setTimeout(hidePreferences, 100);\n }, [hidePreferences]);\n const showPreferences = React.useCallback(newValue => {\n logger.debug('Opening Preferences Panel');\n doNotHidePanel();\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel: _extends({}, state.preferencePanel, {\n open: true,\n openedPanelValue: newValue\n })\n }));\n apiRef.current.publishEvent('preferencePanelOpen', {\n openedPanelValue: newValue\n });\n apiRef.current.forceUpdate();\n }, [logger, doNotHidePanel, apiRef]);\n useGridApiMethod(apiRef, {\n showPreferences,\n hidePreferences: hidePreferencesDelayed\n }, 'ColumnMenuApi');\n /**\n * PRE-PROCESSING\n */\n\n const stateExportPreProcessing = React.useCallback((prevState, context) => {\n var _props$initialState2;\n\n const preferencePanelToExport = gridPreferencePanelStateSelector(apiRef.current.state);\n const shouldExportPreferencePanel = // Always export if the `exportOnlyDirtyModels` property is activated\n !context.exportOnlyDirtyModels || // Always export if the panel was initialized\n ((_props$initialState2 = props.initialState) == null ? void 0 : _props$initialState2.preferencePanel) != null || // Always export if the panel is opened\n preferencePanelToExport.open;\n\n if (!shouldExportPreferencePanel) {\n return prevState;\n }\n\n return _extends({}, prevState, {\n preferencePanel: preferencePanelToExport\n });\n }, [apiRef, (_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.preferencePanel]);\n const stateRestorePreProcessing = React.useCallback((params, context) => {\n const preferencePanel = context.stateToRestore.preferencePanel;\n\n if (preferencePanel != null) {\n apiRef.current.setState(state => _extends({}, state, {\n preferencePanel\n }));\n }\n\n return params;\n }, [apiRef]);\n useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);\n useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);\n /**\n * EFFECTS\n */\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hideTimeout.current);\n clearTimeout(immediateTimeout.current);\n };\n }, []);\n};"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,4BAA4B,QAAQ,2BAA2B;AACxE,SAASC,gCAAgC,QAAQ,+BAA+B;AAChF,OAAO,MAAMC,+BAA+B,GAAGA,CAACC,KAAK,EAAEC,KAAK,KAAK;EAC/D,IAAIC,qBAAqB,EAAEC,mBAAmB;EAE9C,OAAOV,QAAQ,CAAC,CAAC,CAAC,EAAEO,KAAK,EAAE;IACzBI,eAAe,EAAE,CAACF,qBAAqB,GAAG,CAACC,mBAAmB,GAAGF,KAAK,CAACI,YAAY,KAAK,IAAI,GAAG,KAAK,CAAC,GAAGF,mBAAmB,CAACC,eAAe,KAAK,IAAI,GAAGF,qBAAqB,GAAG;MAC7KI,IAAI,EAAE;IACR;EACF,CAAC,CAAC;AACJ,CAAC;AACD;AACA;AACA;;AAEA,OAAO,MAAMC,uBAAuB,GAAGA,CAACC,MAAM,EAAEP,KAAK,KAAK;EACxD,IAAIQ,oBAAoB;EAExB,MAAMC,MAAM,GAAGd,aAAa,CAACY,MAAM,EAAE,yBAAyB,CAAC;EAC/D,MAAMG,WAAW,GAAGjB,KAAK,CAACkB,MAAM,CAAC,CAAC;EAClC,MAAMC,gBAAgB,GAAGnB,KAAK,CAACkB,MAAM,CAAC,CAAC;EACvC;AACF;AACA;;EAEE,MAAME,eAAe,GAAGpB,KAAK,CAACqB,WAAW,CAAC,MAAM;IAC9CL,MAAM,CAACM,KAAK,C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