83dc18508031a8ad8c658ac27f8bbb11.json
22.9 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport debounce from 'lodash/debounce';\nimport { ConfigConsumer } from '../config-provider';\nimport { tuple } from '../_util/type';\nimport { isValidElement, cloneElement } from '../_util/reactNode';\nvar SpinSizes = tuple('small', 'default', 'large'); // Render indicator\n\nvar defaultIndicator = null;\n\nfunction renderIndicator(prefixCls, props) {\n var indicator = props.indicator;\n var dotClassName = \"\".concat(prefixCls, \"-dot\"); // should not be render default indicator when indicator value is null\n\n if (indicator === null) {\n return null;\n }\n\n if (isValidElement(indicator)) {\n return cloneElement(indicator, {\n className: classNames(indicator.props.className, dotClassName)\n });\n }\n\n if (isValidElement(defaultIndicator)) {\n return cloneElement(defaultIndicator, {\n className: classNames(defaultIndicator.props.className, dotClassName)\n });\n }\n\n return /*#__PURE__*/React.createElement(\"span\", {\n className: classNames(dotClassName, \"\".concat(prefixCls, \"-dot-spin\"))\n }, /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }));\n}\n\nfunction shouldDelay(spinning, delay) {\n return !!spinning && !!delay && !isNaN(Number(delay));\n}\n\nvar Spin = /*#__PURE__*/function (_React$Component) {\n _inherits(Spin, _React$Component);\n\n var _super = _createSuper(Spin);\n\n function Spin(props) {\n var _this;\n\n _classCallCheck(this, Spin);\n\n _this = _super.call(this, props);\n\n _this.debouncifyUpdateSpinning = function (props) {\n var _ref = props || _this.props,\n delay = _ref.delay;\n\n if (delay) {\n _this.cancelExistingSpin();\n\n _this.updateSpinning = debounce(_this.originalUpdateSpinning, delay);\n }\n };\n\n _this.updateSpinning = function () {\n var spinning = _this.props.spinning;\n var currentSpinning = _this.state.spinning;\n\n if (currentSpinning !== spinning) {\n _this.setState({\n spinning: spinning\n });\n }\n };\n\n _this.renderSpin = function (_ref2) {\n var _classNames;\n\n var getPrefixCls = _ref2.getPrefixCls,\n direction = _ref2.direction;\n\n var _a = _this.props,\n customizePrefixCls = _a.prefixCls,\n className = _a.className,\n size = _a.size,\n tip = _a.tip,\n wrapperClassName = _a.wrapperClassName,\n style = _a.style,\n restProps = __rest(_a, [\"prefixCls\", \"className\", \"size\", \"tip\", \"wrapperClassName\", \"style\"]);\n\n var spinning = _this.state.spinning;\n var prefixCls = getPrefixCls('spin', customizePrefixCls);\n var spinClassName = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-sm\"), size === 'small'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-lg\"), size === 'large'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-spinning\"), spinning), _defineProperty(_classNames, \"\".concat(prefixCls, \"-show-text\"), !!tip), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className); // fix https://fb.me/react-unknown-prop\n\n var divProps = omit(restProps, ['spinning', 'delay', 'indicator']);\n var spinElement = /*#__PURE__*/React.createElement(\"div\", _extends({}, divProps, {\n style: style,\n className: spinClassName\n }), renderIndicator(prefixCls, _this.props), tip ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-text\")\n }, tip) : null);\n\n if (_this.isNestedPattern()) {\n var containerClassName = classNames(\"\".concat(prefixCls, \"-container\"), _defineProperty({}, \"\".concat(prefixCls, \"-blur\"), spinning));\n return /*#__PURE__*/React.createElement(\"div\", _extends({}, divProps, {\n className: classNames(\"\".concat(prefixCls, \"-nested-loading\"), wrapperClassName)\n }), spinning && /*#__PURE__*/React.createElement(\"div\", {\n key: \"loading\"\n }, spinElement), /*#__PURE__*/React.createElement(\"div\", {\n className: containerClassName,\n key: \"container\"\n }, _this.props.children));\n }\n\n return spinElement;\n };\n\n var spinning = props.spinning,\n delay = props.delay;\n var shouldBeDelayed = shouldDelay(spinning, delay);\n _this.state = {\n spinning: spinning && !shouldBeDelayed\n };\n _this.originalUpdateSpinning = _this.updateSpinning;\n\n _this.debouncifyUpdateSpinning(props);\n\n return _this;\n }\n\n _createClass(Spin, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.updateSpinning();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.debouncifyUpdateSpinning();\n this.updateSpinning();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.cancelExistingSpin();\n }\n }, {\n key: \"cancelExistingSpin\",\n value: function cancelExistingSpin() {\n var updateSpinning = this.updateSpinning;\n\n if (updateSpinning && updateSpinning.cancel) {\n updateSpinning.cancel();\n }\n }\n }, {\n key: \"isNestedPattern\",\n value: function isNestedPattern() {\n return !!(this.props && typeof this.props.children !== 'undefined');\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderSpin);\n }\n }], [{\n key: \"setDefaultIndicator\",\n value: function setDefaultIndicator(indicator) {\n defaultIndicator = indicator;\n }\n }]);\n\n return Spin;\n}(React.Component);\n\nSpin.defaultProps = {\n spinning: true,\n size: 'default',\n wrapperClassName: ''\n};\nexport default Spin;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/spin/index.js"],"names":["_extends","_defineProperty","_classCallCheck","_createClass","_inherits","_createSuper","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","omit","debounce","ConfigConsumer","tuple","isValidElement","cloneElement","SpinSizes","defaultIndicator","renderIndicator","prefixCls","props","indicator","dotClassName","concat","className","createElement","shouldDelay","spinning","delay","isNaN","Number","Spin","_React$Component","_super","_this","debouncifyUpdateSpinning","_ref","cancelExistingSpin","updateSpinning","originalUpdateSpinning","currentSpinning","state","setState","renderSpin","_ref2","_classNames","getPrefixCls","direction","_a","customizePrefixCls","size","tip","wrapperClassName","style","restProps","spinClassName","divProps","spinElement","isNestedPattern","containerClassName","key","children","shouldBeDelayed","value","componentDidMount","componentDidUpdate","componentWillUnmount","cancel","render","setDefaultIndicator","Component","defaultProps"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;;AAEA,IAAIC,MAAM,GAAG,QAAQ,KAAKA,MAAb,IAAuB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AAEA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB;AACf,QAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,C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AAA,KAAK,EAAE,SAAS1B,kBAAT,GAA8B;AACnC,UAAIC,cAAc,GAAG,KAAKA,cAA1B;;AAEA,UAAIA,cAAc,IAAIA,cAAc,CAAC6B,MAArC,EAA6C;AAC3C7B,QAAAA,cAAc,CAAC6B,MAAf;AACD;AACF;AARA,GAhBgB,EAyBhB;AACDP,IAAAA,GAAG,EAAE,iBADJ;AAEDG,IAAAA,KAAK,EAAE,SAASL,eAAT,GAA2B;AAChC,aAAO,CAAC,EAAE,KAAKtC,KAAL,IAAc,OAAO,KAAKA,KAAL,CAAWyC,QAAlB,KAA+B,WAA/C,CAAR;AACD;AAJA,GAzBgB,EA8BhB;AACDD,IAAAA,GAAG,EAAE,QADJ;AAEDG,IAAAA,KAAK,EAAE,SAASK,MAAT,GAAkB;AACvB,aAAO,aAAa5D,KAAK,CAACiB,aAAN,CAAoBb,cAApB,EAAoC,IAApC,EAA0C,KAAK+B,UAA/C,CAApB;AACD;AAJA,GA9BgB,CAAP,EAmCR,CAAC;AACHiB,IAAAA,GAAG,EAAE,qBADF;AAEHG,IAAAA,KAAK,EAAE,SAASM,mBAAT,CAA6BhD,SAA7B,EAAwC;AAC7CJ,MAAAA,gBAAgB,GAAGI,SAAnB;AACD;AAJE,GAAD,CAnCQ,CAAZ;;AA0CA,SAAOU,IAAP;AACD,CApIuB,CAoItBvB,KAAK,CAAC8D,SApIgB,CAAxB;;AAsIAvC,IAAI,CAACwC,YAAL,GAAoB;AAClB5C,EAAAA,QAAQ,EAAE,IADQ;AAElBuB,EAAAA,IAAI,EAAE,SAFY;AAGlBE,EAAAA,gBAAgB,EAAE;AAHA,CAApB;AAKA,eAAerB,IAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport debounce from 'lodash/debounce';\nimport { ConfigConsumer } from '../config-provider';\nimport { tuple } from '../_util/type';\nimport { isValidElement, cloneElement } from '../_util/reactNode';\nvar SpinSizes = tuple('small', 'default', 'large'); // Render indicator\n\nvar defaultIndicator = null;\n\nfunction renderIndicator(prefixCls, props) {\n var indicator = props.indicator;\n var dotClassName = \"\".concat(prefixCls, \"-dot\"); // should not be render default indicator when indicator value is null\n\n if (indicator === null) {\n return null;\n }\n\n if (isValidElement(indicator)) {\n return cloneElement(indicator, {\n className: classNames(indicator.props.className, dotClassName)\n });\n }\n\n if (isValidElement(defaultIndicator)) {\n return cloneElement(defaultIndicator, {\n className: classNames(defaultIndicator.props.className, dotClassName)\n });\n }\n\n return /*#__PURE__*/React.createElement(\"span\", {\n className: classNames(dotClassName, \"\".concat(prefixCls, \"-dot-spin\"))\n }, /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }), /*#__PURE__*/React.createElement(\"i\", {\n className: \"\".concat(prefixCls, \"-dot-item\")\n }));\n}\n\nfunction shouldDelay(spinning, delay) {\n return !!spinning && !!delay && !isNaN(Number(delay));\n}\n\nvar Spin = /*#__PURE__*/function (_React$Component) {\n _inherits(Spin, _React$Component);\n\n var _super = _createSuper(Spin);\n\n function Spin(props) {\n var _this;\n\n _classCallCheck(this, Spin);\n\n _this = _super.call(this, props);\n\n _this.debouncifyUpdateSpinning = function (props) {\n var _ref = props || _this.props,\n delay = _ref.delay;\n\n if (delay) {\n _this.cancelExistingSpin();\n\n _this.updateSpinning = debounce(_this.originalUpdateSpinning, delay);\n }\n };\n\n _this.updateSpinning = function () {\n var spinning = _this.props.spinning;\n var currentSpinning = _this.state.spinning;\n\n if (currentSpinning !== spinning) {\n _this.setState({\n spinning: spinning\n });\n }\n };\n\n _this.renderSpin = function (_ref2) {\n var _classNames;\n\n var getPrefixCls = _ref2.getPrefixCls,\n direction = _ref2.direction;\n\n var _a = _this.props,\n customizePrefixCls = _a.prefixCls,\n className = _a.className,\n size = _a.size,\n tip = _a.tip,\n wrapperClassName = _a.wrapperClassName,\n style = _a.style,\n restProps = __rest(_a, [\"prefixCls\", \"className\", \"size\", \"tip\", \"wrapperClassName\", \"style\"]);\n\n var spinning = _this.state.spinning;\n var prefixCls = getPrefixCls('spin', customizePrefixCls);\n var spinClassName = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-sm\"), size === 'small'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-lg\"), size === 'large'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-spinning\"), spinning), _defineProperty(_classNames, \"\".concat(prefixCls, \"-show-text\"), !!tip), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className); // fix https://fb.me/react-unknown-prop\n\n var divProps = omit(restProps, ['spinning', 'delay', 'indicator']);\n var spinElement = /*#__PURE__*/React.createElement(\"div\", _extends({}, divProps, {\n style: style,\n className: spinClassName\n }), renderIndicator(prefixCls, _this.props), tip ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-text\")\n }, tip) : null);\n\n if (_this.isNestedPattern()) {\n var containerClassName = classNames(\"\".concat(prefixCls, \"-container\"), _defineProperty({}, \"\".concat(prefixCls, \"-blur\"), spinning));\n return /*#__PURE__*/React.createElement(\"div\", _extends({}, divProps, {\n className: classNames(\"\".concat(prefixCls, \"-nested-loading\"), wrapperClassName)\n }), spinning && /*#__PURE__*/React.createElement(\"div\", {\n key: \"loading\"\n }, spinElement), /*#__PURE__*/React.createElement(\"div\", {\n className: containerClassName,\n key: \"container\"\n }, _this.props.children));\n }\n\n return spinElement;\n };\n\n var spinning = props.spinning,\n delay = props.delay;\n var shouldBeDelayed = shouldDelay(spinning, delay);\n _this.state = {\n spinning: spinning && !shouldBeDelayed\n };\n _this.originalUpdateSpinning = _this.updateSpinning;\n\n _this.debouncifyUpdateSpinning(props);\n\n return _this;\n }\n\n _createClass(Spin, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.updateSpinning();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n this.debouncifyUpdateSpinning();\n this.updateSpinning();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.cancelExistingSpin();\n }\n }, {\n key: \"cancelExistingSpin\",\n value: function cancelExistingSpin() {\n var updateSpinning = this.updateSpinning;\n\n if (updateSpinning && updateSpinning.cancel) {\n updateSpinning.cancel();\n }\n }\n }, {\n key: \"isNestedPattern\",\n value: function isNestedPattern() {\n return !!(this.props && typeof this.props.children !== 'undefined');\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderSpin);\n }\n }], [{\n key: \"setDefaultIndicator\",\n value: function setDefaultIndicator(indicator) {\n defaultIndicator = indicator;\n }\n }]);\n\n return Spin;\n}(React.Component);\n\nSpin.defaultProps = {\n spinning: true,\n size: 'default',\n wrapperClassName: ''\n};\nexport default Spin;"]},"metadata":{},"sourceType":"module"}