1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.useTransitionDuration = exports.defaultProps = void 0;
|
7 |
|
8 | var _react = require("react");
|
9 |
|
10 | var defaultProps = {
|
11 | className: '',
|
12 | percent: 0,
|
13 | prefixCls: 'rc-progress',
|
14 | strokeColor: '#2db7f5',
|
15 | strokeLinecap: 'round',
|
16 | strokeWidth: 1,
|
17 | style: {},
|
18 | trailColor: '#D9D9D9',
|
19 | trailWidth: 1,
|
20 | gapPosition: 'bottom'
|
21 | };
|
22 | exports.defaultProps = defaultProps;
|
23 |
|
24 | var useTransitionDuration = function useTransitionDuration(percentList) {
|
25 |
|
26 | var paths = percentList.map(function () {
|
27 | return (0, _react.useRef)();
|
28 | });
|
29 | var prevTimeStamp = (0, _react.useRef)(null);
|
30 | (0, _react.useEffect)(function () {
|
31 | var now = Date.now();
|
32 | var updated = false;
|
33 | Object.keys(paths).forEach(function (key) {
|
34 | var path = paths[key].current;
|
35 |
|
36 | if (!path) {
|
37 | return;
|
38 | }
|
39 |
|
40 | updated = true;
|
41 | var pathStyle = path.style;
|
42 | pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';
|
43 |
|
44 | if (prevTimeStamp.current && now - prevTimeStamp.current < 100) {
|
45 | pathStyle.transitionDuration = '0s, 0s';
|
46 | }
|
47 | });
|
48 |
|
49 | if (updated) {
|
50 | prevTimeStamp.current = Date.now();
|
51 | }
|
52 | });
|
53 | return [paths];
|
54 | };
|
55 |
|
56 | exports.useTransitionDuration = useTransitionDuration; |
\ | No newline at end of file |