f4eae96fc2d0e6c7b1940662885f6bad.json
5.68 KB
{"ast":null,"code":"import * as React from 'react';\nimport padEnd from 'lodash/padEnd';\n\nvar StatisticNumber = function StatisticNumber(props) {\n var value = props.value,\n formatter = props.formatter,\n precision = props.precision,\n decimalSeparator = props.decimalSeparator,\n _props$groupSeparator = props.groupSeparator,\n groupSeparator = _props$groupSeparator === void 0 ? '' : _props$groupSeparator,\n prefixCls = props.prefixCls;\n var valueNode;\n\n if (typeof formatter === 'function') {\n // Customize formatter\n valueNode = formatter(value);\n } else {\n // Internal formatter\n var val = String(value);\n var cells = val.match(/^(-?)(\\d*)(\\.(\\d+))?$/); // Process if illegal number\n\n if (!cells || val === '-') {\n valueNode = val;\n } else {\n var negative = cells[1];\n\n var _int = cells[2] || '0';\n\n var decimal = cells[4] || '';\n _int = _int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, groupSeparator);\n\n if (typeof precision === 'number') {\n decimal = padEnd(decimal, precision, '0').slice(0, precision);\n }\n\n if (decimal) {\n decimal = \"\".concat(decimalSeparator).concat(decimal);\n }\n\n valueNode = [/*#__PURE__*/React.createElement(\"span\", {\n key: \"int\",\n className: \"\".concat(prefixCls, \"-content-value-int\")\n }, negative, _int), decimal && /*#__PURE__*/React.createElement(\"span\", {\n key: \"decimal\",\n className: \"\".concat(prefixCls, \"-content-value-decimal\")\n }, decimal)];\n }\n }\n\n return /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-content-value\")\n }, valueNode);\n};\n\nexport default StatisticNumber;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/statistic/Number.js"],"names":["React","padEnd","StatisticNumber","props","value","formatter","precision","decimalSeparator","_props$groupSeparator","groupSeparator","prefixCls","valueNode","val","String","cells","match","negative","_int","decimal","replace","slice","concat","createElement","key","className"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,eAAnB;;AAE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d,SAAzC,CAAV;AACD;;AAED,UAAIY,OAAJ,EAAa;AACXA,QAAAA,OAAO,GAAG,GAAGG,MAAH,CAAUd,gBAAV,EAA4Bc,MAA5B,CAAmCH,OAAnC,CAAV;AACD;;AAEDP,MAAAA,SAAS,GAAG,CAAC,aAAaX,KAAK,CAACsB,aAAN,CAAoB,MAApB,EAA4B;AACpDC,QAAAA,GAAG,EAAE,KAD+C;AAEpDC,QAAAA,SAAS,EAAE,GAAGH,MAAH,CAAUX,SAAV,EAAqB,oBAArB;AAFyC,OAA5B,EAGvBM,QAHuB,EAGbC,IAHa,CAAd,EAGQC,OAAO,IAAI,aAAalB,KAAK,CAACsB,aAAN,CAAoB,MAApB,EAA4B;AACtEC,QAAAA,GAAG,EAAE,SADiE;AAEtEC,QAAAA,SAAS,EAAE,GAAGH,MAAH,CAAUX,SAAV,EAAqB,wBAArB;AAF2D,OAA5B,EAGzCQ,OAHyC,CAHhC,CAAZ;AAOD;AACF;;AAED,SAAO,aAAalB,KAAK,CAACsB,aAAN,CAAoB,MAApB,EAA4B;AAC9CE,IAAAA,SAAS,EAAE,GAAGH,MAAH,CAAUX,SAAV,EAAqB,gBAArB;AADmC,GAA5B,EAEjBC,SAFiB,CAApB;AAGD,CAjDD;;AAmDA,eAAeT,eAAf","sourcesContent":["import * as React from 'react';\nimport padEnd from 'lodash/padEnd';\n\nvar StatisticNumber = function StatisticNumber(props) {\n var value = props.value,\n formatter = props.formatter,\n precision = props.precision,\n decimalSeparator = props.decimalSeparator,\n _props$groupSeparator = props.groupSeparator,\n groupSeparator = _props$groupSeparator === void 0 ? '' : _props$groupSeparator,\n prefixCls = props.prefixCls;\n var valueNode;\n\n if (typeof formatter === 'function') {\n // Customize formatter\n valueNode = formatter(value);\n } else {\n // Internal formatter\n var val = String(value);\n var cells = val.match(/^(-?)(\\d*)(\\.(\\d+))?$/); // Process if illegal number\n\n if (!cells || val === '-') {\n valueNode = val;\n } else {\n var negative = cells[1];\n\n var _int = cells[2] || '0';\n\n var decimal = cells[4] || '';\n _int = _int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, groupSeparator);\n\n if (typeof precision === 'number') {\n decimal = padEnd(decimal, precision, '0').slice(0, precision);\n }\n\n if (decimal) {\n decimal = \"\".concat(decimalSeparator).concat(decimal);\n }\n\n valueNode = [/*#__PURE__*/React.createElement(\"span\", {\n key: \"int\",\n className: \"\".concat(prefixCls, \"-content-value-int\")\n }, negative, _int), decimal && /*#__PURE__*/React.createElement(\"span\", {\n key: \"decimal\",\n className: \"\".concat(prefixCls, \"-content-value-decimal\")\n }, decimal)];\n }\n }\n\n return /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-content-value\")\n }, valueNode);\n};\n\nexport default StatisticNumber;"]},"metadata":{},"sourceType":"module"}