a096ece7f07e8ebf6fe1611db12d6f66.json
3.52 KB
{"ast":null,"code":"import shallowEqual from 'shallowequal';\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nimport { formatValue } from '../utils/dateUtil';\nexport default function useValueTexts(value, _ref) {\n var formatList = _ref.formatList,\n generateConfig = _ref.generateConfig,\n locale = _ref.locale;\n return useMemo(function () {\n if (!value) {\n return [[''], ''];\n } // We will convert data format back to first format\n\n\n var firstValueText = '';\n var fullValueTexts = [];\n\n for (var i = 0; i < formatList.length; i += 1) {\n var format = formatList[i];\n var formatStr = formatValue(value, {\n generateConfig: generateConfig,\n locale: locale,\n format: format\n });\n fullValueTexts.push(formatStr);\n\n if (i === 0) {\n firstValueText = formatStr;\n }\n }\n\n return [fullValueTexts, firstValueText];\n }, [value, formatList], function (prev, next) {\n return prev[0] !== next[0] || !shallowEqual(prev[1], next[1]);\n });\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/hooks/useValueTexts.js"],"names":["shallowEqual","useMemo","formatValue","useValueTexts","value","_ref","formatList","generateConfig","locale","firstValueText","fullValueTexts","i","length","format","formatStr","push","prev","next"],"mappings":"AAAA,OAAOA,YAAP,MAAyB,cAAzB;AACA,OAAOC,OAAP,MAAoB,0BAApB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,eAAe,SAASC,aAAT,CAAuBC,KAAvB,EAA8BC,IAA9B,EAAoC;AACjD,MAAIC,UAAU,GAAGD,IAAI,CAACC,UAAtB;AAAA,MACIC,cAAc,GAAGF,IAAI,CAACE,cAD1B;AAAA,MAEIC,MAAM,GAAGH,IAAI,CAACG,MAFlB;AAGA,SAAOP,OAAO,CAAC,YAAY;AACzB,QAAI,CAACG,KAAL,EAAY;AACV,aAAO,CAAC,CAAC,EAAD,CAAD,EAAO,EAAP,CAAP;AACD,KAHwB,CAGvB;;;AAGF,QAAIK,cAAc,GAAG,EAArB;AACA,QAAIC,cAAc,GAAG,EAArB;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,UAAU,CAACM,MAA/B,EAAuCD,CAAC,IAAI,CAA5C,EAA+C;AAC7C,UAAIE,MAAM,GAAGP,UAAU,CAACK,CAAD,CAAvB;AACA,UAAIG,SAAS,GAAGZ,WAAW,CAACE,KAAD,EAAQ;AACjCG,QAAAA,cAAc,EAAEA,cADiB;AAEjCC,QAAAA,MAAM,EAAEA,MAFyB;AAGjCK,QAAAA,MAAM,EAAEA;AAHyB,OAAR,CAA3B;AAKAH,MAAAA,cAAc,CAACK,IAAf,CAAoBD,SAApB;;AAEA,UAAIH,CAAC,KAAK,CAAV,EAAa;AACXF,QAAAA,cAAc,GAAGK,SAAjB;AACD;AACF;;AAED,WAAO,CAACJ,cAAD,EAAiBD,cAAjB,CAAP;AACD,GAxBa,EAwBX,CAACL,KAAD,EAAQE,UAAR,CAxBW,EAwBU,UAAUU,IAAV,EAAgBC,IAAhB,EAAsB;AAC5C,WAAOD,IAAI,CAAC,CAAD,CAAJ,KAAYC,IAAI,CAAC,CAAD,CAAhB,IAAuB,CAACjB,YAAY,CAACgB,IAAI,CAAC,CAAD,CAAL,EAAUC,IAAI,CAAC,CAAD,CAAd,CAA3C;AACD,GA1Ba,CAAd;AA2BD","sourcesContent":["import shallowEqual from 'shallowequal';\nimport useMemo from \"rc-util/es/hooks/useMemo\";\nimport { formatValue } from '../utils/dateUtil';\nexport default function useValueTexts(value, _ref) {\n var formatList = _ref.formatList,\n generateConfig = _ref.generateConfig,\n locale = _ref.locale;\n return useMemo(function () {\n if (!value) {\n return [[''], ''];\n } // We will convert data format back to first format\n\n\n var firstValueText = '';\n var fullValueTexts = [];\n\n for (var i = 0; i < formatList.length; i += 1) {\n var format = formatList[i];\n var formatStr = formatValue(value, {\n generateConfig: generateConfig,\n locale: locale,\n format: format\n });\n fullValueTexts.push(formatStr);\n\n if (i === 0) {\n firstValueText = formatStr;\n }\n }\n\n return [fullValueTexts, firstValueText];\n }, [value, formatList], function (prev, next) {\n return prev[0] !== next[0] || !shallowEqual(prev[1], next[1]);\n });\n}"]},"metadata":{},"sourceType":"module"}