antd3-esm 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/Checkbox.js +164 -0
- package/dist/CommonMixin.js +816 -0
- package/dist/Divider.js +646 -0
- package/dist/Notification.js +279 -0
- package/dist/Pagination.js +1106 -0
- package/dist/PortalWrapper.js +347 -0
- package/dist/RowContext.js +5 -0
- package/dist/Sider.js +533 -0
- package/dist/TextArea.js +432 -0
- package/dist/_arrayMap.js +68 -0
- package/dist/_assignValue.js +95 -0
- package/dist/_copyArray.js +31 -0
- package/dist/_hasPath.js +53 -0
- package/dist/_overArg.js +437 -0
- package/dist/_stringToArray.js +136 -0
- package/dist/antd/es/affix.js +12 -0
- package/dist/antd/es/alert.js +5 -0
- package/dist/antd/es/anchor.js +466 -0
- package/dist/antd/es/auto-complete.js +5 -0
- package/dist/antd/es/avatar.js +5 -0
- package/dist/antd/es/back-top.js +5 -0
- package/dist/antd/es/badge.js +5 -0
- package/dist/antd/es/breadcrumb.js +18 -0
- package/dist/antd/es/button.js +12 -0
- package/dist/antd/es/calendar.js +953 -0
- package/dist/antd/es/card.js +5 -0
- package/dist/antd/es/carousel.js +5 -0
- package/dist/antd/es/cascader.js +1275 -0
- package/dist/antd/es/checkbox.js +11 -0
- package/dist/antd/es/col.js +4 -0
- package/dist/antd/es/collapse.js +688 -0
- package/dist/antd/es/comment.js +5 -0
- package/dist/antd/es/config-provider.js +2 -0
- package/dist/antd/es/date-picker.js +4322 -0
- package/dist/antd/es/descriptions.js +342 -0
- package/dist/antd/es/divider.js +53 -0
- package/dist/antd/es/drawer.js +1115 -0
- package/dist/antd/es/dropdown.js +14 -0
- package/dist/antd/es/empty.js +6 -0
- package/dist/antd/es/form.js +5008 -0
- package/dist/antd/es/grid.js +13 -0
- package/dist/antd/es/icon.js +6 -0
- package/dist/antd/es/input-number.js +5 -0
- package/dist/antd/es/input.js +16 -0
- package/dist/antd/es/layout.js +14 -0
- package/dist/antd/es/list.js +5 -0
- package/dist/antd/es/locale/ar_EG.js +102 -0
- package/dist/antd/es/locale/bg_BG.js +98 -0
- package/dist/antd/es/locale/ca_ES.js +96 -0
- package/dist/antd/es/locale/cs_CZ.js +96 -0
- package/dist/antd/es/locale/da_DK.js +98 -0
- package/dist/antd/es/locale/de_DE.js +98 -0
- package/dist/antd/es/locale/default.js +2 -0
- package/dist/antd/es/locale/el_GR.js +98 -0
- package/dist/antd/es/locale/en_GB.js +98 -0
- package/dist/antd/es/locale/en_US.js +2 -0
- package/dist/antd/es/locale/es_ES.js +114 -0
- package/dist/antd/es/locale/et_EE.js +98 -0
- package/dist/antd/es/locale/fa_IR.js +98 -0
- package/dist/antd/es/locale/fi_FI.js +99 -0
- package/dist/antd/es/locale/fr_BE.js +102 -0
- package/dist/antd/es/locale/fr_FR.js +102 -0
- package/dist/antd/es/locale/ga_IE.js +99 -0
- package/dist/antd/es/locale/he_IL.js +99 -0
- package/dist/antd/es/locale/hi_IN.js +107 -0
- package/dist/antd/es/locale/hr_HR.js +113 -0
- package/dist/antd/es/locale/hu_HU.js +99 -0
- package/dist/antd/es/locale/hy_AM.js +109 -0
- package/dist/antd/es/locale/id_ID.js +101 -0
- package/dist/antd/es/locale/is_IS.js +98 -0
- package/dist/antd/es/locale/it_IT.js +111 -0
- package/dist/antd/es/locale/ja_JP.js +96 -0
- package/dist/antd/es/locale/kn_IN.js +107 -0
- package/dist/antd/es/locale/ko_KR.js +98 -0
- package/dist/antd/es/locale/ku_IQ.js +98 -0
- package/dist/antd/es/locale/lv_LV.js +98 -0
- package/dist/antd/es/locale/mk_MK.js +113 -0
- package/dist/antd/es/locale/mn_MN.js +99 -0
- package/dist/antd/es/locale/ms_MY.js +118 -0
- package/dist/antd/es/locale/nb_NO.js +97 -0
- package/dist/antd/es/locale/ne_NP.js +44 -0
- package/dist/antd/es/locale/nl_BE.js +98 -0
- package/dist/antd/es/locale/nl_NL.js +117 -0
- package/dist/antd/es/locale/pl_PL.js +98 -0
- package/dist/antd/es/locale/pt_BR.js +104 -0
- package/dist/antd/es/locale/pt_PT.js +127 -0
- package/dist/antd/es/locale/ro_RO.js +118 -0
- package/dist/antd/es/locale/ru_RU.js +110 -0
- package/dist/antd/es/locale/sk_SK.js +118 -0
- package/dist/antd/es/locale/sl_SI.js +96 -0
- package/dist/antd/es/locale/sr_RS.js +97 -0
- package/dist/antd/es/locale/sv_SE.js +101 -0
- package/dist/antd/es/locale/ta_IN.js +119 -0
- package/dist/antd/es/locale/th_TH.js +117 -0
- package/dist/antd/es/locale/tr_TR.js +112 -0
- package/dist/antd/es/locale/uk_UA.js +97 -0
- package/dist/antd/es/locale/vi_VN.js +99 -0
- package/dist/antd/es/locale/zh_CN.js +104 -0
- package/dist/antd/es/locale/zh_TW.js +100 -0
- package/dist/antd/es/locale-provider.js +6 -0
- package/dist/antd/es/mention.js +23215 -0
- package/dist/antd/es/mentions.js +961 -0
- package/dist/antd/es/menu.js +5 -0
- package/dist/antd/es/message.js +161 -0
- package/dist/antd/es/modal.js +885 -0
- package/dist/antd/es/notification.js +216 -0
- package/dist/antd/es/page-header.js +350 -0
- package/dist/antd/es/pagination.js +15 -0
- package/dist/antd/es/popconfirm.js +215 -0
- package/dist/antd/es/popover.js +5 -0
- package/dist/antd/es/progress.js +10 -0
- package/dist/antd/es/radio.js +10 -0
- package/dist/antd/es/rate.js +5 -0
- package/dist/antd/es/result.js +828 -0
- package/dist/antd/es/row.js +9 -0
- package/dist/antd/es/select.js +5 -0
- package/dist/antd/es/skeleton.js +370 -0
- package/dist/antd/es/slider.js +5 -0
- package/dist/antd/es/spin.js +11 -0
- package/dist/antd/es/statistic.js +650 -0
- package/dist/antd/es/steps.js +5 -0
- package/dist/antd/es/style.js +5 -0
- package/dist/antd/es/switch.js +5 -0
- package/dist/antd/es/table.js +7057 -0
- package/dist/antd/es/tabs.js +5 -0
- package/dist/antd/es/tag.js +12 -0
- package/dist/antd/es/time-picker.js +10 -0
- package/dist/antd/es/timeline.js +206 -0
- package/dist/antd/es/tooltip.js +9 -0
- package/dist/antd/es/transfer.js +2508 -0
- package/dist/antd/es/tree-select.js +5 -0
- package/dist/antd/es/tree.js +10 -0
- package/dist/antd/es/typography.js +1246 -0
- package/dist/antd/es/upload.js +3418 -0
- package/dist/antd/es/version.js +7 -0
- package/dist/col.js +142 -0
- package/dist/config-provider.js +6949 -0
- package/dist/dropdown.js +442 -0
- package/dist/get.js +1043 -0
- package/dist/icon.js +6138 -0
- package/dist/identity.js +230 -0
- package/dist/index.js +462 -0
- package/dist/index10.js +478 -0
- package/dist/index11.js +232 -0
- package/dist/index12.js +2766 -0
- package/dist/index13.js +422 -0
- package/dist/index14.js +283 -0
- package/dist/index15.js +1755 -0
- package/dist/index2.js +374 -0
- package/dist/index3.js +407 -0
- package/dist/index4.js +522 -0
- package/dist/index5.js +601 -0
- package/dist/index6.js +601 -0
- package/dist/index7.js +364 -0
- package/dist/index8.js +436 -0
- package/dist/index9.js +130 -0
- package/dist/input.js +475 -0
- package/dist/isLength.js +402 -0
- package/dist/keys.js +292 -0
- package/dist/menu.js +8138 -0
- package/dist/progress.js +852 -0
- package/dist/raf.js +34 -0
- package/dist/responsiveObserve.js +444 -0
- package/dist/row.js +173 -0
- package/dist/scrollTo.js +66 -0
- package/dist/toInteger.js +123 -0
- package/dist/toString.js +84 -0
- package/dist/transButton.js +121 -0
- package/dist/tree.js +3017 -0
- package/dist/warning.js +55 -0
- package/dist/wave.js +230 -0
- package/dist/zh_CN.js +17 -0
- package/package.json +160 -0
package/dist/progress.js
ADDED
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
import { P as PropTypes, c as classNames, C as ConfigConsumer, p as propTypesExports } from './config-provider.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { Component } from 'react';
|
|
4
|
+
import { o as omit, t as tuple } from './input.js';
|
|
5
|
+
import { I as Icon } from './icon.js';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
8
|
+
function validProgress(progress) {
|
|
9
|
+
if (!progress || progress < 0) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (progress > 100) {
|
|
14
|
+
return 100;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return progress;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
|
|
24
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
+
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
+
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
+
|
|
32
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
+
|
|
34
|
+
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
35
|
+
var t = {};
|
|
36
|
+
|
|
37
|
+
for (var p in s) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* {
|
|
48
|
+
* '0%': '#afc163',
|
|
49
|
+
* '75%': '#009900',
|
|
50
|
+
* '50%': 'green', ====> '#afc163 0%, #66FF00 25%, #00CC00 50%, #009900 75%, #ffffff 100%'
|
|
51
|
+
* '25%': '#66FF00',
|
|
52
|
+
* '100%': '#ffffff'
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
var sortGradient = function sortGradient(gradients) {
|
|
57
|
+
var tempArr = []; // eslint-disable-next-line no-restricted-syntax
|
|
58
|
+
|
|
59
|
+
for (var _i = 0, _Object$entries = Object.entries(gradients); _i < _Object$entries.length; _i++) {
|
|
60
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
61
|
+
key = _Object$entries$_i[0],
|
|
62
|
+
value = _Object$entries$_i[1];
|
|
63
|
+
|
|
64
|
+
var formatKey = parseFloat(key.replace(/%/g, ''));
|
|
65
|
+
|
|
66
|
+
if (isNaN(formatKey)) {
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
tempArr.push({
|
|
71
|
+
key: formatKey,
|
|
72
|
+
value: value
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
tempArr = tempArr.sort(function (a, b) {
|
|
77
|
+
return a.key - b.key;
|
|
78
|
+
});
|
|
79
|
+
return tempArr.map(function (_ref) {
|
|
80
|
+
var key = _ref.key,
|
|
81
|
+
value = _ref.value;
|
|
82
|
+
return "".concat(value, " ").concat(key, "%");
|
|
83
|
+
}).join(', ');
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* {
|
|
87
|
+
* '0%': '#afc163',
|
|
88
|
+
* '25%': '#66FF00',
|
|
89
|
+
* '50%': '#00CC00', ====> linear-gradient(to right, #afc163 0%, #66FF00 25%,
|
|
90
|
+
* '75%': '#009900', #00CC00 50%, #009900 75%, #ffffff 100%)
|
|
91
|
+
* '100%': '#ffffff'
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* Then this man came to realize the truth:
|
|
95
|
+
* Besides six pence, there is the moon.
|
|
96
|
+
* Besides bread and butter, there is the bug.
|
|
97
|
+
* And...
|
|
98
|
+
* Besides women, there is the code.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
var handleGradient = function handleGradient(strokeColor) {
|
|
102
|
+
var _strokeColor$from = strokeColor.from,
|
|
103
|
+
from = _strokeColor$from === void 0 ? '#1890ff' : _strokeColor$from,
|
|
104
|
+
_strokeColor$to = strokeColor.to,
|
|
105
|
+
to = _strokeColor$to === void 0 ? '#1890ff' : _strokeColor$to,
|
|
106
|
+
_strokeColor$directio = strokeColor.direction,
|
|
107
|
+
direction = _strokeColor$directio === void 0 ? 'to right' : _strokeColor$directio,
|
|
108
|
+
rest = __rest$1(strokeColor, ["from", "to", "direction"]);
|
|
109
|
+
|
|
110
|
+
if (Object.keys(rest).length !== 0) {
|
|
111
|
+
var sortedGradients = sortGradient(rest);
|
|
112
|
+
return {
|
|
113
|
+
backgroundImage: "linear-gradient(".concat(direction, ", ").concat(sortedGradients, ")")
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
backgroundImage: "linear-gradient(".concat(direction, ", ").concat(from, ", ").concat(to, ")")
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
var Line$1 = function Line(props) {
|
|
123
|
+
var prefixCls = props.prefixCls,
|
|
124
|
+
percent = props.percent,
|
|
125
|
+
successPercent = props.successPercent,
|
|
126
|
+
strokeWidth = props.strokeWidth,
|
|
127
|
+
size = props.size,
|
|
128
|
+
strokeColor = props.strokeColor,
|
|
129
|
+
strokeLinecap = props.strokeLinecap,
|
|
130
|
+
children = props.children;
|
|
131
|
+
var backgroundProps;
|
|
132
|
+
|
|
133
|
+
if (strokeColor && typeof strokeColor !== 'string') {
|
|
134
|
+
backgroundProps = handleGradient(strokeColor);
|
|
135
|
+
} else {
|
|
136
|
+
backgroundProps = {
|
|
137
|
+
background: strokeColor
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var percentStyle = _extends$3({
|
|
142
|
+
width: "".concat(validProgress(percent), "%"),
|
|
143
|
+
height: strokeWidth || (size === 'small' ? 6 : 8),
|
|
144
|
+
borderRadius: strokeLinecap === 'square' ? 0 : ''
|
|
145
|
+
}, backgroundProps);
|
|
146
|
+
|
|
147
|
+
var successPercentStyle = {
|
|
148
|
+
width: "".concat(validProgress(successPercent), "%"),
|
|
149
|
+
height: strokeWidth || (size === 'small' ? 6 : 8),
|
|
150
|
+
borderRadius: strokeLinecap === 'square' ? 0 : ''
|
|
151
|
+
};
|
|
152
|
+
var successSegment = successPercent !== undefined ? /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: "".concat(prefixCls, "-success-bg"),
|
|
154
|
+
style: successPercentStyle
|
|
155
|
+
}) : null;
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "".concat(prefixCls, "-outer")
|
|
158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "".concat(prefixCls, "-inner")
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "".concat(prefixCls, "-bg"),
|
|
162
|
+
style: percentStyle
|
|
163
|
+
}), successSegment)), children);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
167
|
+
|
|
168
|
+
function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
169
|
+
|
|
170
|
+
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); return Constructor; }
|
|
171
|
+
|
|
172
|
+
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
173
|
+
|
|
174
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf$3(object); if (object === null) break; } return object; }
|
|
175
|
+
|
|
176
|
+
function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$3(subClass, superClass); }
|
|
177
|
+
|
|
178
|
+
function _setPrototypeOf$3(o, p) { _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$3(o, p); }
|
|
179
|
+
|
|
180
|
+
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function () { var Super = _getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$3(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$3(this, result); }; }
|
|
181
|
+
|
|
182
|
+
function _possibleConstructorReturn$3(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$3(self); }
|
|
183
|
+
|
|
184
|
+
function _assertThisInitialized$3(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
185
|
+
|
|
186
|
+
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
187
|
+
|
|
188
|
+
function _getPrototypeOf$3(o) { _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$3(o); }
|
|
189
|
+
|
|
190
|
+
var enhancer = function enhancer(WrappedComponent) {
|
|
191
|
+
return /*#__PURE__*/function (_WrappedComponent) {
|
|
192
|
+
_inherits$3(Progress, _WrappedComponent);
|
|
193
|
+
|
|
194
|
+
var _super = _createSuper$3(Progress);
|
|
195
|
+
|
|
196
|
+
function Progress() {
|
|
197
|
+
_classCallCheck$3(this, Progress);
|
|
198
|
+
|
|
199
|
+
return _super.apply(this, arguments);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
_createClass$3(Progress, [{
|
|
203
|
+
key: "componentDidUpdate",
|
|
204
|
+
value: function componentDidUpdate() {
|
|
205
|
+
var _this = this;
|
|
206
|
+
|
|
207
|
+
var now = Date.now();
|
|
208
|
+
var updated = false;
|
|
209
|
+
Object.keys(this.paths).forEach(function (key) {
|
|
210
|
+
var path = _this.paths[key];
|
|
211
|
+
|
|
212
|
+
if (!path) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
updated = true;
|
|
217
|
+
var pathStyle = path.style;
|
|
218
|
+
pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';
|
|
219
|
+
|
|
220
|
+
if (_this.prevTimeStamp && now - _this.prevTimeStamp < 100) {
|
|
221
|
+
pathStyle.transitionDuration = '0s, 0s';
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
if (updated) {
|
|
226
|
+
this.prevTimeStamp = Date.now();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "render",
|
|
231
|
+
value: function render() {
|
|
232
|
+
return _get(_getPrototypeOf$3(Progress.prototype), "render", this).call(this);
|
|
233
|
+
}
|
|
234
|
+
}]);
|
|
235
|
+
|
|
236
|
+
return Progress;
|
|
237
|
+
}(WrappedComponent);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
var defaultProps = {
|
|
241
|
+
className: '',
|
|
242
|
+
percent: 0,
|
|
243
|
+
prefixCls: 'rc-progress',
|
|
244
|
+
strokeColor: '#2db7f5',
|
|
245
|
+
strokeLinecap: 'round',
|
|
246
|
+
strokeWidth: 1,
|
|
247
|
+
style: {},
|
|
248
|
+
trailColor: '#D9D9D9',
|
|
249
|
+
trailWidth: 1
|
|
250
|
+
};
|
|
251
|
+
var mixedType = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
|
252
|
+
var propTypes = {
|
|
253
|
+
className: PropTypes.string,
|
|
254
|
+
percent: PropTypes.oneOfType([mixedType, PropTypes.arrayOf(mixedType)]),
|
|
255
|
+
prefixCls: PropTypes.string,
|
|
256
|
+
strokeColor: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])), PropTypes.object]),
|
|
257
|
+
strokeLinecap: PropTypes.oneOf(['butt', 'round', 'square']),
|
|
258
|
+
strokeWidth: mixedType,
|
|
259
|
+
style: PropTypes.object,
|
|
260
|
+
trailColor: PropTypes.string,
|
|
261
|
+
trailWidth: mixedType
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
265
|
+
|
|
266
|
+
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
267
|
+
|
|
268
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
269
|
+
|
|
270
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
271
|
+
|
|
272
|
+
function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
273
|
+
|
|
274
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
|
|
275
|
+
|
|
276
|
+
function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$2(subClass, superClass); }
|
|
277
|
+
|
|
278
|
+
function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
|
|
279
|
+
|
|
280
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function () { var Super = _getPrototypeOf$2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$2(this, result); }; }
|
|
281
|
+
|
|
282
|
+
function _possibleConstructorReturn$2(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
|
|
283
|
+
|
|
284
|
+
function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
285
|
+
|
|
286
|
+
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
287
|
+
|
|
288
|
+
function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
|
|
289
|
+
|
|
290
|
+
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
291
|
+
|
|
292
|
+
var Line = /*#__PURE__*/function (_Component) {
|
|
293
|
+
_inherits$2(Line, _Component);
|
|
294
|
+
|
|
295
|
+
var _super = _createSuper$2(Line);
|
|
296
|
+
|
|
297
|
+
function Line() {
|
|
298
|
+
var _this;
|
|
299
|
+
|
|
300
|
+
_classCallCheck$2(this, Line);
|
|
301
|
+
|
|
302
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
303
|
+
args[_key] = arguments[_key];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
307
|
+
|
|
308
|
+
_defineProperty$3(_assertThisInitialized$2(_this), "paths", {});
|
|
309
|
+
|
|
310
|
+
return _this;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
_createClass$2(Line, [{
|
|
314
|
+
key: "render",
|
|
315
|
+
value: function render() {
|
|
316
|
+
var _this2 = this;
|
|
317
|
+
|
|
318
|
+
var _this$props = this.props,
|
|
319
|
+
className = _this$props.className,
|
|
320
|
+
percent = _this$props.percent,
|
|
321
|
+
prefixCls = _this$props.prefixCls,
|
|
322
|
+
strokeColor = _this$props.strokeColor,
|
|
323
|
+
strokeLinecap = _this$props.strokeLinecap,
|
|
324
|
+
strokeWidth = _this$props.strokeWidth,
|
|
325
|
+
style = _this$props.style,
|
|
326
|
+
trailColor = _this$props.trailColor,
|
|
327
|
+
trailWidth = _this$props.trailWidth,
|
|
328
|
+
transition = _this$props.transition,
|
|
329
|
+
restProps = _objectWithoutProperties$1(_this$props, ["className", "percent", "prefixCls", "strokeColor", "strokeLinecap", "strokeWidth", "style", "trailColor", "trailWidth", "transition"]);
|
|
330
|
+
|
|
331
|
+
delete restProps.gapPosition;
|
|
332
|
+
var percentList = Array.isArray(percent) ? percent : [percent];
|
|
333
|
+
var strokeColorList = Array.isArray(strokeColor) ? strokeColor : [strokeColor];
|
|
334
|
+
var center = strokeWidth / 2;
|
|
335
|
+
var right = 100 - strokeWidth / 2;
|
|
336
|
+
var pathString = "M ".concat(strokeLinecap === 'round' ? center : 0, ",").concat(center, "\n L ").concat(strokeLinecap === 'round' ? right : 100, ",").concat(center);
|
|
337
|
+
var viewBoxString = "0 0 100 ".concat(strokeWidth);
|
|
338
|
+
var stackPtg = 0;
|
|
339
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$2({
|
|
340
|
+
className: "".concat(prefixCls, "-line ").concat(className),
|
|
341
|
+
viewBox: viewBoxString,
|
|
342
|
+
preserveAspectRatio: "none",
|
|
343
|
+
style: style
|
|
344
|
+
}, restProps), /*#__PURE__*/React__default.createElement("path", {
|
|
345
|
+
className: "".concat(prefixCls, "-line-trail"),
|
|
346
|
+
d: pathString,
|
|
347
|
+
strokeLinecap: strokeLinecap,
|
|
348
|
+
stroke: trailColor,
|
|
349
|
+
strokeWidth: trailWidth || strokeWidth,
|
|
350
|
+
fillOpacity: "0"
|
|
351
|
+
}), percentList.map(function (ptg, index) {
|
|
352
|
+
var pathStyle = {
|
|
353
|
+
strokeDasharray: "".concat(ptg, "px, 100px"),
|
|
354
|
+
strokeDashoffset: "-".concat(stackPtg, "px"),
|
|
355
|
+
transition: transition || 'stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear'
|
|
356
|
+
};
|
|
357
|
+
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
|
|
358
|
+
stackPtg += ptg;
|
|
359
|
+
return /*#__PURE__*/React__default.createElement("path", {
|
|
360
|
+
key: index,
|
|
361
|
+
className: "".concat(prefixCls, "-line-path"),
|
|
362
|
+
d: pathString,
|
|
363
|
+
strokeLinecap: strokeLinecap,
|
|
364
|
+
stroke: color,
|
|
365
|
+
strokeWidth: strokeWidth,
|
|
366
|
+
fillOpacity: "0",
|
|
367
|
+
ref: function ref(path) {
|
|
368
|
+
_this2.paths[index] = path;
|
|
369
|
+
},
|
|
370
|
+
style: pathStyle
|
|
371
|
+
});
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
}]);
|
|
375
|
+
|
|
376
|
+
return Line;
|
|
377
|
+
}(Component);
|
|
378
|
+
|
|
379
|
+
Line.propTypes = propTypes;
|
|
380
|
+
Line.defaultProps = defaultProps;
|
|
381
|
+
|
|
382
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
383
|
+
|
|
384
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
385
|
+
|
|
386
|
+
function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
387
|
+
|
|
388
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
389
|
+
|
|
390
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
391
|
+
|
|
392
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
393
|
+
|
|
394
|
+
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
395
|
+
|
|
396
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
|
|
397
|
+
|
|
398
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$1(subClass, superClass); }
|
|
399
|
+
|
|
400
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
401
|
+
|
|
402
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function () { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
|
|
403
|
+
|
|
404
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
405
|
+
|
|
406
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
407
|
+
|
|
408
|
+
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
409
|
+
|
|
410
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
411
|
+
|
|
412
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
413
|
+
var gradientSeed = 0;
|
|
414
|
+
|
|
415
|
+
function stripPercentToNumber(percent) {
|
|
416
|
+
return +percent.replace('%', '');
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function toArray(symArray) {
|
|
420
|
+
return Array.isArray(symArray) ? symArray : [symArray];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function getPathStyles(offset, percent, strokeColor, strokeWidth) {
|
|
424
|
+
var gapDegree = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
425
|
+
var gapPosition = arguments.length > 5 ? arguments[5] : undefined;
|
|
426
|
+
var radius = 50 - strokeWidth / 2;
|
|
427
|
+
var beginPositionX = 0;
|
|
428
|
+
var beginPositionY = -radius;
|
|
429
|
+
var endPositionX = 0;
|
|
430
|
+
var endPositionY = -2 * radius;
|
|
431
|
+
|
|
432
|
+
switch (gapPosition) {
|
|
433
|
+
case 'left':
|
|
434
|
+
beginPositionX = -radius;
|
|
435
|
+
beginPositionY = 0;
|
|
436
|
+
endPositionX = 2 * radius;
|
|
437
|
+
endPositionY = 0;
|
|
438
|
+
break;
|
|
439
|
+
|
|
440
|
+
case 'right':
|
|
441
|
+
beginPositionX = radius;
|
|
442
|
+
beginPositionY = 0;
|
|
443
|
+
endPositionX = -2 * radius;
|
|
444
|
+
endPositionY = 0;
|
|
445
|
+
break;
|
|
446
|
+
|
|
447
|
+
case 'bottom':
|
|
448
|
+
beginPositionY = radius;
|
|
449
|
+
endPositionY = 2 * radius;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
var pathString = "M 50,50 m ".concat(beginPositionX, ",").concat(beginPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(endPositionX, ",").concat(-endPositionY, "\n a ").concat(radius, ",").concat(radius, " 0 1 1 ").concat(-endPositionX, ",").concat(endPositionY);
|
|
454
|
+
var len = Math.PI * 2 * radius;
|
|
455
|
+
var pathStyle = {
|
|
456
|
+
stroke: strokeColor,
|
|
457
|
+
strokeDasharray: "".concat(percent / 100 * (len - gapDegree), "px ").concat(len, "px"),
|
|
458
|
+
strokeDashoffset: "-".concat(gapDegree / 2 + offset / 100 * (len - gapDegree), "px"),
|
|
459
|
+
transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s' // eslint-disable-line
|
|
460
|
+
|
|
461
|
+
};
|
|
462
|
+
return {
|
|
463
|
+
pathString: pathString,
|
|
464
|
+
pathStyle: pathStyle
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
var Circle$1 = /*#__PURE__*/function (_Component) {
|
|
469
|
+
_inherits$1(Circle, _Component);
|
|
470
|
+
|
|
471
|
+
var _super = _createSuper$1(Circle);
|
|
472
|
+
|
|
473
|
+
function Circle() {
|
|
474
|
+
var _this;
|
|
475
|
+
|
|
476
|
+
_classCallCheck$1(this, Circle);
|
|
477
|
+
|
|
478
|
+
_this = _super.call(this);
|
|
479
|
+
|
|
480
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "paths", {});
|
|
481
|
+
|
|
482
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "gradientId", 0);
|
|
483
|
+
|
|
484
|
+
_this.gradientId = gradientSeed;
|
|
485
|
+
gradientSeed += 1;
|
|
486
|
+
return _this;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
_createClass$1(Circle, [{
|
|
490
|
+
key: "getStokeList",
|
|
491
|
+
value: function getStokeList() {
|
|
492
|
+
var _this2 = this;
|
|
493
|
+
|
|
494
|
+
var _this$props = this.props,
|
|
495
|
+
prefixCls = _this$props.prefixCls,
|
|
496
|
+
percent = _this$props.percent,
|
|
497
|
+
strokeColor = _this$props.strokeColor,
|
|
498
|
+
strokeWidth = _this$props.strokeWidth,
|
|
499
|
+
strokeLinecap = _this$props.strokeLinecap,
|
|
500
|
+
gapDegree = _this$props.gapDegree,
|
|
501
|
+
gapPosition = _this$props.gapPosition;
|
|
502
|
+
var percentList = toArray(percent);
|
|
503
|
+
var strokeColorList = toArray(strokeColor);
|
|
504
|
+
var stackPtg = 0;
|
|
505
|
+
return percentList.map(function (ptg, index) {
|
|
506
|
+
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
|
|
507
|
+
var stroke = Object.prototype.toString.call(color) === '[object Object]' ? "url(#".concat(prefixCls, "-gradient-").concat(_this2.gradientId, ")") : '';
|
|
508
|
+
|
|
509
|
+
var _getPathStyles = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition),
|
|
510
|
+
pathString = _getPathStyles.pathString,
|
|
511
|
+
pathStyle = _getPathStyles.pathStyle;
|
|
512
|
+
|
|
513
|
+
stackPtg += ptg;
|
|
514
|
+
return /*#__PURE__*/React__default.createElement("path", {
|
|
515
|
+
key: index,
|
|
516
|
+
className: "".concat(prefixCls, "-circle-path"),
|
|
517
|
+
d: pathString,
|
|
518
|
+
stroke: stroke,
|
|
519
|
+
strokeLinecap: strokeLinecap,
|
|
520
|
+
strokeWidth: strokeWidth,
|
|
521
|
+
opacity: ptg === 0 ? 0 : 1,
|
|
522
|
+
fillOpacity: "0",
|
|
523
|
+
style: pathStyle,
|
|
524
|
+
ref: function ref(path) {
|
|
525
|
+
_this2.paths[index] = path;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}, {
|
|
531
|
+
key: "render",
|
|
532
|
+
value: function render() {
|
|
533
|
+
var _this$props2 = this.props,
|
|
534
|
+
prefixCls = _this$props2.prefixCls,
|
|
535
|
+
strokeWidth = _this$props2.strokeWidth,
|
|
536
|
+
trailWidth = _this$props2.trailWidth,
|
|
537
|
+
gapDegree = _this$props2.gapDegree,
|
|
538
|
+
gapPosition = _this$props2.gapPosition,
|
|
539
|
+
trailColor = _this$props2.trailColor,
|
|
540
|
+
strokeLinecap = _this$props2.strokeLinecap,
|
|
541
|
+
style = _this$props2.style,
|
|
542
|
+
className = _this$props2.className,
|
|
543
|
+
strokeColor = _this$props2.strokeColor,
|
|
544
|
+
restProps = _objectWithoutProperties(_this$props2, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "style", "className", "strokeColor"]);
|
|
545
|
+
|
|
546
|
+
var _getPathStyles2 = getPathStyles(0, 100, trailColor, strokeWidth, gapDegree, gapPosition),
|
|
547
|
+
pathString = _getPathStyles2.pathString,
|
|
548
|
+
pathStyle = _getPathStyles2.pathStyle;
|
|
549
|
+
|
|
550
|
+
delete restProps.percent;
|
|
551
|
+
var strokeColorList = toArray(strokeColor);
|
|
552
|
+
var gradient = strokeColorList.find(function (color) {
|
|
553
|
+
return Object.prototype.toString.call(color) === '[object Object]';
|
|
554
|
+
});
|
|
555
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$1({
|
|
556
|
+
className: "".concat(prefixCls, "-circle ").concat(className),
|
|
557
|
+
viewBox: "0 0 100 100",
|
|
558
|
+
style: style
|
|
559
|
+
}, restProps), gradient && /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("linearGradient", {
|
|
560
|
+
id: "".concat(prefixCls, "-gradient-").concat(this.gradientId),
|
|
561
|
+
x1: "100%",
|
|
562
|
+
y1: "0%",
|
|
563
|
+
x2: "0%",
|
|
564
|
+
y2: "0%"
|
|
565
|
+
}, Object.keys(gradient).sort(function (a, b) {
|
|
566
|
+
return stripPercentToNumber(a) - stripPercentToNumber(b);
|
|
567
|
+
}).map(function (key, index) {
|
|
568
|
+
return /*#__PURE__*/React__default.createElement("stop", {
|
|
569
|
+
key: index,
|
|
570
|
+
offset: key,
|
|
571
|
+
stopColor: gradient[key]
|
|
572
|
+
});
|
|
573
|
+
}))), /*#__PURE__*/React__default.createElement("path", {
|
|
574
|
+
className: "".concat(prefixCls, "-circle-trail"),
|
|
575
|
+
d: pathString,
|
|
576
|
+
stroke: trailColor,
|
|
577
|
+
strokeLinecap: strokeLinecap,
|
|
578
|
+
strokeWidth: trailWidth || strokeWidth,
|
|
579
|
+
fillOpacity: "0",
|
|
580
|
+
style: pathStyle
|
|
581
|
+
}), this.getStokeList().reverse());
|
|
582
|
+
}
|
|
583
|
+
}]);
|
|
584
|
+
|
|
585
|
+
return Circle;
|
|
586
|
+
}(Component);
|
|
587
|
+
|
|
588
|
+
Circle$1.propTypes = _objectSpread(_objectSpread({}, propTypes), {}, {
|
|
589
|
+
gapPosition: PropTypes.oneOf(['top', 'bottom', 'left', 'right'])
|
|
590
|
+
});
|
|
591
|
+
Circle$1.defaultProps = _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
592
|
+
gapPosition: 'top'
|
|
593
|
+
});
|
|
594
|
+
var RCCircle = enhancer(Circle$1);
|
|
595
|
+
|
|
596
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
597
|
+
var statusColorMap = {
|
|
598
|
+
normal: '#108ee9',
|
|
599
|
+
exception: '#ff5500',
|
|
600
|
+
success: '#87d068'
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
function getPercentage(_ref) {
|
|
604
|
+
var percent = _ref.percent,
|
|
605
|
+
successPercent = _ref.successPercent;
|
|
606
|
+
var ptg = validProgress(percent);
|
|
607
|
+
|
|
608
|
+
if (!successPercent) {
|
|
609
|
+
return ptg;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
var successPtg = validProgress(successPercent);
|
|
613
|
+
return [successPercent, validProgress(ptg - successPtg)];
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function getStrokeColor(_ref2) {
|
|
617
|
+
var progressStatus = _ref2.progressStatus,
|
|
618
|
+
successPercent = _ref2.successPercent,
|
|
619
|
+
strokeColor = _ref2.strokeColor;
|
|
620
|
+
var color = strokeColor || statusColorMap[progressStatus];
|
|
621
|
+
|
|
622
|
+
if (!successPercent) {
|
|
623
|
+
return color;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return [statusColorMap.success, color];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
var Circle = function Circle(props) {
|
|
630
|
+
var prefixCls = props.prefixCls,
|
|
631
|
+
width = props.width,
|
|
632
|
+
strokeWidth = props.strokeWidth,
|
|
633
|
+
trailColor = props.trailColor,
|
|
634
|
+
strokeLinecap = props.strokeLinecap,
|
|
635
|
+
gapPosition = props.gapPosition,
|
|
636
|
+
gapDegree = props.gapDegree,
|
|
637
|
+
type = props.type,
|
|
638
|
+
children = props.children;
|
|
639
|
+
var circleSize = width || 120;
|
|
640
|
+
var circleStyle = {
|
|
641
|
+
width: circleSize,
|
|
642
|
+
height: circleSize,
|
|
643
|
+
fontSize: circleSize * 0.15 + 6
|
|
644
|
+
};
|
|
645
|
+
var circleWidth = strokeWidth || 6;
|
|
646
|
+
var gapPos = gapPosition || type === 'dashboard' && 'bottom' || 'top';
|
|
647
|
+
var gapDeg = gapDegree || (type === 'dashboard' ? 75 : undefined);
|
|
648
|
+
var strokeColor = getStrokeColor(props);
|
|
649
|
+
var isGradient = Object.prototype.toString.call(strokeColor) === '[object Object]';
|
|
650
|
+
var wrapperClassName = classNames("".concat(prefixCls, "-inner"), _defineProperty$1({}, "".concat(prefixCls, "-circle-gradient"), isGradient));
|
|
651
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
652
|
+
className: wrapperClassName,
|
|
653
|
+
style: circleStyle
|
|
654
|
+
}, /*#__PURE__*/React.createElement(RCCircle, {
|
|
655
|
+
percent: getPercentage(props),
|
|
656
|
+
strokeWidth: circleWidth,
|
|
657
|
+
trailWidth: circleWidth,
|
|
658
|
+
strokeColor: strokeColor,
|
|
659
|
+
strokeLinecap: strokeLinecap,
|
|
660
|
+
trailColor: trailColor,
|
|
661
|
+
prefixCls: prefixCls,
|
|
662
|
+
gapDegree: gapDeg,
|
|
663
|
+
gapPosition: gapPos
|
|
664
|
+
}), children);
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
668
|
+
|
|
669
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
670
|
+
|
|
671
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
672
|
+
|
|
673
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
674
|
+
|
|
675
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
676
|
+
|
|
677
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
|
|
678
|
+
|
|
679
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
680
|
+
|
|
681
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
682
|
+
|
|
683
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
684
|
+
|
|
685
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
686
|
+
|
|
687
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
688
|
+
|
|
689
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
690
|
+
|
|
691
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
692
|
+
|
|
693
|
+
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
694
|
+
var t = {};
|
|
695
|
+
|
|
696
|
+
for (var p in s) {
|
|
697
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
701
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
702
|
+
}
|
|
703
|
+
return t;
|
|
704
|
+
};
|
|
705
|
+
var ProgressTypes = tuple('line', 'circle', 'dashboard');
|
|
706
|
+
var ProgressStatuses = tuple('normal', 'exception', 'active', 'success');
|
|
707
|
+
|
|
708
|
+
var Progress = /*#__PURE__*/function (_React$Component) {
|
|
709
|
+
_inherits(Progress, _React$Component);
|
|
710
|
+
|
|
711
|
+
var _super = _createSuper(Progress);
|
|
712
|
+
|
|
713
|
+
function Progress() {
|
|
714
|
+
var _this;
|
|
715
|
+
|
|
716
|
+
_classCallCheck(this, Progress);
|
|
717
|
+
|
|
718
|
+
_this = _super.apply(this, arguments);
|
|
719
|
+
|
|
720
|
+
_this.renderProgress = function (_ref) {
|
|
721
|
+
var _classNames;
|
|
722
|
+
|
|
723
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
724
|
+
|
|
725
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
726
|
+
props = _assertThisInitialize.props;
|
|
727
|
+
|
|
728
|
+
var customizePrefixCls = props.prefixCls,
|
|
729
|
+
className = props.className,
|
|
730
|
+
size = props.size,
|
|
731
|
+
type = props.type,
|
|
732
|
+
showInfo = props.showInfo,
|
|
733
|
+
restProps = __rest(props, ["prefixCls", "className", "size", "type", "showInfo"]);
|
|
734
|
+
|
|
735
|
+
var prefixCls = getPrefixCls('progress', customizePrefixCls);
|
|
736
|
+
|
|
737
|
+
var progressStatus = _this.getProgressStatus();
|
|
738
|
+
|
|
739
|
+
var progressInfo = _this.renderProcessInfo(prefixCls, progressStatus);
|
|
740
|
+
|
|
741
|
+
var progress; // Render progress shape
|
|
742
|
+
|
|
743
|
+
if (type === 'line') {
|
|
744
|
+
progress = /*#__PURE__*/React.createElement(Line$1, _extends({}, _this.props, {
|
|
745
|
+
prefixCls: prefixCls
|
|
746
|
+
}), progressInfo);
|
|
747
|
+
} else if (type === 'circle' || type === 'dashboard') {
|
|
748
|
+
progress = /*#__PURE__*/React.createElement(Circle, _extends({}, _this.props, {
|
|
749
|
+
prefixCls: prefixCls,
|
|
750
|
+
progressStatus: progressStatus
|
|
751
|
+
}), progressInfo);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
var classString = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type === 'dashboard' && 'circle' || type), true), _defineProperty(_classNames, "".concat(prefixCls, "-status-").concat(progressStatus), true), _defineProperty(_classNames, "".concat(prefixCls, "-show-info"), showInfo), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(size), size), _classNames), className);
|
|
755
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, omit(restProps, ['status', 'format', 'trailColor', 'successPercent', 'strokeWidth', 'width', 'gapDegree', 'gapPosition', 'strokeColor', 'strokeLinecap', 'percent']), {
|
|
756
|
+
className: classString
|
|
757
|
+
}), progress);
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
return _this;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
_createClass(Progress, [{
|
|
764
|
+
key: "getPercentNumber",
|
|
765
|
+
value: function getPercentNumber() {
|
|
766
|
+
var _this$props = this.props,
|
|
767
|
+
successPercent = _this$props.successPercent,
|
|
768
|
+
_this$props$percent = _this$props.percent,
|
|
769
|
+
percent = _this$props$percent === void 0 ? 0 : _this$props$percent;
|
|
770
|
+
return parseInt(successPercent !== undefined ? successPercent.toString() : percent.toString(), 10);
|
|
771
|
+
}
|
|
772
|
+
}, {
|
|
773
|
+
key: "getProgressStatus",
|
|
774
|
+
value: function getProgressStatus() {
|
|
775
|
+
var status = this.props.status;
|
|
776
|
+
|
|
777
|
+
if (ProgressStatuses.indexOf(status) < 0 && this.getPercentNumber() >= 100) {
|
|
778
|
+
return 'success';
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
return status || 'normal';
|
|
782
|
+
}
|
|
783
|
+
}, {
|
|
784
|
+
key: "renderProcessInfo",
|
|
785
|
+
value: function renderProcessInfo(prefixCls, progressStatus) {
|
|
786
|
+
var _this$props2 = this.props,
|
|
787
|
+
showInfo = _this$props2.showInfo,
|
|
788
|
+
format = _this$props2.format,
|
|
789
|
+
type = _this$props2.type,
|
|
790
|
+
percent = _this$props2.percent,
|
|
791
|
+
successPercent = _this$props2.successPercent;
|
|
792
|
+
if (!showInfo) return null;
|
|
793
|
+
var text;
|
|
794
|
+
|
|
795
|
+
var textFormatter = format || function (percentNumber) {
|
|
796
|
+
return "".concat(percentNumber, "%");
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
var iconType = type === 'circle' || type === 'dashboard' ? '' : '-circle';
|
|
800
|
+
|
|
801
|
+
if (format || progressStatus !== 'exception' && progressStatus !== 'success') {
|
|
802
|
+
text = textFormatter(validProgress(percent), validProgress(successPercent));
|
|
803
|
+
} else if (progressStatus === 'exception') {
|
|
804
|
+
text = /*#__PURE__*/React.createElement(Icon, {
|
|
805
|
+
type: "close".concat(iconType),
|
|
806
|
+
theme: type === 'line' ? 'filled' : 'outlined'
|
|
807
|
+
});
|
|
808
|
+
} else if (progressStatus === 'success') {
|
|
809
|
+
text = /*#__PURE__*/React.createElement(Icon, {
|
|
810
|
+
type: "check".concat(iconType),
|
|
811
|
+
theme: type === 'line' ? 'filled' : 'outlined'
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
816
|
+
className: "".concat(prefixCls, "-text"),
|
|
817
|
+
title: typeof text === 'string' ? text : undefined
|
|
818
|
+
}, text);
|
|
819
|
+
}
|
|
820
|
+
}, {
|
|
821
|
+
key: "render",
|
|
822
|
+
value: function render() {
|
|
823
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderProgress);
|
|
824
|
+
}
|
|
825
|
+
}]);
|
|
826
|
+
|
|
827
|
+
return Progress;
|
|
828
|
+
}(React.Component);
|
|
829
|
+
Progress.defaultProps = {
|
|
830
|
+
type: 'line',
|
|
831
|
+
percent: 0,
|
|
832
|
+
showInfo: true,
|
|
833
|
+
trailColor: '#f3f3f3',
|
|
834
|
+
size: 'default',
|
|
835
|
+
gapDegree: 0,
|
|
836
|
+
strokeLinecap: 'round'
|
|
837
|
+
};
|
|
838
|
+
Progress.propTypes = {
|
|
839
|
+
status: propTypesExports.oneOf(ProgressStatuses),
|
|
840
|
+
type: propTypesExports.oneOf(ProgressTypes),
|
|
841
|
+
showInfo: propTypesExports.bool,
|
|
842
|
+
percent: propTypesExports.number,
|
|
843
|
+
width: propTypesExports.number,
|
|
844
|
+
strokeWidth: propTypesExports.number,
|
|
845
|
+
strokeLinecap: propTypesExports.oneOf(['round', 'square']),
|
|
846
|
+
strokeColor: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.object]),
|
|
847
|
+
trailColor: propTypesExports.string,
|
|
848
|
+
format: propTypesExports.func,
|
|
849
|
+
gapDegree: propTypesExports.number
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
export { Progress as P };
|