1a5d5c81020e44816ebd58e6dc639481.json
6.71 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport Portal from \"rc-util/es/PortalWrapper\";\nimport Dialog from './Dialog'; // fix issue #10656\n\n/*\n * getContainer remarks\n * Custom container should not be return, because in the Portal component, it will remove the\n * return container element here, if the custom container is the only child of it's component,\n * like issue #10656, It will has a conflict with removeChild method in react-dom.\n * So here should add a child (div element) to custom container.\n * */\n\nvar DialogWrap = function DialogWrap(props) {\n var visible = props.visible,\n getContainer = props.getContainer,\n forceRender = props.forceRender,\n _props$destroyOnClose = props.destroyOnClose,\n destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose,\n _afterClose = props.afterClose;\n\n var _React$useState = React.useState(visible),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n animatedVisible = _React$useState2[0],\n setAnimatedVisible = _React$useState2[1];\n\n React.useEffect(function () {\n if (visible) {\n setAnimatedVisible(true);\n }\n }, [visible]); // 渲染在当前 dom 里;\n\n if (getContainer === false) {\n return /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {\n getOpenCount: function getOpenCount() {\n return 2;\n } // 不对 body 做任何操作。。\n\n }));\n } // Destroy on close will remove wrapped div\n\n\n if (!forceRender && destroyOnClose && !animatedVisible) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(Portal, {\n visible: visible,\n forceRender: forceRender,\n getContainer: getContainer\n }, function (childProps) {\n return /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {\n destroyOnClose: destroyOnClose,\n afterClose: function afterClose() {\n _afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();\n setAnimatedVisible(false);\n }\n }, childProps));\n });\n};\n\nDialogWrap.displayName = 'Dialog';\nexport default DialogWrap;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-dialog/es/DialogWrap.js"],"names":["_extends","_slicedToArray","React","Portal","Dialog","DialogWrap","props","visible","getContainer","forceRender","_props$destroyOnClose","destroyOnClose","_afterClose","afterClose","_React$useState","useState","_React$useState2","animatedVisible","setAnimatedVisible","useEffect","createElement","getOpenCount","childProps","displayName"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,oCAArB;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB,C,CAA+B;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,UAAU,GAAG,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AAC1C,MAAIC,OAAO,GAAGD,KAAK,CAACC,OAApB;AAAA,MACIC,YAAY,GAAGF,KAAK,CAACE,YADzB;AAAA,MAEIC,WAAW,GAAGH,KAAK,CAACG,WAFxB;AAAA,MAGIC,qBAAqB,GAAGJ,KAAK,CAACK,cAHlC;AAAA,MAIIA,cAAc,GAAGD,qBAAqB,KAAK,KAAK,CAA/B,GAAmC,KAAnC,GAA2CA,qBAJhE;AAAA,MAKIE,WAAW,GAAGN,KAAK,CAACO,UALxB;;AAOA,MAAIC,eAAe,GAAGZ,KAAK,CAACa,QAAN,CAAeR,OAAf,CAAtB;AAAA,MACIS,gBAAgB,GAAGf,cAAc,CAACa,eAAD,EAAkB,CAAlB,CADrC;AAAA,MAEIG,eAAe,GAAGD,gBAAgB,CAAC,CAAD,CAFtC;AAAA,MAGIE,kBAAkB,GAAGF,gBAAgB,CAAC,CAAD,CAHzC;;AAKAd,EAAAA,KAAK,CAACiB,SAAN,CAAgB,YAAY;AAC1B,QAAIZ,OAAJ,EAAa;AACXW,MAAAA,kBAAkB,CAAC,IAAD,CAAlB;AACD;AACF,GAJD,EAIG,CAACX,OAAD,CAJH,EAb0C,CAiB3B;;AAEf,MAAIC,YAAY,KAAK,KAArB,EAA4B;AAC1B,WAAO,aAAaN,KAAK,CAACkB,aAAN,CAAoBhB,MAApB,EAA4BJ,QAAQ,CAAC,EAAD,EAAKM,KAAL,EAAY;AAClEe,MAAAA,YAAY,EAAE,SAASA,YAAT,GAAwB;AACpC,eAAO,CAAP;AACD,OAHiE,CAGhE;;AAHgE,KAAZ,CAApC,CAApB;AAMD,GA1ByC,CA0BxC;;;AAGF,MAAI,CAACZ,WAAD,IAAgBE,cAAhB,IAAkC,CAACM,eAAvC,EAAwD;AACtD,WAAO,IAAP;AACD;;AAED,SAAO,aAAaf,KAAK,CAACkB,aAAN,CAAoBjB,MAApB,EAA4B;AAC9CI,IAAAA,OAAO,EAAEA,OADqC;AAE9CE,IAAAA,WAAW,EAAEA,WAFiC;AAG9CD,IAAAA,YAAY,EAAEA;AAHgC,GAA5B,EAIjB,UAAUc,UAAV,EAAsB;AACvB,WAAO,aAAapB,KAAK,CAACkB,aAAN,CAAoBhB,MAApB,EAA4BJ,QAAQ,CAAC,EAAD,EAAKM,KAAL,EAAY;AAClEK,MAAAA,cAAc,EAAEA,cADkD;AAElEE,MAAAA,UAAU,EAAE,SAASA,UAAT,GAAsB;AAChCD,QAAAA,WAAW,KAAK,IAAhB,IAAwBA,WAAW,KAAK,KAAK,CAA7C,GAAiD,KAAK,CAAtD,GAA0DA,WAAW,EAArE;AACAM,QAAAA,kBAAkB,CAAC,KAAD,CAAlB;AACD;AALiE,KAAZ,EAMrDI,UANqD,CAApC,CAApB;AAOD,GAZmB,CAApB;AAaD,CA9CD;;AAgDAjB,UAAU,CAACkB,WAAX,GAAyB,QAAzB;AACA,eAAelB,UAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport Portal from \"rc-util/es/PortalWrapper\";\nimport Dialog from './Dialog'; // fix issue #10656\n\n/*\n * getContainer remarks\n * Custom container should not be return, because in the Portal component, it will remove the\n * return container element here, if the custom container is the only child of it's component,\n * like issue #10656, It will has a conflict with removeChild method in react-dom.\n * So here should add a child (div element) to custom container.\n * */\n\nvar DialogWrap = function DialogWrap(props) {\n var visible = props.visible,\n getContainer = props.getContainer,\n forceRender = props.forceRender,\n _props$destroyOnClose = props.destroyOnClose,\n destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose,\n _afterClose = props.afterClose;\n\n var _React$useState = React.useState(visible),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n animatedVisible = _React$useState2[0],\n setAnimatedVisible = _React$useState2[1];\n\n React.useEffect(function () {\n if (visible) {\n setAnimatedVisible(true);\n }\n }, [visible]); // 渲染在当前 dom 里;\n\n if (getContainer === false) {\n return /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {\n getOpenCount: function getOpenCount() {\n return 2;\n } // 不对 body 做任何操作。。\n\n }));\n } // Destroy on close will remove wrapped div\n\n\n if (!forceRender && destroyOnClose && !animatedVisible) {\n return null;\n }\n\n return /*#__PURE__*/React.createElement(Portal, {\n visible: visible,\n forceRender: forceRender,\n getContainer: getContainer\n }, function (childProps) {\n return /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {\n destroyOnClose: destroyOnClose,\n afterClose: function afterClose() {\n _afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();\n setAnimatedVisible(false);\n }\n }, childProps));\n });\n};\n\nDialogWrap.displayName = 'Dialog';\nexport default DialogWrap;"]},"metadata":{},"sourceType":"module"}