@ray-js/lamp-saturation-slider 1.1.4-beta-3 → 1.1.4-beta-5

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 CHANGED
@@ -7,6 +7,7 @@ import { toStyle } from '@ray-js/components-ty-slider';
7
7
  import { hsvToRgb } from './utils';
8
8
  import { defaultProps } from './props';
9
9
  function LampSaturationSlider(props) {
10
+ var _trackStyle$width, _trackStyle$height;
10
11
  const preSaturation = useRef(-1);
11
12
  const lastSaturation = useRef(null);
12
13
  const timer = useRef(null);
@@ -24,7 +25,7 @@ function LampSaturationSlider(props) {
24
25
  } = props;
25
26
  const startRefValue = useRef(-1);
26
27
  const endRefValue = useRef(-1);
27
- const instanceId = useRef(`Color_${String(+new Date()).slice(-4)}_${String(Math.random()).slice(-2)}`);
28
+ const instanceId = useRef(`Color_${String(+new Date()).slice(-4)}_${String(Math.random()).slice(-10)}`);
28
29
  const [controllerSaturation, setControllerSaturation] = useState(-1);
29
30
  useEffect(() => {
30
31
  if (preSaturation.current !== saturation) {
@@ -40,16 +41,14 @@ function LampSaturationSlider(props) {
40
41
  style: {
41
42
  position: 'relative',
42
43
  background: '#fff',
43
- width: `${646}rpx`,
44
- height: `${88}rpx`,
44
+ width: typeof (trackStyle === null || trackStyle === void 0 ? void 0 : trackStyle.width) === 'number' ? trackStyle.width * 2 : (_trackStyle$width = trackStyle.width) !== null && _trackStyle$width !== void 0 ? _trackStyle$width : `${646}rpx`,
45
+ height: typeof (trackStyle === null || trackStyle === void 0 ? void 0 : trackStyle.height) === 'number' ? trackStyle.height * 2 : (_trackStyle$height = trackStyle.height) !== null && _trackStyle$height !== void 0 ? _trackStyle$height : `${88}rpx`,
45
46
  borderRadius: `${28}rpx`
46
47
  }
47
48
  }, /*#__PURE__*/React.createElement(Slider, {
48
- instanceId: instanceId.current,
49
- hue: hue,
49
+ instanceId: props.instanceId || instanceId.current,
50
50
  min: 0,
51
51
  max: 1000,
52
- closed: closed,
53
52
  disable: disable,
54
53
  end: controllerSaturation,
55
54
  step: 1,
@@ -128,7 +127,13 @@ function LampSaturationSlider(props) {
128
127
  border: `9rpx solid #fff`,
129
128
  borderRadius: '28rpx',
130
129
  background: `${disable ? '#000' : 'transparent'}`
131
- }, thumbStyle))
130
+ }, thumbStyle)),
131
+ thumbStyleRenderFormatter: {
132
+ background: `hsl(${props.hue}deg 100% value%)`
133
+ },
134
+ thumbStyleRenderValueScale: 0.05,
135
+ thumbStyleRenderValueStart: 50,
136
+ thumbStyleRenderValueReverse: true
132
137
  }));
133
138
  }
134
139
  LampSaturationSlider.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 禁止滑动
5
10
  * @description.en Ban sliding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-saturation-slider",
3
- "version": "1.1.4-beta-3",
3
+ "version": "1.1.4-beta-5",
4
4
  "description": "照明色温Slider",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -24,12 +24,15 @@
24
24
  "release-it": "standard-version",
25
25
  "copy": "sh copy.sh"
26
26
  },
27
- "peerDependencies": {},
27
+ "peerDependencies": {
28
+ "@ray-js/panel-sdk": "^1.1.4"
29
+ },
28
30
  "devDependencies": {
29
31
  "@commitlint/cli": "^7.2.1",
30
32
  "@commitlint/config-conventional": "^9.0.1",
31
33
  "@ray-js/babel-preset-standard": "^0.6.14",
32
34
  "@ray-js/cli": "^1.4.9",
35
+ "@ray-js/panel-sdk": "^1.1.4",
33
36
  "@ray-js/ray": "^1.4.9",
34
37
  "@ray-js/rn-transformer-helper": "^0.5.5",
35
38
  "@ray-js/types": "^0.6.14",
@@ -57,8 +60,7 @@
57
60
  ]
58
61
  },
59
62
  "dependencies": {
60
- "@ray-js/components-ty-slider": "0.2.36-beta-3",
61
- "@ray-js/panel-sdk": "^1.1.4"
63
+ "@ray-js/components-ty-slider": "~0.2.36-beta-7"
62
64
  },
63
65
  "maintainers": [
64
66
  {