b495c66c689ebca843efe489b6ccdc8f.json 14 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport Trigger from 'rc-trigger';\nimport classNames from 'classnames';\n\nvar getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {\n  // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided\n  var adjustX = typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1;\n  return {\n    bottomLeft: {\n      points: ['tl', 'bl'],\n      offset: [0, 4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    bottomRight: {\n      points: ['tr', 'br'],\n      offset: [0, 4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    topLeft: {\n      points: ['bl', 'tl'],\n      offset: [0, -4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    topRight: {\n      points: ['br', 'tr'],\n      offset: [0, -4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    }\n  };\n};\n\nvar SelectTrigger = function SelectTrigger(props, ref) {\n  var prefixCls = props.prefixCls,\n      disabled = props.disabled,\n      visible = props.visible,\n      children = props.children,\n      popupElement = props.popupElement,\n      containerWidth = props.containerWidth,\n      animation = props.animation,\n      transitionName = props.transitionName,\n      dropdownStyle = props.dropdownStyle,\n      dropdownClassName = props.dropdownClassName,\n      _props$direction = props.direction,\n      direction = _props$direction === void 0 ? 'ltr' : _props$direction,\n      _props$dropdownMatchS = props.dropdownMatchSelectWidth,\n      dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,\n      dropdownRender = props.dropdownRender,\n      dropdownAlign = props.dropdownAlign,\n      getPopupContainer = props.getPopupContainer,\n      empty = props.empty,\n      getTriggerDOMNode = props.getTriggerDOMNode,\n      restProps = _objectWithoutProperties(props, [\"prefixCls\", \"disabled\", \"visible\", \"children\", \"popupElement\", \"containerWidth\", \"animation\", \"transitionName\", \"dropdownStyle\", \"dropdownClassName\", \"direction\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"getPopupContainer\", \"empty\", \"getTriggerDOMNode\"]);\n\n  var dropdownPrefixCls = \"\".concat(prefixCls, \"-dropdown\");\n  var popupNode = popupElement;\n\n  if (dropdownRender) {\n    popupNode = dropdownRender(popupElement);\n  }\n\n  var builtInPlacements = React.useMemo(function () {\n    return getBuiltInPlacements(dropdownMatchSelectWidth);\n  }, [dropdownMatchSelectWidth]); // ===================== Motion ======================\n\n  var mergedTransitionName = animation ? \"\".concat(dropdownPrefixCls, \"-\").concat(animation) : transitionName; // ======================= Ref =======================\n\n  var popupRef = React.useRef(null);\n  React.useImperativeHandle(ref, function () {\n    return {\n      getPopupElement: function getPopupElement() {\n        return popupRef.current;\n      }\n    };\n  });\n\n  var popupStyle = _objectSpread({\n    minWidth: containerWidth\n  }, dropdownStyle);\n\n  if (typeof dropdownMatchSelectWidth === 'number') {\n    popupStyle.width = dropdownMatchSelectWidth;\n  } else if (dropdownMatchSelectWidth) {\n    popupStyle.width = containerWidth;\n  }\n\n  return React.createElement(Trigger, Object.assign({}, restProps, {\n    showAction: [],\n    hideAction: [],\n    popupPlacement: direction === 'rtl' ? 'bottomRight' : 'bottomLeft',\n    builtinPlacements: builtInPlacements,\n    prefixCls: dropdownPrefixCls,\n    popupTransitionName: mergedTransitionName,\n    popup: React.createElement(\"div\", {\n      ref: popupRef\n    }, popupNode),\n    popupAlign: dropdownAlign,\n    popupVisible: visible,\n    getPopupContainer: getPopupContainer,\n    popupClassName: classNames(dropdownClassName, _defineProperty({}, \"\".concat(dropdownPrefixCls, \"-empty\"), empty)),\n    popupStyle: popupStyle,\n    getTriggerDOMNode: getTriggerDOMNode\n  }), children);\n};\n\nvar RefSelectTrigger = React.forwardRef(SelectTrigger);\nRefSelectTrigger.displayName = 'SelectTrigger';\nexport default RefSelectTrigger;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-select/es/SelectTrigger.js"],"names":["_defineProperty","_objectSpread","_objectWithoutProperties","React","Trigger","classNames","getBuiltInPlacements","dropdownMatchSelectWidth","adjustX","bottomLeft","points","offset","overflow","adjustY","bottomRight","topLeft","topRight","SelectTrigger","props","ref","prefixCls","disabled","visible","children","popupElement","containerWidth","animation","transitionName","dropdownStyle","dropdownClassName","_props$direction","direction","_props$dropdownMatchS","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","restProps","dropdownPrefixCls","concat","popupNode","builtInPlacements","useMemo","mergedTransitionName","popupRef","useRef","useImperativeHandle","getPopupElement","current","popupStyle","minWidth","width","createElement","Object","assign","showAction","hideAction","popupPlacement","builtinPlacements","popupTransitionName","popup","popupAlign","popupVisible","popupClassName","RefSelectTrigger","forwardRef","displayName"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAEA,IAAIC,oBAAoB,GAAG,SAASA,oBAAT,CAA8BC,wBAA9B,EAAwD;AACjF;AACA,MAAIC,OAAO,GAAG,OAAOD,wBAAP,KAAoC,QAApC,GAA+C,CAA/C,GAAmD,CAAjE;AACA,SAAO;AACLE,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,CAAC,IAAD,EAAO,IAAP,CADE;AAEVC,MAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,CAAJ,CAFE;AAGVC,MAAAA,QAAQ,EAAE;AACRJ,QAAAA,OAAO,EAAEA,OADD;AAERK,QAAAA,OAAO,EAAE;AAFD;AAHA,KADP;AASL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AAA,GAAG,EAAE0B;AAD2B,KAA3B,EAEJJ,SAFI,CAPwD;AAU/DqB,IAAAA,UAAU,EAAE5B,aAVmD;AAW/D6B,IAAAA,YAAY,EAAEzC,OAXiD;AAY/Da,IAAAA,iBAAiB,EAAEA,iBAZ4C;AAa/D6B,IAAAA,cAAc,EAAE3D,UAAU,CAACwB,iBAAD,EAAoB7B,eAAe,CAAC,EAAD,EAAK,GAAGwC,MAAH,CAAUD,iBAAV,EAA6B,QAA7B,CAAL,EAA6CH,KAA7C,CAAnC,CAbqC;AAc/Dc,IAAAA,UAAU,EAAEA,UAdmD;AAe/Db,IAAAA,iBAAiB,EAAEA;AAf4C,GAA7B,CAA7B,EAgBHd,QAhBG,CAAP;AAiBD,CAvED;;AAyEA,IAAI0C,gBAAgB,GAAG9D,KAAK,CAAC+D,UAAN,CAAiBjD,aAAjB,CAAvB;AACAgD,gBAAgB,CAACE,WAAjB,GAA+B,eAA/B;AACA,eAAeF,gBAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport Trigger from 'rc-trigger';\nimport classNames from 'classnames';\n\nvar getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {\n  // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided\n  var adjustX = typeof dropdownMatchSelectWidth !== 'number' ? 0 : 1;\n  return {\n    bottomLeft: {\n      points: ['tl', 'bl'],\n      offset: [0, 4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    bottomRight: {\n      points: ['tr', 'br'],\n      offset: [0, 4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    topLeft: {\n      points: ['bl', 'tl'],\n      offset: [0, -4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    },\n    topRight: {\n      points: ['br', 'tr'],\n      offset: [0, -4],\n      overflow: {\n        adjustX: adjustX,\n        adjustY: 1\n      }\n    }\n  };\n};\n\nvar SelectTrigger = function SelectTrigger(props, ref) {\n  var prefixCls = props.prefixCls,\n      disabled = props.disabled,\n      visible = props.visible,\n      children = props.children,\n      popupElement = props.popupElement,\n      containerWidth = props.containerWidth,\n      animation = props.animation,\n      transitionName = props.transitionName,\n      dropdownStyle = props.dropdownStyle,\n      dropdownClassName = props.dropdownClassName,\n      _props$direction = props.direction,\n      direction = _props$direction === void 0 ? 'ltr' : _props$direction,\n      _props$dropdownMatchS = props.dropdownMatchSelectWidth,\n      dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,\n      dropdownRender = props.dropdownRender,\n      dropdownAlign = props.dropdownAlign,\n      getPopupContainer = props.getPopupContainer,\n      empty = props.empty,\n      getTriggerDOMNode = props.getTriggerDOMNode,\n      restProps = _objectWithoutProperties(props, [\"prefixCls\", \"disabled\", \"visible\", \"children\", \"popupElement\", \"containerWidth\", \"animation\", \"transitionName\", \"dropdownStyle\", \"dropdownClassName\", \"direction\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"getPopupContainer\", \"empty\", \"getTriggerDOMNode\"]);\n\n  var dropdownPrefixCls = \"\".concat(prefixCls, \"-dropdown\");\n  var popupNode = popupElement;\n\n  if (dropdownRender) {\n    popupNode = dropdownRender(popupElement);\n  }\n\n  var builtInPlacements = React.useMemo(function () {\n    return getBuiltInPlacements(dropdownMatchSelectWidth);\n  }, [dropdownMatchSelectWidth]); // ===================== Motion ======================\n\n  var mergedTransitionName = animation ? \"\".concat(dropdownPrefixCls, \"-\").concat(animation) : transitionName; // ======================= Ref =======================\n\n  var popupRef = React.useRef(null);\n  React.useImperativeHandle(ref, function () {\n    return {\n      getPopupElement: function getPopupElement() {\n        return popupRef.current;\n      }\n    };\n  });\n\n  var popupStyle = _objectSpread({\n    minWidth: containerWidth\n  }, dropdownStyle);\n\n  if (typeof dropdownMatchSelectWidth === 'number') {\n    popupStyle.width = dropdownMatchSelectWidth;\n  } else if (dropdownMatchSelectWidth) {\n    popupStyle.width = containerWidth;\n  }\n\n  return React.createElement(Trigger, Object.assign({}, restProps, {\n    showAction: [],\n    hideAction: [],\n    popupPlacement: direction === 'rtl' ? 'bottomRight' : 'bottomLeft',\n    builtinPlacements: builtInPlacements,\n    prefixCls: dropdownPrefixCls,\n    popupTransitionName: mergedTransitionName,\n    popup: React.createElement(\"div\", {\n      ref: popupRef\n    }, popupNode),\n    popupAlign: dropdownAlign,\n    popupVisible: visible,\n    getPopupContainer: getPopupContainer,\n    popupClassName: classNames(dropdownClassName, _defineProperty({}, \"\".concat(dropdownPrefixCls, \"-empty\"), empty)),\n    popupStyle: popupStyle,\n    getTriggerDOMNode: getTriggerDOMNode\n  }), children);\n};\n\nvar RefSelectTrigger = React.forwardRef(SelectTrigger);\nRefSelectTrigger.displayName = 'SelectTrigger';\nexport default RefSelectTrigger;"]},"metadata":{},"sourceType":"module"}