390 lines
13 KiB
JavaScript

(window.webpackJsonp = window.webpackJsonp || []).push([
[14],
{
'1Ywk': function(m, h, o) {
'use strict';
o('9d8Q'), o('NtQs');
},
'9d8Q': function(m, h, o) {},
HasT: function(m, h, o) {
'use strict';
o('1Ywk'), o('VRoH');
},
NtQs: function(m, h, o) {},
VRoH: function(m, h, o) {},
'v+0w': function(m, h, o) {
'use strict';
Object.defineProperty(h, '__esModule', { value: !0 }), (h.default = void 0);
var c = j(o('q1tI')),
q = Q(o('TSYQ'));
function Q(e) {
return e && e.__esModule ? e : { default: e };
}
function x() {
if (typeof WeakMap != 'function') return null;
var e = new WeakMap();
return (
(x = function() {
return e;
}),
e
);
}
function j(e) {
if (e && e.__esModule) return e;
if (e === null || (y(e) !== 'object' && typeof e != 'function')) return { default: e };
var t = x();
if (t && t.has(e)) return t.get(e);
var r = {},
n = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var i in e)
if (Object.prototype.hasOwnProperty.call(e, i)) {
var a = n ? Object.getOwnPropertyDescriptor(e, i) : null;
a && (a.get || a.set) ? Object.defineProperty(r, i, a) : (r[i] = e[i]);
}
return (r.default = e), t && t.set(e, r), r;
}
function y(e) {
return (
typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol'
? (y = function(r) {
return typeof r;
})
: (y = function(r) {
return r &&
typeof Symbol == 'function' &&
r.constructor === Symbol &&
r !== Symbol.prototype
? 'symbol'
: typeof r;
}),
y(e)
);
}
function E(e, t) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
t &&
(n = n.filter(function(i) {
return Object.getOwnPropertyDescriptor(e, i).enumerable;
})),
r.push.apply(r, n);
}
return r;
}
function H(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t] != null ? arguments[t] : {};
t % 2
? E(Object(r), !0).forEach(function(n) {
k(e, n, r[n]);
})
: Object.getOwnPropertyDescriptors
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r))
: E(Object(r)).forEach(function(n) {
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return e;
}
function k(e, t, r) {
return (
t in e
? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (e[t] = r),
e
);
}
function L(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function');
}
function D(e, t) {
for (var r = 0; r < t.length; r++) {
var n = t[r];
(n.enumerable = n.enumerable || !1),
(n.configurable = !0),
'value' in n && (n.writable = !0),
Object.defineProperty(e, n.key, n);
}
}
function U(e, t, r) {
return t && D(e.prototype, t), r && D(e, r), e;
}
function Y(e, t) {
return t && (y(t) === 'object' || typeof t == 'function') ? t : $(e);
}
function $(e) {
if (e === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function b(e) {
return (
(b = Object.setPrototypeOf
? Object.getPrototypeOf
: function(r) {
return r.__proto__ || Object.getPrototypeOf(r);
}),
b(e)
);
}
function B(e, t) {
if (typeof t != 'function' && t !== null)
throw new TypeError('Super expression must either be null or a function');
(e.prototype = Object.create(t && t.prototype, {
constructor: { value: e, writable: !0, configurable: !0 },
})),
t && w(e, t);
}
function w(e, t) {
return (
(w =
Object.setPrototypeOf ||
function(n, i) {
return (n.__proto__ = i), n;
}),
w(e, t)
);
}
var P = (function(e) {
B(t, e);
function t(r) {
var n;
return (
L(this, t),
(n = Y(this, b(t).call(this, r))),
(n.progressElement = void 0),
(n.state = { svgStrokeWidth: n.strokeWidth }),
n
);
}
return (
U(t, [
{
key: 'componentDidMount',
value: function() {
this.useSVG && this.resetSVGStrokeWidth();
},
},
{
key: 'componentDidUpdate',
value: function(n) {
var i = this.props;
n.strokeWidth !== i.strokeWidth && this.resetSVGStrokeWidth();
},
},
{
key: 'resetSVGStrokeWidth',
value: function() {
var n = 32,
i = this.progressElement.clientWidth;
this.setState({ svgStrokeWidth: (n / i) * this.strokeWidth });
},
},
{
key: 'render',
value: function() {
var n,
i = this,
a = this.props,
v = a.theme,
_ = a.percent,
R = a.strokeShape,
s = a.shape,
l = a.size,
C = a.style,
u = a.prefixCls,
F = a.className,
S = a.children,
M = a.text,
J = this.state,
p = this.useSVG ? J.svgStrokeWidth : this.strokeWidth,
N = l && l in t.strokeWeights,
K = (0, q.default)(
u,
F,
((n = {}),
k(n, ''.concat(u, '--').concat(s), !!s),
k(n, ''.concat(u, '--').concat(v), !!v),
k(n, ''.concat(u, '--').concat(l), N),
n),
),
g = {};
N ||
((g.width = l),
s === 'circle' && (g.height = l),
s === 'semi-circle' &&
(typeof l == 'number'
? (g.height = ''.concat(l / 2, 'px'))
: typeof l == 'string' &&
(g.height = l.replace(/^(\d+)(.+)$/, function() {
return (
parseFloat(arguments.length <= 1 ? void 0 : arguments[1]) / 2 +
(arguments.length <= 2 ? void 0 : arguments[2])
);
}))));
var f = 32,
d = f / 2,
O = d + p / 2,
z = R === 'round' ? 'round' : 'butt',
A =
s === 'circle'
? '0 0 '.concat(f + p, ' ').concat(f + p)
: '0 0 '.concat(f + p, ' ').concat((f + p) / 2),
V =
s === 'circle'
? `
M`
.concat(O, ', ')
.concat(
O,
`
m0 `,
)
.concat(
-d,
`
a`,
)
.concat(d, ' ')
.concat(d, ' 0 1 1 0 ')
.concat(
f,
`
a`,
)
.concat(d, ' ')
.concat(d, ' 0 1 1 0 ')
.concat(-f)
: `
M`
.concat(O, ', ')
.concat(
O,
`
m`,
)
.concat(
-d,
` 0
a`,
)
.concat(d, ' ')
.concat(d, ' 0 0 1 ')
.concat(f, ' 0'),
G = s === 'circle' ? Math.PI * f : (Math.PI * f) / 2,
I = R === 'round' ? ''.concat(this.strokeWidth, 'px') : '0',
X = { height: ''.concat(p), borderRadius: I },
Z = { width: ''.concat(_, '%'), height: ''.concat(p, 'px'), borderRadius: I },
W = M ? M(_ || 0) : null,
T = S || W,
ee =
(s === 'circle' || s === 'semi-circle') &&
c.default.createElement(
c.default.Fragment,
null,
c.default.createElement(
'svg',
{ viewBox: A },
c.default.createElement('path', {
className: ''.concat(u, '__track'),
d: V,
strokeWidth: p,
strokeLinecap: z,
}),
c.default.createElement('path', {
className: ''.concat(u, '__thumb'),
d: V,
strokeWidth: p,
strokeLinecap: z,
strokeDasharray: G,
strokeDashoffset: (G * (100 - _)) / 100,
}),
),
T &&
c.default.createElement(
'div',
{ className: ''.concat(u, '__text') },
S || W,
),
),
te =
s === 'line' &&
c.default.createElement(
'div',
{ className: ''.concat(u, '__outer') },
c.default.createElement(
'div',
{ className: ''.concat(u, '__track'), style: X },
c.default.createElement('div', {
className: ''.concat(u, '__thumb'),
style: Z,
}),
),
T &&
c.default.createElement(
'div',
{ className: ''.concat(u, '__text') },
S || W,
),
);
return c.default.createElement(
'div',
{
className: K,
style: H({}, g, {}, C),
ref: function(re) {
i.progressElement = re;
},
},
s === 'line' ? te : ee,
);
},
},
{
key: 'useSVG',
get: function() {
var n = this.props;
return n.shape === 'semi-circle' || n.shape === 'circle';
},
},
{
key: 'strokeWidth',
get: function() {
var n = this.props,
i = n.strokeWidth,
a = n.size,
v = t.strokeWeights,
_ = v[a && a in v ? a : 'md'];
return Math.max(1, i || _);
},
},
]),
t
);
})(c.PureComponent);
(h.default = P),
(P.defaultProps = {
prefixCls: 'za-progress',
theme: 'primary',
shape: 'line',
size: 'md',
percent: 0,
strokeShape: 'round',
text: function(t) {
return ''.concat(t, '%');
},
}),
(P.strokeWeights = { lg: 10, md: 8, sm: 4 });
},
},
]);
//# sourceMappingURL=14.js.map