d2ae961ef5daf48ee240a61a9c7b8408.json
3.83 KB
{"ast":null,"code":"import { useRef, useEffect } from 'react';\nexport var defaultProps = {\n className: '',\n percent: 0,\n prefixCls: 'rc-progress',\n strokeColor: '#2db7f5',\n strokeLinecap: 'round',\n strokeWidth: 1,\n style: {},\n trailColor: '#D9D9D9',\n trailWidth: 1\n};\nexport var useTransitionDuration = function useTransitionDuration(percentList) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n var paths = percentList.map(function () {\n return useRef();\n });\n var prevTimeStamp = useRef(null);\n useEffect(function () {\n var now = Date.now();\n var updated = false;\n Object.keys(paths).forEach(function (key) {\n var path = paths[key].current;\n\n if (!path) {\n return;\n }\n\n updated = true;\n var pathStyle = path.style;\n pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';\n\n if (prevTimeStamp.current && now - prevTimeStamp.current < 100) {\n pathStyle.transitionDuration = '0s, 0s';\n }\n });\n\n if (updated) {\n prevTimeStamp.current = Date.now();\n }\n });\n return [paths];\n};","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-progress/es/common.js"],"names":["useRef","useEffect","defaultProps","className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","useTransitionDuration","percentList","paths","map","prevTimeStamp","now","Date","updated","Object","keys","forEach","key","path","current","pathStyle","transitionDuration"],"mappings":"AAAA,SAASA,MAAT,EAAiBC,SAAjB,QAAkC,OAAlC;AACA,OAAO,IAAIC,YAAY,GAAG;AACxBC,EAAAA,SAAS,EAAE,EADa;AAExBC,EAAAA,OAAO,EAAE,CAFe;AAGxBC,EAAAA,SAAS,EAAE,aAHa;AAIxBC,EAAAA,WAAW,EAAE,SAJW;AAKxBC,EAAAA,aAAa,EAAE,OALS;AAMxBC,EAAAA,WAAW,EAAE,CANW;AAOxBC,EAAAA,KAAK,EAAE,EAPiB;AAQxBC,EAAAA,UAAU,EAAE,SARY;AASxBC,EAAAA,UAAU,EAAE;AATY,CAAnB;AAWP,OAAO,IAAIC,qBAAqB,GAAG,SAASA,qBAAT,CAA+BC,WAA/B,EAA4C;AAC7E;AACA,MAAIC,KAAK,GAAGD,WAAW,CAACE,GAAZ,CAAgB,YAAY;AACtC,WAAOf,MAAM,EAAb;AACD,GAFW,CAAZ;AAGA,MAAIgB,aAAa,GAAGhB,MAAM,CAAC,IAAD,CAA1B;AACAC,EAAAA,SAAS,CAAC,YAAY;AACpB,QAAIgB,GAAG,GAAGC,IAAI,CAACD,GAAL,EAAV;AACA,QAAIE,OAAO,GAAG,KAAd;AACAC,IAAAA,MAAM,CAACC,IAAP,CAAYP,KAAZ,EAAmBQ,OAAnB,CAA2B,UAAUC,GAAV,EAAe;AACxC,UAAIC,IAAI,GAAGV,KAAK,CAACS,GAAD,CAAL,CAAWE,OAAtB;;AAEA,UAAI,CAACD,IAAL,EAAW;AACT;AACD;;AAEDL,MAAAA,OAAO,GAAG,IAAV;AACA,UAAIO,SAAS,GAAGF,IAAI,CAACf,KAArB;AACAiB,MAAAA,SAAS,CAACC,kBAAV,GAA+B,qBAA/B;;AAEA,UAAIX,aAAa,CAACS,OAAd,IAAyBR,GAAG,GAAGD,aAAa,CAACS,OAApB,GAA8B,GAA3D,EAAgE;AAC9DC,QAAAA,SAAS,CAACC,kBAAV,GAA+B,QAA/B;AACD;AACF,KAdD;;AAgBA,QAAIR,OAAJ,EAAa;AACXH,MAAAA,aAAa,CAACS,OAAd,GAAwBP,IAAI,CAACD,GAAL,EAAxB;AACD;AACF,GAtBQ,CAAT;AAuBA,SAAO,CAACH,KAAD,CAAP;AACD,CA9BM","sourcesContent":["import { useRef, useEffect } from 'react';\nexport var defaultProps = {\n className: '',\n percent: 0,\n prefixCls: 'rc-progress',\n strokeColor: '#2db7f5',\n strokeLinecap: 'round',\n strokeWidth: 1,\n style: {},\n trailColor: '#D9D9D9',\n trailWidth: 1\n};\nexport var useTransitionDuration = function useTransitionDuration(percentList) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n var paths = percentList.map(function () {\n return useRef();\n });\n var prevTimeStamp = useRef(null);\n useEffect(function () {\n var now = Date.now();\n var updated = false;\n Object.keys(paths).forEach(function (key) {\n var path = paths[key].current;\n\n if (!path) {\n return;\n }\n\n updated = true;\n var pathStyle = path.style;\n pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';\n\n if (prevTimeStamp.current && now - prevTimeStamp.current < 100) {\n pathStyle.transitionDuration = '0s, 0s';\n }\n });\n\n if (updated) {\n prevTimeStamp.current = Date.now();\n }\n });\n return [paths];\n};"]},"metadata":{},"sourceType":"module"}