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