@ray-js/lamp-style-slider 0.0.3-beta-5 → 0.0.3-beta-7
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/lib/index.js +8 -3
- package/lib/props.d.ts +14 -0
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { formatPercent } from './utils';
|
|
|
9
9
|
import styles from './index.module.less';
|
|
10
10
|
import { defaultProps } from './props';
|
|
11
11
|
function OpacitySlider(props) {
|
|
12
|
+
var _props$thumbColorForm, _props$thumbColorForm2;
|
|
12
13
|
const preValue = useRef(-1);
|
|
13
14
|
const lastValue = useRef(null);
|
|
14
15
|
const timer = useRef(null);
|
|
@@ -62,7 +63,7 @@ function OpacitySlider(props) {
|
|
|
62
63
|
wait: 80
|
|
63
64
|
}).run;
|
|
64
65
|
const endRefValue = useRef(-1);
|
|
65
|
-
const instanceId = useRef(`Color_${String(+new Date()).slice(-4)}_${String(Math.random()).slice(-
|
|
66
|
+
const instanceId = useRef(`Color_${String(+new Date()).slice(-4)}_${String(Math.random()).slice(-10)}`);
|
|
66
67
|
const [controllerValue, setControllerValue] = useState(-1);
|
|
67
68
|
useEffect(() => {
|
|
68
69
|
if (!isMove.current && value !== controllerValue) {
|
|
@@ -102,7 +103,7 @@ function OpacitySlider(props) {
|
|
|
102
103
|
borderRadius: '28rpx'
|
|
103
104
|
}, trackStyle)
|
|
104
105
|
}, /*#__PURE__*/React.createElement(Slider, {
|
|
105
|
-
instanceId: instanceId.current,
|
|
106
|
+
instanceId: props.instanceId || instanceId.current,
|
|
106
107
|
min: 0,
|
|
107
108
|
max: max - min,
|
|
108
109
|
disable: disable,
|
|
@@ -158,7 +159,11 @@ function OpacitySlider(props) {
|
|
|
158
159
|
borderRadius: '50%',
|
|
159
160
|
boxShadow: 'rgb(255 255 255 / 10%) 0px 0px 1px',
|
|
160
161
|
background: `${disable ? '#000' : 'transparent'}`
|
|
161
|
-
}, thumbStyle))
|
|
162
|
+
}, thumbStyle)),
|
|
163
|
+
thumbStyleRenderFormatter: {
|
|
164
|
+
background: props === null || props === void 0 ? void 0 : (_props$thumbColorForm = props.thumbColorFormatterConfig) === null || _props$thumbColorForm === void 0 ? void 0 : _props$thumbColorForm.formatter
|
|
165
|
+
},
|
|
166
|
+
thumbStyleRenderValueScale: props === null || props === void 0 ? void 0 : (_props$thumbColorForm2 = props.thumbColorFormatterConfig) === null || _props$thumbColorForm2 === void 0 ? void 0 : _props$thumbColorForm2.scale
|
|
162
167
|
})));
|
|
163
168
|
}
|
|
164
169
|
OpacitySlider.defaultProps = defaultProps;
|
package/lib/props.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface IProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description.en instanceId
|
|
5
|
+
* @description.zh 实例id
|
|
6
|
+
*/
|
|
7
|
+
instanceId?: string;
|
|
3
8
|
/**
|
|
4
9
|
* @description.zh value文字样式
|
|
5
10
|
* @description.en Value style
|
|
@@ -95,5 +100,14 @@ export interface IProps {
|
|
|
95
100
|
* @default () => {}
|
|
96
101
|
*/
|
|
97
102
|
onTouchEnd?: (value: number) => void;
|
|
103
|
+
/**
|
|
104
|
+
* @description.en style
|
|
105
|
+
* @description.zh 按钮hsv背景渲染,例如 "hsl(valuedeg 100% 50%)"
|
|
106
|
+
* @default null
|
|
107
|
+
*/
|
|
108
|
+
thumbColorFormatterConfig?: {
|
|
109
|
+
formatter: string;
|
|
110
|
+
scale?: number;
|
|
111
|
+
};
|
|
98
112
|
}
|
|
99
113
|
export declare const defaultProps: IProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/lamp-style-slider",
|
|
3
|
-
"version": "0.0.3-beta-
|
|
3
|
+
"version": "0.0.3-beta-7",
|
|
4
4
|
"description": "照明样式的基础滑动条",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@commitlint/cli": "^7.2.1",
|
|
32
32
|
"@commitlint/config-conventional": "^9.0.1",
|
|
33
33
|
"@ray-js/babel-preset-standard": "^0.6.14",
|
|
34
|
-
"@ray-js/panel-sdk": "^1.1.4",
|
|
35
34
|
"@ray-js/cli": "^1.4.9",
|
|
35
|
+
"@ray-js/panel-sdk": "^1.1.4",
|
|
36
36
|
"@ray-js/ray": "^1.4.9",
|
|
37
37
|
"@ray-js/rn-transformer-helper": "^0.5.5",
|
|
38
38
|
"@types/node": "^17.0.43",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@ray-js/components-ty-slider": "0.2.36-beta-
|
|
62
|
+
"@ray-js/components-ty-slider": "0.2.36-beta-6"
|
|
63
63
|
},
|
|
64
64
|
"maintainers": [
|
|
65
65
|
{
|