12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- module.exports = {
- getText: function (texts, val, defaultTexts) {
- if (!texts.length) {
- texts = defaultTexts;
- }
- var curVal = Math.floor(val - 1);
- return texts[curVal];
- },
- getIconName: function (defaultValue, value, index, allowHalf, icon, halfIcon, variant) {
- var curVal = value ? value : defaultValue;
- if (curVal - index >= 1) {
- return icon;
- } else if (allowHalf && curVal - index > 0) {
- return halfIcon;
- } else {
- return variant === 'outline' ? 'star' : 'star-filled';
- }
- },
- getIconColor: function (defaultValue, value, index, allowHalf, disabled, color, disabledColor) {
- var curVal = value ? value : defaultValue;
- var colorList = color.split(',');
- var primaryColor = colorList[0] || color;
- var defaultColor = colorList[1] || '#E3E6EB';
- if (curVal - index >= 1) {
- return disabled ? disabledColor : primaryColor;
- } else if (allowHalf && curVal - index > 0) {
- return 'transparent';
- } else {
- return defaultColor;
- }
- },
- getBackgroundColor: function (disabled, color, disabledColor) {
- var colorList = color.split(',');
- var primaryColor = colorList[0] || color;
- var defaultColor = colorList[1] || '#E3E6EB';
- var linearColor = disabled ? disabledColor : primaryColor;
- return (
- 'background:linear-gradient(to right, ' +
- linearColor +
- ' 0%,' +
- linearColor +
- ' 50%, ' +
- defaultColor +
- ' 51%, ' +
- defaultColor +
- ' 100%);-webkit-background-clip:text;background-clip:text;'
- );
- },
- };
|