@ray-js/lamp-saturation-slider 1.1.0 → 1.1.1-beta-1
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/README.md +3 -8
- package/lib/components/slider/index.sjs +3 -3
- package/lib/index.js +6 -6
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@ English | [简体中文](./README-zh_CN.md)
|
|
|
2
2
|
|
|
3
3
|
# @ray-js/lamp-saturation-slider
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> 照明彩光 Slider
|
|
5
|
+
> Lamp saturation Slider
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
@@ -72,13 +70,13 @@ export const defaultProps: IProps = {
|
|
|
72
70
|
```
|
|
73
71
|
|
|
74
72
|
```tsx
|
|
75
|
-
import LampSaturationSlider from '@ray-js/components-ty-lamp';
|
|
73
|
+
import { LampSaturationSlider } from '@ray-js/components-ty-lamp';
|
|
76
74
|
|
|
77
75
|
export default () => {
|
|
78
76
|
const [hue, setHue] = useState(100);
|
|
79
77
|
|
|
80
78
|
useEffect(() => {
|
|
81
|
-
//
|
|
79
|
+
// Simulation of dp report
|
|
82
80
|
setTimeout(() => {
|
|
83
81
|
setHue(321);
|
|
84
82
|
}, 3000);
|
|
@@ -88,9 +86,6 @@ export default () => {
|
|
|
88
86
|
<LampSaturationSlider
|
|
89
87
|
value={hue}
|
|
90
88
|
disable
|
|
91
|
-
onTouchMove={val => {
|
|
92
|
-
setHue(val);
|
|
93
|
-
}}
|
|
94
89
|
onTouchEnd={val => {
|
|
95
90
|
setHue(val);
|
|
96
91
|
}}
|
|
@@ -738,7 +738,7 @@ const onChange = (ownerInstance, instanceId, position) => {
|
|
|
738
738
|
});
|
|
739
739
|
|
|
740
740
|
// publish
|
|
741
|
-
ownerInstance.triggerEvent('
|
|
741
|
+
ownerInstance.triggerEvent('move', {
|
|
742
742
|
instanceId,
|
|
743
743
|
start: nextStart,
|
|
744
744
|
end: nextEnd,
|
|
@@ -768,7 +768,7 @@ const onEnd = (event, ownerInstance, instanceId) => {
|
|
|
768
768
|
});
|
|
769
769
|
|
|
770
770
|
// publish
|
|
771
|
-
ownerInstance.triggerEvent('
|
|
771
|
+
ownerInstance.triggerEvent('end', {
|
|
772
772
|
instanceId,
|
|
773
773
|
start: nextStart,
|
|
774
774
|
end: nextEnd,
|
|
@@ -794,7 +794,7 @@ const onStart = (event, ownerInstance, instanceId) => {
|
|
|
794
794
|
});
|
|
795
795
|
|
|
796
796
|
// publish
|
|
797
|
-
ownerInstance.triggerEvent('
|
|
797
|
+
ownerInstance.triggerEvent('start', {
|
|
798
798
|
instanceId,
|
|
799
799
|
start: nextStart,
|
|
800
800
|
end: nextEnd,
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,8 @@ function SaturationSlider(props) {
|
|
|
23
23
|
onTouchStart = props.onTouchStart,
|
|
24
24
|
onTouchMove = props.onTouchMove,
|
|
25
25
|
onTouchEnd = props.onTouchEnd;
|
|
26
|
+
var startRefValue = useRef(-1);
|
|
27
|
+
var endRefValue = useRef(-1);
|
|
26
28
|
var instanceId = useRef("Color_".concat(String(+new Date()).slice(-4), "_").concat(String(Math.random()).slice(-2)));
|
|
27
29
|
var _useState = useState(-1),
|
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -52,19 +54,17 @@ function SaturationSlider(props) {
|
|
|
52
54
|
disable: disable,
|
|
53
55
|
end: controllerSaturation,
|
|
54
56
|
step: 1,
|
|
55
|
-
enableTouch: true,
|
|
56
57
|
maxRangeOffset: 16,
|
|
57
58
|
bindstart: function handleTouchStart(_ref) {
|
|
58
59
|
var detail = _ref.detail;
|
|
59
60
|
if (!onTouchStart || disable) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
if (detail.end === lastSaturation.current) {
|
|
63
|
+
if (detail.end === startRefValue.current) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
onTouchStart && onTouchStart(detail.end);
|
|
67
|
-
|
|
67
|
+
startRefValue.current = detail.end;
|
|
68
68
|
},
|
|
69
69
|
bindmove: function handTouchMove(_ref2) {
|
|
70
70
|
var detail = _ref2.detail;
|
|
@@ -99,11 +99,11 @@ function SaturationSlider(props) {
|
|
|
99
99
|
if (!onTouchEnd || disable) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
if (detail.end ===
|
|
102
|
+
if (detail.end === endRefValue.current) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
onTouchEnd && onTouchEnd(detail.end);
|
|
106
|
-
|
|
106
|
+
endRefValue.current = detail.end;
|
|
107
107
|
},
|
|
108
108
|
trackStyle: _objectSpread(_objectSpread({
|
|
109
109
|
width: "".concat(646, "rpx"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/lamp-saturation-slider",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1-beta-1",
|
|
4
4
|
"description": "照明色温Slider",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"start:wechat": "ray start ./example -t wechat --verbose",
|
|
29
29
|
"start:web": "ray start ./example -t web",
|
|
30
30
|
"prepublishOnly": "yarn build",
|
|
31
|
-
"release-it": "standard-version"
|
|
31
|
+
"release-it": "standard-version",
|
|
32
|
+
"copy": "sh copy.sh"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {},
|
|
34
35
|
"devDependencies": {
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"husky": {
|
|
51
52
|
"hooks": {
|
|
52
53
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js",
|
|
53
|
-
"pre-commit": "lint-staged"
|
|
54
|
+
"pre-commit": "lint-staged && npm run copy"
|
|
54
55
|
}
|
|
55
56
|
},
|
|
56
57
|
"lint-staged": {
|