@ray-js/lamp-circle-picker 1.0.0 → 1.0.2-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 CHANGED
@@ -6,6 +6,10 @@ English | [简体中文](./README-zh_CN.md)
6
6
 
7
7
  > LampCirclePicker
8
8
 
9
+ ## Preview
10
+
11
+ ![avatar](https://images.tuyacn.com/smart/ui_design_pkg_icon/non-session-user/1667468836c2ddbd9815e.png)
12
+
9
13
  ## Installation
10
14
 
11
15
  ```sh
@@ -18,12 +22,6 @@ $ yarn add @ray-js/components-ty-lamp
18
22
 
19
23
  ```tsx
20
24
  interface IProps {
21
- /**
22
- * @description.zh 色盘id 唯一标识
23
- * @description.en Color wheel id unique identification
24
- * @default
25
- */
26
- canvasId: string;
27
25
  /**
28
26
  * @description.zh 默认数值
29
27
  * @description.en default value
@@ -76,7 +74,6 @@ interface IProps {
76
74
  ```
77
75
 
78
76
  ```tsx
79
- // 用法
80
77
  import { LampCirclePicker } from '@ray-js/components-ty-lamp';
81
78
 
82
79
  export default () => {
@@ -88,12 +85,7 @@ export default () => {
88
85
  setTemperature(v);
89
86
  };
90
87
  return (
91
- <LampCirclePicker
92
- canvasId="whiteRing"
93
- temperature={temperature}
94
- onTouchMove={handleMove}
95
- onTouchEnd={handleEnd}
96
- />
88
+ <LampCirclePicker temperature={temperature} onTouchMove={handleMove} onTouchEnd={handleEnd} />
97
89
  );
98
90
  };
99
91
  ```
@@ -3,7 +3,6 @@ import React from 'react';
3
3
  import RectColorPicker from './rjs';
4
4
  export default function RectColor(props) {
5
5
  return /*#__PURE__*/React.createElement(RectColorPicker, {
6
- canvasId: props.canvasId,
7
6
  radius: props.radius,
8
7
  innerRingRadius: props.innerRingRadius,
9
8
  value: props.value,
@@ -1,10 +1,4 @@
1
1
  export interface IProps {
2
- /**
3
- * @description.zh 色盘id 唯一标识
4
- * @description.en Color wheel id unique identification
5
- * @default
6
- */
7
- canvasId: string;
8
2
  /**
9
3
  * @description.zh 默认数值
10
4
  * @description.en default value
@@ -9,6 +9,5 @@ export var defaultProps = {
9
9
  onTouchStart: nilFn,
10
10
  onTouchMove: nilFn,
11
11
  onTouchEnd: nilFn,
12
- canvasId: 'AnnulusPickerColor',
13
12
  value: 0
14
13
  };
@@ -1,4 +1,6 @@
1
1
  import "core-js/modules/es.number.constructor.js";
2
+ import "core-js/modules/es.array.concat.js";
3
+ import "core-js/modules/es.array.slice.js";
2
4
  import "core-js/modules/es.json.stringify.js";
3
5
  import Render from './indexRjs.rjs';
4
6
  import { getSystemInfo } from '@ray-js/api';
@@ -10,7 +12,6 @@ var ETipRectPosition = {
10
12
  // eslint-disable-next-line no-undef
11
13
  Component({
12
14
  properties: {
13
- canvasId: String,
14
15
  containerStyle: String,
15
16
  radius: {
16
17
  type: Number,
@@ -37,10 +38,14 @@ Component({
37
38
  isTouch: false,
38
39
  touchType: '',
39
40
  colorText: '',
40
- tipRectPosition: ETipRectPosition.LEFT
41
+ tipRectPosition: ETipRectPosition.LEFT,
42
+ canvasId: "canvasId_".concat(String(+new Date()).slice(-3), "_").concat(String(Math.random()).slice(-3))
41
43
  },
42
44
  observers: {
43
45
  'value.**': function value(v) {
46
+ if (this.touchType === 'move') {
47
+ return;
48
+ }
44
49
  if (Math.abs(this.lastValue / 10 - v / 10) > 1 || this.lastValue === 0 && v === 0) {
45
50
  this._updatePosByRgb(v);
46
51
  this.lastValue = v;
@@ -1,15 +1,17 @@
1
- <view style="{{ containerStyle }}">
1
+ <view class="container" style="{{ containerStyle }}">
2
2
  <canvas
3
3
  class="canvasWrapper"
4
4
  type="2d"
5
5
  canvas-id="{{ canvasId }}"
6
+ disable-scroll="true"
6
7
  style="width: {{ radius * 2 }}px; height: {{ radius * 2 }}px;"
7
8
  >
8
- <canvas
9
- class="canvasThumbWrapper"
10
- type="2d"
11
- canvas-id="{{ canvasId }}_thumb"
12
- style="width: {{ radius * 2 }}px; height: {{ radius * 2 }}px;"
13
- ></canvas>
14
9
  </canvas>
10
+ <canvas
11
+ class="canvasThumbWrapper"
12
+ type="2d"
13
+ canvas-id="{{ canvasId }}_thumb"
14
+ disable-scroll="true"
15
+ style="position: absolute; top: 0; left: 0; width: {{ radius * 2 }}px; height: {{ radius * 2 }}px;"
16
+ ></canvas>
15
17
  </view>
@@ -1,4 +1,6 @@
1
- .container {}
1
+ .container {
2
+ position: relative;
3
+ }
2
4
 
3
5
  .canvasWrapper {
4
6
  position: relative;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  interface IProps {
3
- canvasId: string;
4
3
  isShowColorTip?: boolean;
5
4
  radius?: number;
6
5
  innerRingRadius?: number;
package/lib/index.js CHANGED
@@ -10,7 +10,6 @@ var ring = res.ring;
10
10
  var WhiteRing = function (props) {
11
11
  var temperature = props.temperature,
12
12
  radius = props.radius,
13
- canvasId = props.canvasId,
14
13
  innerRingRadius = props.innerRingRadius,
15
14
  isShowColorTip = props.isShowColorTip,
16
15
  onTouchStart = props.onTouchStart,
@@ -19,7 +18,6 @@ var WhiteRing = function (props) {
19
18
  return /*#__PURE__*/React.createElement(View, {
20
19
  className: clsx(styled.container, styled.flexCenter)
21
20
  }, /*#__PURE__*/React.createElement(AnnulusPickerColor, {
22
- canvasId: canvasId,
23
21
  value: temperature,
24
22
  radius: radius,
25
23
  innerRingRadius: innerRingRadius,
package/lib/props.d.ts CHANGED
@@ -1,10 +1,4 @@
1
1
  export interface IProps {
2
- /**
3
- * @description.zh 色盘id 唯一标识
4
- * @description.en Color wheel id unique identification
5
- * @default
6
- */
7
- canvasId: string;
8
2
  /**
9
3
  * @description.zh 默认数值
10
4
  * @description.en default value
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-circle-picker",
3
- "version": "1.0.0",
4
- "description": "LampUnfilledCornerAnnulusPickerWhite",
3
+ "version": "1.0.2-beta-1",
4
+ "description": "照明缺角色环",
5
5
  "main": "lib/index",
6
6
  "files": [
7
7
  "lib"