rc-progress
Advanced tools
Comparing version 2.5.1 to 2.5.2
@@ -1,3 +0,5 @@ | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
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; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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); } | ||
@@ -32,3 +34,12 @@ | ||
import { propTypes, defaultProps } from './types'; | ||
var gradientSeed = 0; | ||
function stripPercentToNumber(percent) { | ||
return +percent.replace('%', ''); | ||
} | ||
function toArray(symArray) { | ||
return Array.isArray(symArray) ? symArray : [symArray]; | ||
} | ||
function getPathStyles(offset, percent, strokeColor, strokeWidth) { | ||
@@ -87,4 +98,2 @@ var gapDegree = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; | ||
function Circle() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -94,10 +103,10 @@ | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Circle).call(this)); | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Circle)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "paths", {}); | ||
_defineProperty(_assertThisInitialized(_this), "gradientId", 0); | ||
_this.gradientId = gradientSeed; | ||
gradientSeed += 1; | ||
return _this; | ||
@@ -119,8 +128,8 @@ } | ||
gapPosition = _this$props.gapPosition; | ||
var percentList = Array.isArray(percent) ? percent : [percent]; | ||
var strokeColorList = Array.isArray(strokeColor) ? strokeColor : [strokeColor]; | ||
var stroke = Object.prototype.toString.call(strokeColor) === '[object Object]' ? 'url(#gradient)' : ''; | ||
var percentList = toArray(percent); | ||
var strokeColorList = toArray(strokeColor); | ||
var stackPtg = 0; | ||
return percentList.map(function (ptg, index) { | ||
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1]; | ||
var stroke = Object.prototype.toString.call(color) === '[object Object]' ? "url(#".concat(prefixCls, "-gradient-").concat(_this2.gradientId, ")") : ''; | ||
@@ -168,3 +177,6 @@ var _getPathStyles = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition), | ||
delete restProps.percent; | ||
var isGradient = Object.prototype.toString.call(strokeColor) === '[object Object]'; | ||
var strokeColorList = toArray(strokeColor); | ||
var gradient = strokeColorList.find(function (color) { | ||
return Object.prototype.toString.call(color) === '[object Object]'; | ||
}); | ||
return React.createElement("svg", _extends({ | ||
@@ -174,4 +186,4 @@ className: "".concat(prefixCls, "-circle ").concat(className), | ||
style: style | ||
}, restProps), isGradient && React.createElement("defs", null, React.createElement("linearGradient", { | ||
id: "gradient", | ||
}, restProps), gradient && React.createElement("defs", null, React.createElement("linearGradient", { | ||
id: "".concat(prefixCls, "-gradient-").concat(this.gradientId), | ||
x1: "100%", | ||
@@ -181,7 +193,9 @@ y1: "0%", | ||
y2: "0%" | ||
}, Object.keys(strokeColor).map(function (key, index) { | ||
}, Object.keys(gradient).sort(function (a, b) { | ||
return stripPercentToNumber(a) - stripPercentToNumber(b); | ||
}).map(function (key, index) { | ||
return React.createElement("stop", { | ||
key: index, | ||
offset: key, | ||
stopColor: strokeColor[key] | ||
stopColor: gradient[key] | ||
}); | ||
@@ -188,0 +202,0 @@ }))), React.createElement("path", { |
@@ -18,3 +18,3 @@ import PropTypes from 'prop-types'; | ||
prefixCls: PropTypes.string, | ||
strokeColor: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string), PropTypes.object]), | ||
strokeColor: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])), PropTypes.object]), | ||
strokeLinecap: PropTypes.oneOf(['butt', 'round', 'square']), | ||
@@ -21,0 +21,0 @@ strokeWidth: mixedType, |
@@ -20,4 +20,6 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
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; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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); } | ||
@@ -47,2 +49,12 @@ | ||
var gradientSeed = 0; | ||
function stripPercentToNumber(percent) { | ||
return +percent.replace('%', ''); | ||
} | ||
function toArray(symArray) { | ||
return Array.isArray(symArray) ? symArray : [symArray]; | ||
} | ||
function getPathStyles(offset, percent, strokeColor, strokeWidth) { | ||
@@ -101,4 +113,2 @@ var gapDegree = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; | ||
function Circle() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -108,10 +118,10 @@ | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Circle).call(this)); | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Circle)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "paths", {}); | ||
_defineProperty(_assertThisInitialized(_this), "gradientId", 0); | ||
_this.gradientId = gradientSeed; | ||
gradientSeed += 1; | ||
return _this; | ||
@@ -133,8 +143,8 @@ } | ||
gapPosition = _this$props.gapPosition; | ||
var percentList = Array.isArray(percent) ? percent : [percent]; | ||
var strokeColorList = Array.isArray(strokeColor) ? strokeColor : [strokeColor]; | ||
var stroke = Object.prototype.toString.call(strokeColor) === '[object Object]' ? 'url(#gradient)' : ''; | ||
var percentList = toArray(percent); | ||
var strokeColorList = toArray(strokeColor); | ||
var stackPtg = 0; | ||
return percentList.map(function (ptg, index) { | ||
var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1]; | ||
var stroke = Object.prototype.toString.call(color) === '[object Object]' ? "url(#".concat(prefixCls, "-gradient-").concat(_this2.gradientId, ")") : ''; | ||
@@ -182,3 +192,6 @@ var _getPathStyles = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition), | ||
delete restProps.percent; | ||
var isGradient = Object.prototype.toString.call(strokeColor) === '[object Object]'; | ||
var strokeColorList = toArray(strokeColor); | ||
var gradient = strokeColorList.find(function (color) { | ||
return Object.prototype.toString.call(color) === '[object Object]'; | ||
}); | ||
return _react["default"].createElement("svg", _extends({ | ||
@@ -188,4 +201,4 @@ className: "".concat(prefixCls, "-circle ").concat(className), | ||
style: style | ||
}, restProps), isGradient && _react["default"].createElement("defs", null, _react["default"].createElement("linearGradient", { | ||
id: "gradient", | ||
}, restProps), gradient && _react["default"].createElement("defs", null, _react["default"].createElement("linearGradient", { | ||
id: "".concat(prefixCls, "-gradient-").concat(this.gradientId), | ||
x1: "100%", | ||
@@ -195,7 +208,9 @@ y1: "0%", | ||
y2: "0%" | ||
}, Object.keys(strokeColor).map(function (key, index) { | ||
}, Object.keys(gradient).sort(function (a, b) { | ||
return stripPercentToNumber(a) - stripPercentToNumber(b); | ||
}).map(function (key, index) { | ||
return _react["default"].createElement("stop", { | ||
key: index, | ||
offset: key, | ||
stopColor: strokeColor[key] | ||
stopColor: gradient[key] | ||
}); | ||
@@ -202,0 +217,0 @@ }))), _react["default"].createElement("path", { |
@@ -31,3 +31,3 @@ "use strict"; | ||
prefixCls: _propTypes["default"].string, | ||
strokeColor: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].arrayOf(_propTypes["default"].string), _propTypes["default"].object]), | ||
strokeColor: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])), _propTypes["default"].object]), | ||
strokeLinecap: _propTypes["default"].oneOf(['butt', 'round', 'square']), | ||
@@ -34,0 +34,0 @@ strokeWidth: mixedType, |
{ | ||
"name": "rc-progress", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"description": "progress ui component for react", | ||
@@ -57,3 +57,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"lint-staged": "^8.1.0", | ||
"lint-staged": "^9.0.0", | ||
"pre-commit": "1.x", | ||
@@ -60,0 +60,0 @@ "rc-tools": "9.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318697
23
3458
1
9
3