PromoCursed/node_modules/.cache/babel-loader/5372724fe2962fe65ea4a97760b55e24d909cb526f85a8e97208df624fa6a870.json
2024-08-20 23:25:37 +04:00

1 line
7.7 KiB
JSON

{"ast":null,"code":"import { getShadowRoot } from \"rc-util/es/Dom/shadow\";\nimport { warning } from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { getWin } from \"../util\";\nexport default function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {\n var openRef = React.useRef(open);\n openRef.current = open;\n\n // Click to hide is special action since click popup element should not hide\n React.useEffect(function () {\n if (clickToHide && popupEle && (!mask || maskClosable)) {\n var onTriggerClose = function onTriggerClose(e) {\n var _e$composedPath;\n if (openRef.current && !inPopupOrChild(((_e$composedPath = e.composedPath) === null || _e$composedPath === void 0 || (_e$composedPath = _e$composedPath.call(e)) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath[0]) || e.target)) {\n triggerOpen(false);\n }\n };\n var win = getWin(popupEle);\n win.addEventListener('mousedown', onTriggerClose, true);\n win.addEventListener('contextmenu', onTriggerClose, true);\n\n // shadow root\n var targetShadowRoot = getShadowRoot(targetEle);\n if (targetShadowRoot) {\n targetShadowRoot.addEventListener('mousedown', onTriggerClose, true);\n targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true);\n }\n\n // Warning if target and popup not in same root\n if (process.env.NODE_ENV !== 'production') {\n var _targetEle$getRootNod, _popupEle$getRootNode;\n var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);\n var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);\n warning(targetRoot === popupRoot, \"trigger element and popup element should in same shadow root.\");\n }\n return function () {\n win.removeEventListener('mousedown', onTriggerClose, true);\n win.removeEventListener('contextmenu', onTriggerClose, true);\n if (targetShadowRoot) {\n targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true);\n targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true);\n }\n };\n }\n }, [clickToHide, targetEle, popupEle, mask, maskClosable]);\n}","map":{"version":3,"names":["getShadowRoot","warning","React","getWin","useWinClick","open","clickToHide","targetEle","popupEle","mask","maskClosable","inPopupOrChild","triggerOpen","openRef","useRef","current","useEffect","onTriggerClose","e","_e$composedPath","composedPath","call","target","win","addEventListener","targetShadowRoot","process","env","NODE_ENV","_targetEle$getRootNod","_popupEle$getRootNode","targetRoot","getRootNode","popupRoot","removeEventListener"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@rc-component/trigger/es/hooks/useWinClick.js"],"sourcesContent":["import { getShadowRoot } from \"rc-util/es/Dom/shadow\";\nimport { warning } from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { getWin } from \"../util\";\nexport default function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {\n var openRef = React.useRef(open);\n openRef.current = open;\n\n // Click to hide is special action since click popup element should not hide\n React.useEffect(function () {\n if (clickToHide && popupEle && (!mask || maskClosable)) {\n var onTriggerClose = function onTriggerClose(e) {\n var _e$composedPath;\n if (openRef.current && !inPopupOrChild(((_e$composedPath = e.composedPath) === null || _e$composedPath === void 0 || (_e$composedPath = _e$composedPath.call(e)) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath[0]) || e.target)) {\n triggerOpen(false);\n }\n };\n var win = getWin(popupEle);\n win.addEventListener('mousedown', onTriggerClose, true);\n win.addEventListener('contextmenu', onTriggerClose, true);\n\n // shadow root\n var targetShadowRoot = getShadowRoot(targetEle);\n if (targetShadowRoot) {\n targetShadowRoot.addEventListener('mousedown', onTriggerClose, true);\n targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true);\n }\n\n // Warning if target and popup not in same root\n if (process.env.NODE_ENV !== 'production') {\n var _targetEle$getRootNod, _popupEle$getRootNode;\n var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);\n var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);\n warning(targetRoot === popupRoot, \"trigger element and popup element should in same shadow root.\");\n }\n return function () {\n win.removeEventListener('mousedown', onTriggerClose, true);\n win.removeEventListener('contextmenu', onTriggerClose, true);\n if (targetShadowRoot) {\n targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true);\n targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true);\n }\n };\n }\n }, [clickToHide, targetEle, popupEle, mask, maskClosable]);\n}"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,MAAM,QAAQ,SAAS;AAChC,eAAe,SAASC,WAAWA,CAACC,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,YAAY,EAAEC,cAAc,EAAEC,WAAW,EAAE;EAC3H,IAAIC,OAAO,GAAGX,KAAK,CAACY,MAAM,CAACT,IAAI,CAAC;EAChCQ,OAAO,CAACE,OAAO,GAAGV,IAAI;;EAEtB;EACAH,KAAK,CAACc,SAAS,CAAC,YAAY;IAC1B,IAAIV,WAAW,IAAIE,QAAQ,KAAK,CAACC,IAAI,IAAIC,YAAY,CAAC,EAAE;MACtD,IAAIO,cAAc,GAAG,SAASA,cAAcA,CAACC,CAAC,EAAE;QAC9C,IAAIC,eAAe;QACnB,IAAIN,OAAO,CAACE,OAAO,IAAI,CAACJ,cAAc,CAAC,CAAC,CAACQ,eAAe,GAAGD,CAAC,CAACE,YAAY,MAAM,IAAI,IAAID,eAAe,KAAK,KAAK,CAAC,IAAI,CAACA,eAAe,GAAGA,eAAe,C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