@easyv/react-components 0.3.14 → 0.3.16
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* pures - 多纯色集合
|
|
7
7
|
*/
|
|
8
8
|
export declare type ColorType = 'pure' | 'linear' | 'pures' | 'range';
|
|
9
|
-
interface StopItem {
|
|
9
|
+
export interface StopItem {
|
|
10
10
|
/**
|
|
11
11
|
* 偏移量
|
|
12
12
|
* 0 - 100
|
|
@@ -58,4 +58,3 @@ export interface Color {
|
|
|
58
58
|
hsv: HSV;
|
|
59
59
|
alpha: number;
|
|
60
60
|
}
|
|
61
|
-
export {};
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { ColorValueMap } from './interface';
|
|
2
|
-
export declare function toHex(x:
|
|
1
|
+
import { ColorValueMap, StopItem } from './interface';
|
|
2
|
+
export declare function toHex(x: number | string): string;
|
|
3
3
|
export declare function resolveColor(colorParam: string): {
|
|
4
|
-
r
|
|
5
|
-
g
|
|
6
|
-
b
|
|
7
|
-
a
|
|
8
|
-
hex?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
r: any;
|
|
11
|
-
g: any;
|
|
12
|
-
b: any;
|
|
13
|
-
a: any;
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
a: number;
|
|
14
8
|
hex: string;
|
|
15
9
|
};
|
|
16
|
-
export declare function transformColor(color:
|
|
10
|
+
export declare function transformColor(color: string, a: number): string;
|
|
17
11
|
export declare function getBackgroundAccordingColor(color: any, fixedAngle?: number): {
|
|
18
12
|
backgroundImage: string;
|
|
19
13
|
background?: undefined;
|
|
@@ -21,7 +15,7 @@ export declare function getBackgroundAccordingColor(color: any, fixedAngle?: num
|
|
|
21
15
|
background: any;
|
|
22
16
|
backgroundImage?: undefined;
|
|
23
17
|
} | undefined;
|
|
24
|
-
export declare function getMiddleColor(colors:
|
|
18
|
+
export declare function getMiddleColor(colors: StopItem[], offset: number): any;
|
|
25
19
|
export declare function getHexValue(hex: string): string;
|
|
26
20
|
export declare function getLinearGradientStyle(color: ColorValueMap['linear']): {
|
|
27
21
|
backgroundImage: string;
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
import tinycolor from 'tinycolor2';
|
|
3
3
|
export function toHex(x) {
|
|
4
|
-
return ('0' + parseInt(x).toString(16)).slice(-2);
|
|
4
|
+
return ('0' + parseInt(x + '').toString(16)).slice(-2);
|
|
5
5
|
}
|
|
6
6
|
export function resolveColor(colorParam) {
|
|
7
7
|
if (!colorParam || typeof colorParam !== 'string') {
|
|
8
|
-
return {
|
|
8
|
+
return {
|
|
9
|
+
r: 255,
|
|
10
|
+
g: 255,
|
|
11
|
+
b: 255,
|
|
12
|
+
a: 1,
|
|
13
|
+
hex: '#ffffff'
|
|
14
|
+
};
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
// 转为小写并去除空格
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// const rgbReg1 = /^(rgb\(\d+,\d+,\d+\)|rgba\((\d+)?(\.)?(\d+)?,(\d+)?(\.)?(\d+)?,(\d+)?(\.)?(\d+)?,(\d+)?(\.)?(\d+)?\))$/;
|
|
18
|
+
// const color = colorParam.toLowerCase().replace(/\s+/g, '');
|
|
19
|
+
// const hexReg = /^#([0-9|a-f]{3}|[0-9|a-f]{6})$/;
|
|
20
|
+
// const rgbReg = /^(rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,(\d+)?(\.)?(\d+)?\))$/;
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
if (hexReg.test(color)) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} else if (rgbReg.test(color)) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
|
-
|
|
37
|
-
}
|
|
22
|
+
// let r, g, b, a;
|
|
23
|
+
// if (hexReg.test(color)) {
|
|
24
|
+
// if (color.length === 4) {
|
|
25
|
+
// r = parseInt(color.slice(1, 2) + color.slice(1, 2), 16);
|
|
26
|
+
// g = parseInt(color.slice(2, 3) + color.slice(2, 3), 16);
|
|
27
|
+
// b = parseInt(color.slice(3, 4) + color.slice(3, 4), 16);
|
|
28
|
+
// } else {
|
|
29
|
+
// r = parseInt(color.slice(1, 3), 16);
|
|
30
|
+
// g = parseInt(color.slice(3, 5), 16);
|
|
31
|
+
// b = parseInt(color.slice(5, 7), 16);
|
|
32
|
+
// }
|
|
33
|
+
// a = 1;
|
|
34
|
+
// } else if (rgbReg.test(color)) {
|
|
35
|
+
// let colors = color.replace(/rgba|rgb|\(|\)/g, '').split(',');
|
|
36
|
+
// r = Number(colors[0]);
|
|
37
|
+
// g = Number(colors[1]);
|
|
38
|
+
// b = Number(colors[2]);
|
|
39
|
+
// a = colors.length === 4 ? Number(colors[3]) : 1;
|
|
40
|
+
// } else {
|
|
41
|
+
// return {};
|
|
42
|
+
// }
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
var _tinycolor$toRgb = tinycolor(colorParam).toRgb(),
|
|
45
|
+
r = _tinycolor$toRgb.r,
|
|
46
|
+
g = _tinycolor$toRgb.g,
|
|
47
|
+
b = _tinycolor$toRgb.b,
|
|
48
|
+
a = _tinycolor$toRgb.a;
|
|
40
49
|
return {
|
|
41
50
|
r: r,
|
|
42
51
|
g: g,
|
|
@@ -179,9 +188,6 @@ export function getMiddleColor(colors, offset) {
|
|
|
179
188
|
if (!rightColor) {
|
|
180
189
|
return leftColor.color;
|
|
181
190
|
}
|
|
182
|
-
|
|
183
|
-
// console.log(leftColor, rightColor, leftColors, rightColors, '计算color');
|
|
184
|
-
|
|
185
191
|
var _resolveColor6 = resolveColor(leftColor.color),
|
|
186
192
|
leftR = _resolveColor6.r,
|
|
187
193
|
leftG = _resolveColor6.g,
|
|
@@ -192,9 +198,6 @@ export function getMiddleColor(colors, offset) {
|
|
|
192
198
|
rightG = _resolveColor7.g,
|
|
193
199
|
rightB = _resolveColor7.b,
|
|
194
200
|
rightA = _resolveColor7.a;
|
|
195
|
-
|
|
196
|
-
// console.log(resolveColor(leftColor.color), resolveColor(rightColor.color), '计算color');
|
|
197
|
-
|
|
198
201
|
var newR = Math.round((rightR - leftR) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftR);
|
|
199
202
|
var newG = Math.round((rightG - leftG) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftG);
|
|
200
203
|
var newB = Math.round((rightB - leftB) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftB);
|
package/dist/Slider/index.less
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.arco-slider {
|
|
2
|
+
.arco-slider-road.arco-slider-road-disabled {
|
|
3
|
+
.arco-slider-bar {
|
|
4
|
+
background-color: rgb(var(--primary-3));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.arco-slider-button::after {
|
|
8
|
+
border-color: rgb(var(--primary-3));
|
|
9
|
+
background-color: var(--color-text-4);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|