1 line
15 KiB
JSON
1 line
15 KiB
JSON
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport Portal from '@rc-component/portal';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nimport { RefContext } from \"./context\";\nimport DrawerPopup from \"./DrawerPopup\";\nimport { warnCheck } from \"./util\";\nvar Drawer = function Drawer(props) {\n var _props$open = props.open,\n open = _props$open === void 0 ? false : _props$open,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-drawer' : _props$prefixCls,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'right' : _props$placement,\n _props$autoFocus = props.autoFocus,\n autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,\n _props$keyboard = props.keyboard,\n keyboard = _props$keyboard === void 0 ? true : _props$keyboard,\n _props$width = props.width,\n width = _props$width === void 0 ? 378 : _props$width,\n _props$mask = props.mask,\n mask = _props$mask === void 0 ? true : _props$mask,\n _props$maskClosable = props.maskClosable,\n maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable,\n getContainer = props.getContainer,\n forceRender = props.forceRender,\n afterOpenChange = props.afterOpenChange,\n destroyOnClose = props.destroyOnClose,\n onMouseEnter = props.onMouseEnter,\n onMouseOver = props.onMouseOver,\n onMouseLeave = props.onMouseLeave,\n onClick = props.onClick,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n panelRef = props.panelRef;\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n animatedVisible = _React$useState2[0],\n setAnimatedVisible = _React$useState2[1];\n\n // ============================= Warn =============================\n if (process.env.NODE_ENV !== 'production') {\n warnCheck(props);\n }\n\n // ============================= Open =============================\n var _React$useState3 = React.useState(false),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n mounted = _React$useState4[0],\n setMounted = _React$useState4[1];\n useLayoutEffect(function () {\n setMounted(true);\n }, []);\n var mergedOpen = mounted ? open : false;\n\n // ============================ Focus =============================\n var popupRef = React.useRef();\n var lastActiveRef = React.useRef();\n useLayoutEffect(function () {\n if (mergedOpen) {\n lastActiveRef.current = document.activeElement;\n }\n }, [mergedOpen]);\n\n // ============================= Open =============================\n var internalAfterOpenChange = function internalAfterOpenChange(nextVisible) {\n var _popupRef$current;\n setAnimatedVisible(nextVisible);\n afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(nextVisible);\n if (!nextVisible && lastActiveRef.current && !((_popupRef$current = popupRef.current) !== null && _popupRef$current !== void 0 && _popupRef$current.contains(lastActiveRef.current))) {\n var _lastActiveRef$curren;\n (_lastActiveRef$curren = lastActiveRef.current) === null || _lastActiveRef$curren === void 0 || _lastActiveRef$curren.focus({\n preventScroll: true\n });\n }\n };\n\n // =========================== Context ============================\n var refContext = React.useMemo(function () {\n return {\n panel: panelRef\n };\n }, [panelRef]);\n\n // ============================ Render ============================\n if (!forceRender && !animatedVisible && !mergedOpen && destroyOnClose) {\n return null;\n }\n var eventHandlers = {\n onMouseEnter: onMouseEnter,\n onMouseOver: onMouseOver,\n onMouseLeave: onMouseLeave,\n onClick: onClick,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n };\n var drawerPopupProps = _objectSpread(_objectSpread({}, props), {}, {\n open: mergedOpen,\n prefixCls: prefixCls,\n placement: placement,\n autoFocus: autoFocus,\n keyboard: keyboard,\n width: width,\n mask: mask,\n maskClosable: maskClosable,\n inline: getContainer === false,\n afterOpenChange: internalAfterOpenChange,\n ref: popupRef\n }, eventHandlers);\n return /*#__PURE__*/React.createElement(RefContext.Provider, {\n value: refContext\n }, /*#__PURE__*/React.createElement(Portal, {\n open: mergedOpen || forceRender || animatedVisible,\n autoDestroy: false,\n getContainer: getContainer,\n autoLock: mask && (mergedOpen || animatedVisible)\n }, /*#__PURE__*/React.createElement(DrawerPopup, drawerPopupProps)));\n};\nif (process.env.NODE_ENV !== 'production') {\n Drawer.displayName = 'Drawer';\n}\nexport default Drawer;","map":{"version":3,"names":["_objectSpread","_slicedToArray","Portal","useLayoutEffect","React","RefContext","DrawerPopup","warnCheck","Drawer","props","_props$open","open","_props$prefixCls","prefixCls","_props$placement","placement","_props$autoFocus","autoFocus","_props$keyboard","keyboard","_props$width","width","_props$mask","mask","_props$maskClosable","maskClosable","getContainer","forceRender","afterOpenChange","destroyOnClose","onMouseEnter","onMouseOver","onMouseLeave","onClick","onKeyDown","onKeyUp","panelRef","_React$useState","useState","_React$useState2","animatedVisible","setAnimatedVisible","process","env","NODE_ENV","_React$useState3","_React$useState4","mounted","setMounted","mergedOpen","popupRef","useRef","lastActiveRef","current","document","activeElement","internalAfterOpenChange","nextVisible","_popupRef$current","contains","_lastActiveRef$curren","focus","preventScroll","refContext","useMemo","panel","eventHandlers","drawerPopupProps","inline","ref","createElement","Provider","value","autoDestroy","autoLock","displayName"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-drawer/es/Drawer.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport Portal from '@rc-component/portal';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nimport { RefContext } from \"./context\";\nimport DrawerPopup from \"./DrawerPopup\";\nimport { warnCheck } from \"./util\";\nvar Drawer = function Drawer(props) {\n var _props$open = props.open,\n open = _props$open === void 0 ? false : _props$open,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-drawer' : _props$prefixCls,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'right' : _props$placement,\n _props$autoFocus = props.autoFocus,\n autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,\n _props$keyboard = props.keyboard,\n keyboard = _props$keyboard === void 0 ? true : _props$keyboard,\n _props$width = props.width,\n width = _props$width === void 0 ? 378 : _props$width,\n _props$mask = props.mask,\n mask = _props$mask === void 0 ? true : _props$mask,\n _props$maskClosable = props.maskClosable,\n maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable,\n getContainer = props.getContainer,\n forceRender = props.forceRender,\n afterOpenChange = props.afterOpenChange,\n destroyOnClose = props.destroyOnClose,\n onMouseEnter = props.onMouseEnter,\n onMouseOver = props.onMouseOver,\n onMouseLeave = props.onMouseLeave,\n onClick = props.onClick,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n panelRef = props.panelRef;\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n animatedVisible = _React$useState2[0],\n setAnimatedVisible = _React$useState2[1];\n\n // ============================= Warn =============================\n if (process.env.NODE_ENV !== 'production') {\n warnCheck(props);\n }\n\n // ============================= Open =============================\n var _React$useState3 = React.useState(false),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n mounted = _React$useState4[0],\n setMounted = _React$useState4[1];\n useLayoutEffect(function () {\n setMounted(true);\n }, []);\n var mergedOpen = mounted ? open : false;\n\n // ============================ Focus =============================\n var popupRef = React.useRef();\n var lastActiveRef = React.useRef();\n useLayoutEffect(function () {\n if (mergedOpen) {\n lastActiveRef.current = document.activeElement;\n }\n }, [mergedOpen]);\n\n // ============================= Open =============================\n var internalAfterOpenChange = function internalAfterOpenChange(nextVisible) {\n var _popupRef$current;\n setAnimatedVisible(nextVisible);\n afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(nextVisible);\n if (!nextVisible && lastActiveRef.current && !((_popupRef$current = popupRef.current) !== null && _popupRef$current !== void 0 && _popupRef$current.contains(lastActiveRef.current))) {\n var _lastActiveRef$curren;\n (_lastActiveRef$curren = lastActiveRef.current) === null || _lastActiveRef$curren === void 0 || _lastActiveRef$curren.focus({\n preventScroll: true\n });\n }\n };\n\n // =========================== Context ============================\n var refContext = React.useMemo(function () {\n return {\n panel: panelRef\n };\n }, [panelRef]);\n\n // ============================ Render ============================\n if (!forceRender && !animatedVisible && !mergedOpen && destroyOnClose) {\n return null;\n }\n var eventHandlers = {\n onMouseEnter: onMouseEnter,\n onMouseOver: onMouseOver,\n onMouseLeave: onMouseLeave,\n onClick: onClick,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n };\n var drawerPopupProps = _objectSpread(_objectSpread({}, props), {}, {\n open: mergedOpen,\n prefixCls: prefixCls,\n placement: placement,\n autoFocus: autoFocus,\n keyboard: keyboard,\n width: width,\n mask: mask,\n maskClosable: maskClosable,\n inline: getContainer === false,\n afterOpenChange: internalAfterOpenChange,\n ref: popupRef\n }, eventHandlers);\n return /*#__PURE__*/React.createElement(RefContext.Provider, {\n value: refContext\n }, /*#__PURE__*/React.createElement(Portal, {\n open: mergedOpen || forceRender || animatedVisible,\n autoDestroy: false,\n getContainer: getContainer,\n autoLock: mask && (mergedOpen || animatedVisible)\n }, /*#__PURE__*/React.createElement(DrawerPopup, drawerPopupProps)));\n};\nif (process.env.NODE_ENV !== 'production') {\n Drawer.displayName = 'Drawer';\n}\nexport default Drawer;"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,cAAc,MAAM,0CAA0C;AACrE,OAAOC,MAAM,MAAM,sBAAsB;AACzC,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,QAAQ,WAAW;AACtC,OAAOC,WAAW,MAAM,eAAe;AACvC,SAASC,SAAS,QAAQ,QAAQ;AAClC,IAAIC,MAAM,GAAG,SAASA,MAAMA,CAACC,KAAK,EAAE;EAClC,IAAIC,WAAW,GAAGD,KAAK,CAACE,IAAI;IAC1BA,IAAI,GAAGD,WAAW,KAAK,KAAK,CAAC,GAAG,KAAK,GAAGA,WAAW;IACnDE,gBAAgB,GAAGH,KAAK,CAACI,SAAS;IAClCA,SAAS,GAAGD,gBAAgB,KAAK,KAAK,CAAC,GAAG,WAAW,GAAGA,gBAAgB;IACxEE,gBAA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