02b1214969f5b5077c7b84dd47b76c2c.json 7.96 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\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\";\nimport * as React from 'react';\nimport defaultLocaleData from './default';\nimport LocaleContext from './context';\n\nvar LocaleReceiver = /*#__PURE__*/function (_React$Component) {\n  _inherits(LocaleReceiver, _React$Component);\n\n  var _super = _createSuper(LocaleReceiver);\n\n  function LocaleReceiver() {\n    _classCallCheck(this, LocaleReceiver);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(LocaleReceiver, [{\n    key: \"getLocale\",\n    value: function getLocale() {\n      var _this$props = this.props,\n          componentName = _this$props.componentName,\n          defaultLocale = _this$props.defaultLocale;\n      var locale = defaultLocale || defaultLocaleData[componentName || 'global'];\n      var antLocale = this.context;\n      var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};\n      return _extends(_extends({}, typeof locale === 'function' ? locale() : locale), localeFromContext || {});\n    }\n  }, {\n    key: \"getLocaleCode\",\n    value: function getLocaleCode() {\n      var antLocale = this.context;\n      var localeCode = antLocale && antLocale.locale; // Had use LocaleProvide but didn't set locale\n\n      if (antLocale && antLocale.exist && !localeCode) {\n        return defaultLocaleData.locale;\n      }\n\n      return localeCode;\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      return this.props.children(this.getLocale(), this.getLocaleCode(), this.context);\n    }\n  }]);\n\n  return LocaleReceiver;\n}(React.Component);\n\nexport { LocaleReceiver as default };\nLocaleReceiver.defaultProps = {\n  componentName: 'global'\n};\nLocaleReceiver.contextType = LocaleContext;\nexport function useLocaleReceiver(componentName, defaultLocale) {\n  var antLocale = React.useContext(LocaleContext);\n  var componentLocale = React.useMemo(function () {\n    var locale = defaultLocale || defaultLocaleData[componentName || 'global'];\n    var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};\n    return _extends(_extends({}, typeof locale === 'function' ? locale() : locale), localeFromContext || {});\n  }, [componentName, defaultLocale, antLocale]);\n  return [componentLocale];\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/locale-provider/LocaleReceiver.js"],"names":["_extends","_classCallCheck","_createClass","_inherits","_createSuper","React","defaultLocaleData","LocaleContext","LocaleReceiver","_React$Component","_super","apply","arguments","key","value","getLocale","_this$props","props","componentName","defaultLocale","locale","antLocale","context","localeFromContext","getLocaleCode","localeCode","exist","render","children","Component","default","defaultProps","contextType","useLocaleReceiver","useContext","componentLocale","useMemo"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,iBAAP,MAA8B,WAA9B;AACA,OAAOC,aAAP,MAA0B,WAA1B;;AAEA,IAAIC,cAAc,GAAG,aAAa,UAAUC,gBAAV,EAA4B;AAC5DN,EAAAA,SAAS,CAACK,cAAD,EAAiBC,gBAAjB,CAAT;;AAEA,MAAIC,MAAM,GAAGN,YAAY,CAACI,cAAD,CAAzB;;AAEA,WAASA,cAAT,GAA0B;AACxBP,IAAAA,eAAe,CAAC,IAAD,EAAOO,cAAP,CAAf;;AAEA,WAAOE,MAAM,CAACC,KAAP,CAAa,IAAb,EAAmBC,SAAnB,CAAP;AACD;;AAEDV,EAAAA,YAAY,CAACM,cAAD,EAAiB,CAAC;AAC5BK,IAAAA,GAAG,EAAE,WADuB;AAE5BC,IAAAA,KAAK,EAAE,SAASC,SAAT,GAAqB;AAC1B,UAAIC,WAAW,GAAG,KAAKC,KAAvB;AAAA,UACIC,aAAa,GAAGF,WAAW,CAACE,aADhC;AAAA,UAE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AA6BzB,aAA7B;AACA,OAAO,SAAS0B,iBAAT,CAA2Bf,aAA3B,EAA0CC,aAA1C,EAAyD;AAC9D,MAAIE,SAAS,GAAGhB,KAAK,CAAC6B,UAAN,CAAiB3B,aAAjB,CAAhB;AACA,MAAI4B,eAAe,GAAG9B,KAAK,CAAC+B,OAAN,CAAc,YAAY;AAC9C,QAAIhB,MAAM,GAAGD,aAAa,IAAIb,iBAAiB,CAACY,aAAa,IAAI,QAAlB,CAA/C;AACA,QAAIK,iBAAiB,GAAGL,aAAa,IAAIG,SAAjB,GAA6BA,SAAS,CAACH,aAAD,CAAtC,GAAwD,EAAhF;AACA,WAAOlB,QAAQ,CAACA,QAAQ,CAAC,EAAD,EAAK,OAAOoB,MAAP,KAAkB,UAAlB,GAA+BA,MAAM,EAArC,GAA0CA,MAA/C,CAAT,EAAiEG,iBAAiB,IAAI,EAAtF,CAAf;AACD,GAJqB,EAInB,CAACL,aAAD,EAAgBC,aAAhB,EAA+BE,SAA/B,CAJmB,CAAtB;AAKA,SAAO,CAACc,eAAD,CAAP;AACD","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\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\";\nimport * as React from 'react';\nimport defaultLocaleData from './default';\nimport LocaleContext from './context';\n\nvar LocaleReceiver = /*#__PURE__*/function (_React$Component) {\n  _inherits(LocaleReceiver, _React$Component);\n\n  var _super = _createSuper(LocaleReceiver);\n\n  function LocaleReceiver() {\n    _classCallCheck(this, LocaleReceiver);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(LocaleReceiver, [{\n    key: \"getLocale\",\n    value: function getLocale() {\n      var _this$props = this.props,\n          componentName = _this$props.componentName,\n          defaultLocale = _this$props.defaultLocale;\n      var locale = defaultLocale || defaultLocaleData[componentName || 'global'];\n      var antLocale = this.context;\n      var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};\n      return _extends(_extends({}, typeof locale === 'function' ? locale() : locale), localeFromContext || {});\n    }\n  }, {\n    key: \"getLocaleCode\",\n    value: function getLocaleCode() {\n      var antLocale = this.context;\n      var localeCode = antLocale && antLocale.locale; // Had use LocaleProvide but didn't set locale\n\n      if (antLocale && antLocale.exist && !localeCode) {\n        return defaultLocaleData.locale;\n      }\n\n      return localeCode;\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      return this.props.children(this.getLocale(), this.getLocaleCode(), this.context);\n    }\n  }]);\n\n  return LocaleReceiver;\n}(React.Component);\n\nexport { LocaleReceiver as default };\nLocaleReceiver.defaultProps = {\n  componentName: 'global'\n};\nLocaleReceiver.contextType = LocaleContext;\nexport function useLocaleReceiver(componentName, defaultLocale) {\n  var antLocale = React.useContext(LocaleContext);\n  var componentLocale = React.useMemo(function () {\n    var locale = defaultLocale || defaultLocaleData[componentName || 'global'];\n    var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};\n    return _extends(_extends({}, typeof locale === 'function' ? locale() : locale), localeFromContext || {});\n  }, [componentName, defaultLocale, antLocale]);\n  return [componentLocale];\n}"]},"metadata":{},"sourceType":"module"}