551e046d07a9e4ef6614de5a069dc7cd.json 19.8 KB
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { useRef, useState } from 'react';\nimport Align from 'rc-align';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport useVisibleStatus from './useVisibleStatus';\nimport { getMotion } from '../utils/legacyUtil';\nimport useStretchStyle from './useStretchStyle';\nvar PopupInner = React.forwardRef(function (props, ref) {\n  var visible = props.visible,\n      prefixCls = props.prefixCls,\n      className = props.className,\n      style = props.style,\n      children = props.children,\n      zIndex = props.zIndex,\n      stretch = props.stretch,\n      destroyPopupOnHide = props.destroyPopupOnHide,\n      align = props.align,\n      point = props.point,\n      getRootDomNode = props.getRootDomNode,\n      getClassNameFromAlign = props.getClassNameFromAlign,\n      onAlign = props.onAlign,\n      onMouseEnter = props.onMouseEnter,\n      onMouseLeave = props.onMouseLeave,\n      onMouseDown = props.onMouseDown,\n      onTouchStart = props.onTouchStart;\n  var alignRef = useRef();\n  var elementRef = useRef();\n\n  var _useState = useState(),\n      _useState2 = _slicedToArray(_useState, 2),\n      alignedClassName = _useState2[0],\n      setAlignedClassName = _useState2[1]; // ======================= Measure ========================\n\n\n  var _useStretchStyle = useStretchStyle(stretch),\n      _useStretchStyle2 = _slicedToArray(_useStretchStyle, 2),\n      stretchStyle = _useStretchStyle2[0],\n      measureStretchStyle = _useStretchStyle2[1];\n\n  function doMeasure() {\n    if (stretch) {\n      measureStretchStyle(getRootDomNode());\n    }\n  } // ======================== Status ========================\n\n\n  var _useVisibleStatus = useVisibleStatus(visible, doMeasure),\n      _useVisibleStatus2 = _slicedToArray(_useVisibleStatus, 2),\n      status = _useVisibleStatus2[0],\n      goNextStatus = _useVisibleStatus2[1]; // ======================== Aligns ========================\n\n\n  var prepareResolveRef = useRef(); // `target` on `rc-align` can accept as a function to get the bind element or a point.\n  // ref: https://www.npmjs.com/package/rc-align\n\n  function getAlignTarget() {\n    if (point) {\n      return point;\n    }\n\n    return getRootDomNode;\n  }\n\n  function forceAlign() {\n    var _alignRef$current;\n\n    (_alignRef$current = alignRef.current) === null || _alignRef$current === void 0 ? void 0 : _alignRef$current.forceAlign();\n  }\n\n  function onInternalAlign(popupDomNode, matchAlign) {\n    if (status === 'align') {\n      var nextAlignedClassName = getClassNameFromAlign(matchAlign);\n      setAlignedClassName(nextAlignedClassName); // Repeat until not more align needed\n\n      if (alignedClassName !== nextAlignedClassName) {\n        Promise.resolve().then(function () {\n          forceAlign();\n        });\n      } else {\n        goNextStatus(function () {\n          var _prepareResolveRef$cu;\n\n          (_prepareResolveRef$cu = prepareResolveRef.current) === null || _prepareResolveRef$cu === void 0 ? void 0 : _prepareResolveRef$cu.call(prepareResolveRef);\n        });\n      }\n\n      onAlign === null || onAlign === void 0 ? void 0 : onAlign(popupDomNode, matchAlign);\n    }\n  } // ======================== Motion ========================\n\n\n  var motion = _objectSpread({}, getMotion(props));\n\n  ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd'].forEach(function (eventName) {\n    var originHandler = motion[eventName];\n\n    motion[eventName] = function (element, event) {\n      goNextStatus();\n      return originHandler === null || originHandler === void 0 ? void 0 : originHandler(element, event);\n    };\n  });\n\n  function onShowPrepare() {\n    return new Promise(function (resolve) {\n      prepareResolveRef.current = resolve;\n    });\n  } // Go to stable directly when motion not provided\n\n\n  React.useEffect(function () {\n    if (!motion.motionName && status === 'motion') {\n      goNextStatus();\n    }\n  }, [motion.motionName, status]); // ========================= Refs =========================\n\n  React.useImperativeHandle(ref, function () {\n    return {\n      forceAlign: forceAlign,\n      getElement: function getElement() {\n        return elementRef.current;\n      }\n    };\n  }); // ======================== Render ========================\n\n  var mergedStyle = _objectSpread(_objectSpread(_objectSpread({}, stretchStyle), {}, {\n    zIndex: zIndex\n  }, style), {}, {\n    opacity: status === 'motion' || status === 'stable' || !visible ? undefined : 0,\n    pointerEvents: status === 'stable' ? undefined : 'none'\n  }); // Align status\n\n\n  var alignDisabled = true;\n\n  if ((align === null || align === void 0 ? void 0 : align.points) && (status === 'align' || status === 'stable')) {\n    alignDisabled = false;\n  }\n\n  var childNode = children; // Wrapper when multiple children\n\n  if (React.Children.count(children) > 1) {\n    childNode = React.createElement(\"div\", {\n      className: \"\".concat(prefixCls, \"-content\")\n    }, children);\n  }\n\n  return React.createElement(CSSMotion, Object.assign({\n    visible: visible,\n    ref: elementRef,\n    leavedClassName: \"\".concat(prefixCls, \"-hidden\")\n  }, motion, {\n    onAppearPrepare: onShowPrepare,\n    onEnterPrepare: onShowPrepare,\n    removeOnLeave: destroyPopupOnHide\n  }), function (_ref, motionRef) {\n    var motionClassName = _ref.className,\n        motionStyle = _ref.style;\n    var mergedClassName = classNames(prefixCls, className, alignedClassName, motionClassName);\n    return React.createElement(Align, {\n      target: getAlignTarget(),\n      key: \"popup\",\n      ref: alignRef,\n      monitorWindowResize: true,\n      disabled: alignDisabled,\n      align: align,\n      onAlign: onInternalAlign\n    }, React.createElement(\"div\", {\n      ref: motionRef,\n      className: mergedClassName,\n      onMouseEnter: onMouseEnter,\n      onMouseLeave: onMouseLeave,\n      onMouseDown: onMouseDown,\n      onTouchStart: onTouchStart,\n      style: _objectSpread(_objectSpread({}, motionStyle), mergedStyle)\n    }, childNode));\n  });\n});\nPopupInner.displayName = 'PopupInner';\nexport default PopupInner;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-trigger/es/Popup/PopupInner.js"],"names":["_objectSpread","_slicedToArray","React","useRef","useState","Align","CSSMotion","classNames","useVisibleStatus","getMotion","useStretchStyle","PopupInner","forwardRef","props","ref","visible","prefixCls","className","style","children","zIndex","stretch","destroyPopupOnHide","align","point","getRootDomNode","getClassNameFromAlign","onAlign","onMouseEnter","onMouseLeave","onMouseDown","onTouchStart","alignRef","elementRef","_useState","_useState2","alignedClassName","setAlignedClassName","_useStretchStyle","_useStretchStyle2","stretchStyle","measureStretchStyle","doMeasure","_useVisibleStatus","_useVisibleStatus2","status","goNextStatus","prepareResolveRef","getAlignTarget","forceAlign","_alignRef$current","current","onInternalAlign","popupDomNode","matchAlign","nextAlignedClassName","Promise","resolve","then","_prepareResolveRef$cu","call","motion","forEach","eventName","originHandler","element","event","onShowPrepare","useEffect","motionName","useImperativeHandle","getElement","mergedStyle","opacity","undefined","pointerEvents","alignDisabled","points","childNode","Children","count","createElement","concat","Object","assign","leavedClassName","onAppearPrepare","onEnterPrepare","removeOnLeave","_ref","motionRef","motionClassName","motionStyle","mergedClassName","target","key","monitorWindowResize","disabled","displayName"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,0CAA1B;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,OAAjC;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,IAAIC,UAAU,GAAGT,KAAK,CAACU,UAAN,CAAiB,UAAUC,KAAV,EAAiBC,GAAjB,EAAsB;AACtD,MAAIC,OAAO,GAAGF,KAAK,CAACE,OAApB;AAAA,MACIC,SAAS,GAAGH,KAAK,CAACG,SADtB;AAAA,MAEIC,SAAS,GAAGJ,KAAK,CAACI,SAFtB;AAAA,MAGIC,KAAK,GAAGL,KAAK,CAACK,KAHlB;AAAA,MAIIC,QAAQ,GAAGN,KAAK,CAACM,QAJrB;AAAA,MAKIC,MAAM,GAAGP,KAAK,CAACO,MALnB;AAAA,MAMIC,OAAO,GAAGR,KAAK,CAACQ,OANpB;AAAA,MAOIC,kBAAkB,GAAGT,KAAK,CAACS,kBAP/B;AAAA,MAQIC,KAAK,GAAGV,KAAK,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time/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { useRef, useState } from 'react';\nimport Align from 'rc-align';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport useVisibleStatus from './useVisibleStatus';\nimport { getMotion } from '../utils/legacyUtil';\nimport useStretchStyle from './useStretchStyle';\nvar PopupInner = React.forwardRef(function (props, ref) {\n  var visible = props.visible,\n      prefixCls = props.prefixCls,\n      className = props.className,\n      style = props.style,\n      children = props.children,\n      zIndex = props.zIndex,\n      stretch = props.stretch,\n      destroyPopupOnHide = props.destroyPopupOnHide,\n      align = props.align,\n      point = props.point,\n      getRootDomNode = props.getRootDomNode,\n      getClassNameFromAlign = props.getClassNameFromAlign,\n      onAlign = props.onAlign,\n      onMouseEnter = props.onMouseEnter,\n      onMouseLeave = props.onMouseLeave,\n      onMouseDown = props.onMouseDown,\n      onTouchStart = props.onTouchStart;\n  var alignRef = useRef();\n  var elementRef = useRef();\n\n  var _useState = useState(),\n      _useState2 = _slicedToArray(_useState, 2),\n      alignedClassName = _useState2[0],\n      setAlignedClassName = _useState2[1]; // ======================= Measure ========================\n\n\n  var _useStretchStyle = useStretchStyle(stretch),\n      _useStretchStyle2 = _slicedToArray(_useStretchStyle, 2),\n      stretchStyle = _useStretchStyle2[0],\n      measureStretchStyle = _useStretchStyle2[1];\n\n  function doMeasure() {\n    if (stretch) {\n      measureStretchStyle(getRootDomNode());\n    }\n  } // ======================== Status ========================\n\n\n  var _useVisibleStatus = useVisibleStatus(visible, doMeasure),\n      _useVisibleStatus2 = _slicedToArray(_useVisibleStatus, 2),\n      status = _useVisibleStatus2[0],\n      goNextStatus = _useVisibleStatus2[1]; // ======================== Aligns ========================\n\n\n  var prepareResolveRef = useRef(); // `target` on `rc-align` can accept as a function to get the bind element or a point.\n  // ref: https://www.npmjs.com/package/rc-align\n\n  function getAlignTarget() {\n    if (point) {\n      return point;\n    }\n\n    return getRootDomNode;\n  }\n\n  function forceAlign() {\n    var _alignRef$current;\n\n    (_alignRef$current = alignRef.current) === null || _alignRef$current === void 0 ? void 0 : _alignRef$current.forceAlign();\n  }\n\n  function onInternalAlign(popupDomNode, matchAlign) {\n    if (status === 'align') {\n      var nextAlignedClassName = getClassNameFromAlign(matchAlign);\n      setAlignedClassName(nextAlignedClassName); // Repeat until not more align needed\n\n      if (alignedClassName !== nextAlignedClassName) {\n        Promise.resolve().then(function () {\n          forceAlign();\n        });\n      } else {\n        goNextStatus(function () {\n          var _prepareResolveRef$cu;\n\n          (_prepareResolveRef$cu = prepareResolveRef.current) === null || _prepareResolveRef$cu === void 0 ? void 0 : _prepareResolveRef$cu.call(prepareResolveRef);\n        });\n      }\n\n      onAlign === null || onAlign === void 0 ? void 0 : onAlign(popupDomNode, matchAlign);\n    }\n  } // ======================== Motion ========================\n\n\n  var motion = _objectSpread({}, getMotion(props));\n\n  ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd'].forEach(function (eventName) {\n    var originHandler = motion[eventName];\n\n    motion[eventName] = function (element, event) {\n      goNextStatus();\n      return originHandler === null || originHandler === void 0 ? void 0 : originHandler(element, event);\n    };\n  });\n\n  function onShowPrepare() {\n    return new Promise(function (resolve) {\n      prepareResolveRef.current = resolve;\n    });\n  } // Go to stable directly when motion not provided\n\n\n  React.useEffect(function () {\n    if (!motion.motionName && status === 'motion') {\n      goNextStatus();\n    }\n  }, [motion.motionName, status]); // ========================= Refs =========================\n\n  React.useImperativeHandle(ref, function () {\n    return {\n      forceAlign: forceAlign,\n      getElement: function getElement() {\n        return elementRef.current;\n      }\n    };\n  }); // ======================== Render ========================\n\n  var mergedStyle = _objectSpread(_objectSpread(_objectSpread({}, stretchStyle), {}, {\n    zIndex: zIndex\n  }, style), {}, {\n    opacity: status === 'motion' || status === 'stable' || !visible ? undefined : 0,\n    pointerEvents: status === 'stable' ? undefined : 'none'\n  }); // Align status\n\n\n  var alignDisabled = true;\n\n  if ((align === null || align === void 0 ? void 0 : align.points) && (status === 'align' || status === 'stable')) {\n    alignDisabled = false;\n  }\n\n  var childNode = children; // Wrapper when multiple children\n\n  if (React.Children.count(children) > 1) {\n    childNode = React.createElement(\"div\", {\n      className: \"\".concat(prefixCls, \"-content\")\n    }, children);\n  }\n\n  return React.createElement(CSSMotion, Object.assign({\n    visible: visible,\n    ref: elementRef,\n    leavedClassName: \"\".concat(prefixCls, \"-hidden\")\n  }, motion, {\n    onAppearPrepare: onShowPrepare,\n    onEnterPrepare: onShowPrepare,\n    removeOnLeave: destroyPopupOnHide\n  }), function (_ref, motionRef) {\n    var motionClassName = _ref.className,\n        motionStyle = _ref.style;\n    var mergedClassName = classNames(prefixCls, className, alignedClassName, motionClassName);\n    return React.createElement(Align, {\n      target: getAlignTarget(),\n      key: \"popup\",\n      ref: alignRef,\n      monitorWindowResize: true,\n      disabled: alignDisabled,\n      align: align,\n      onAlign: onInternalAlign\n    }, React.createElement(\"div\", {\n      ref: motionRef,\n      className: mergedClassName,\n      onMouseEnter: onMouseEnter,\n      onMouseLeave: onMouseLeave,\n      onMouseDown: onMouseDown,\n      onTouchStart: onTouchStart,\n      style: _objectSpread(_objectSpread({}, motionStyle), mergedStyle)\n    }, childNode));\n  });\n});\nPopupInner.displayName = 'PopupInner';\nexport default PopupInner;"]},"metadata":{},"sourceType":"module"}