@ray-js/components 0.9.0 → 0.9.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/lib/MovableArea/MovableArea.d.ts +3 -3
- package/lib/MovableArea/MovableArea.js +8 -8
- package/lib/MovableArea/MovableArea.thing.d.ts +4 -0
- package/lib/MovableArea/MovableArea.thing.js +8 -0
- package/lib/MovableArea/MovableArea.wechat.d.ts +4 -0
- package/lib/MovableArea/MovableArea.wechat.js +8 -0
- package/lib/MovableArea/index.d.ts +1 -1
- package/lib/MovableArea/index.js +0 -1
- package/lib/MovableView/MovableView.d.ts +3 -3
- package/lib/MovableView/MovableView.js +36 -7
- package/lib/MovableView/MovableView.thing.d.ts +4 -0
- package/lib/MovableView/MovableView.thing.js +8 -0
- package/lib/MovableView/MovableView.wechat.d.ts +4 -0
- package/lib/MovableView/MovableView.wechat.js +8 -0
- package/lib/MovableView/index.d.ts +1 -1
- package/lib/MovableView/index.js +0 -1
- package/package.json +5 -5
- package/lib/MovableArea/MovableArea.web.d.ts +0 -4
- package/lib/MovableArea/MovableArea.web.js +0 -11
- package/lib/MovableArea/props.d.ts +0 -19
- package/lib/MovableArea/props.js +0 -3
- package/lib/MovableView/MovableView.web.d.ts +0 -4
- package/lib/MovableView/MovableView.web.js +0 -40
- package/lib/MovableView/props.d.ts +0 -109
- package/lib/MovableView/props.js +0 -15
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import { MovableAreaProps } from '
|
3
|
-
declare const MovableArea: React.FC<MovableAreaProps>;
|
1
|
+
import React from 'react';
|
2
|
+
import { MovableAreaProps } from '@ray-js/adapter';
|
3
|
+
export declare const MovableArea: React.FC<MovableAreaProps>;
|
4
4
|
export default MovableArea;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import "core-js/modules/es.object.assign.js";
|
2
|
+
import React from 'react';
|
3
|
+
import handleProps from '../utils/handleProps';
|
4
|
+
import { MovableArea as RemaxMovableArea } from '@ray-js/adapter';
|
5
|
+
export var MovableArea = function (props) {
|
6
|
+
var restProps = Object.assign({}, props); // @ts-ignore
|
4
7
|
|
5
|
-
|
6
|
-
return /*#__PURE__*/React.createElement(Text, null, "\u6682\u672A\u5B9E\u73B0");
|
8
|
+
return /*#__PURE__*/React.createElement("v-movable-area", handleProps(restProps));
|
7
9
|
};
|
8
|
-
|
9
|
-
MovableArea.defaultProps = defaultMovableAreaProps;
|
10
|
-
MovableArea.displayName = 'MovableArea';
|
10
|
+
MovableArea.defaultProps = RemaxMovableArea.defaultProps;
|
11
11
|
export default MovableArea;
|
package/lib/MovableArea/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import { MovableViewProps } from '
|
3
|
-
declare const MovableView: React.FC<MovableViewProps>;
|
1
|
+
import React from 'react';
|
2
|
+
import { MovableViewProps } from '@ray-js/adapter';
|
3
|
+
export declare const MovableView: React.FC<MovableViewProps>;
|
4
4
|
export default MovableView;
|
@@ -1,11 +1,40 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["onChange", "onScale"];
|
5
|
+
import React from 'react';
|
6
|
+
import { useEventListener } from 'ahooks';
|
7
|
+
import handleProps from '../utils/handleProps';
|
8
|
+
import { MovableView as RemaxMovableView } from '@ray-js/adapter';
|
9
|
+
export var MovableView = function (props) {
|
10
|
+
var onChange = props.onChange,
|
11
|
+
onScale = props.onScale,
|
12
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
4
13
|
|
5
|
-
var
|
6
|
-
|
7
|
-
|
14
|
+
var currentNode = React.useRef(null);
|
15
|
+
useEventListener('change', function (e) {
|
16
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({
|
17
|
+
type: 'change'
|
18
|
+
}, e.detail), {}, {
|
19
|
+
origin: e
|
20
|
+
}));
|
21
|
+
}, {
|
22
|
+
target: currentNode
|
23
|
+
});
|
24
|
+
useEventListener('scale', function (e) {
|
25
|
+
onScale === null || onScale === void 0 ? void 0 : onScale(_objectSpread(_objectSpread({
|
26
|
+
type: 'scale'
|
27
|
+
}, e.detail), {}, {
|
28
|
+
origin: e
|
29
|
+
}));
|
30
|
+
}, {
|
31
|
+
target: currentNode
|
32
|
+
}); // @ts-ignore
|
8
33
|
|
34
|
+
return /*#__PURE__*/React.createElement("v-movable-view", _extends({
|
35
|
+
ref: currentNode
|
36
|
+
}, handleProps(restProps)));
|
37
|
+
};
|
9
38
|
MovableView.displayName = 'MovableView';
|
10
|
-
MovableView.defaultProps =
|
39
|
+
MovableView.defaultProps = RemaxMovableView.defaultProps;
|
11
40
|
export default MovableView;
|
package/lib/MovableView/index.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/components",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.1-beta-1",
|
4
4
|
"description": "Ray basic components",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,8 +26,8 @@
|
|
26
26
|
"dependencies": {
|
27
27
|
"@ray-core/macro": "^0.1.3",
|
28
28
|
"@ray-core/wechat": "^0.1.3",
|
29
|
-
"@ray-js/adapter": "^0.9.
|
30
|
-
"@ray-js/framework-shared": "^0.9.
|
29
|
+
"@ray-js/adapter": "^0.9.1-beta-1",
|
30
|
+
"@ray-js/framework-shared": "^0.9.1-beta-1",
|
31
31
|
"ahooks": "^3.7.1",
|
32
32
|
"clsx": "^1.1.1",
|
33
33
|
"core-js": "^3.19.1",
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"style-to-object": "^0.3.0"
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
|
-
"@ray-js/cli": "^0.9.
|
40
|
+
"@ray-js/cli": "^0.9.1-beta-1"
|
41
41
|
},
|
42
42
|
"maintainers": [
|
43
43
|
{
|
@@ -45,6 +45,6 @@
|
|
45
45
|
"email": "tuyafe@tuya.com"
|
46
46
|
}
|
47
47
|
],
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "edb596e4e975c4903b6e1c099d01ba3e85fbc190",
|
49
49
|
"repository": {}
|
50
50
|
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.object.assign.js";
|
2
|
-
import React from 'react';
|
3
|
-
import handleProps from '../utils/handleProps';
|
4
|
-
import { defaultMovableAreaProps } from './props';
|
5
|
-
export var MovableArea = function (props) {
|
6
|
-
var restProps = Object.assign({}, props); // @ts-ignore
|
7
|
-
|
8
|
-
return /*#__PURE__*/React.createElement("v-movable-area", handleProps(restProps));
|
9
|
-
};
|
10
|
-
MovableArea.defaultProps = defaultMovableAreaProps;
|
11
|
-
export default MovableArea;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { BaseProps } from '../types';
|
3
|
-
export interface MovableAreaProps extends BaseProps {
|
4
|
-
/**
|
5
|
-
* @description.en React Children
|
6
|
-
* @description.zh React 子元素
|
7
|
-
* @default undefined
|
8
|
-
*/
|
9
|
-
children?: React.ReactElement;
|
10
|
-
/**
|
11
|
-
* @description.en When the MovableView inside is set to support two-finger zoom, setting this value modifies the area where the zoom gesture takes effect to the entire movable-area
|
12
|
-
* @description.zh 当里面的 MovableView 设置为支持双指缩放时,设置此值可将缩放手势生效区域修改为整个 movable-area
|
13
|
-
* @default false
|
14
|
-
*/
|
15
|
-
scaleArea?: boolean;
|
16
|
-
}
|
17
|
-
export declare const defaultMovableAreaProps: {
|
18
|
-
scaleArea: boolean;
|
19
|
-
};
|
package/lib/MovableArea/props.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["onChange", "onScale"];
|
5
|
-
import React from 'react';
|
6
|
-
import { useEventListener } from 'ahooks';
|
7
|
-
import handleProps from '../utils/handleProps';
|
8
|
-
import { defaultMovableViewProps } from './props';
|
9
|
-
export var MovableView = function (props) {
|
10
|
-
var onChange = props.onChange,
|
11
|
-
onScale = props.onScale,
|
12
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
13
|
-
|
14
|
-
var currentNode = React.useRef(null);
|
15
|
-
useEventListener('change', function (e) {
|
16
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({
|
17
|
-
type: 'change'
|
18
|
-
}, e.detail), {}, {
|
19
|
-
origin: e
|
20
|
-
}));
|
21
|
-
}, {
|
22
|
-
target: currentNode
|
23
|
-
});
|
24
|
-
useEventListener('scale', function (e) {
|
25
|
-
onScale === null || onScale === void 0 ? void 0 : onScale(_objectSpread(_objectSpread({
|
26
|
-
type: 'scale'
|
27
|
-
}, e.detail), {}, {
|
28
|
-
origin: e
|
29
|
-
}));
|
30
|
-
}, {
|
31
|
-
target: currentNode
|
32
|
-
}); // @ts-ignore
|
33
|
-
|
34
|
-
return /*#__PURE__*/React.createElement("v-movable-view", _extends({
|
35
|
-
ref: currentNode
|
36
|
-
}, handleProps(restProps)));
|
37
|
-
};
|
38
|
-
MovableView.displayName = 'MovableView';
|
39
|
-
MovableView.defaultProps = defaultMovableViewProps;
|
40
|
-
export default MovableView;
|
@@ -1,109 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { BaseProps } from '../types';
|
3
|
-
export declare type SourceOnChange = 'touch' | 'touchOutOfBounds' | 'outOfBounds' | 'friction' | '';
|
4
|
-
export declare type EventOnChange = {
|
5
|
-
x: string;
|
6
|
-
y: string;
|
7
|
-
source: SourceOnChange;
|
8
|
-
type: 'change';
|
9
|
-
};
|
10
|
-
export declare type EventOnScale = {
|
11
|
-
x: string;
|
12
|
-
y: string;
|
13
|
-
scale: string;
|
14
|
-
type: 'scale';
|
15
|
-
};
|
16
|
-
export interface MovableViewProps extends BaseProps {
|
17
|
-
children?: React.ReactElement;
|
18
|
-
/**
|
19
|
-
* @description.en The moving direction of MovableView, the property values are all, vertical, horizontal, none
|
20
|
-
* @description.zh 移动方向,属性值有 all、vertical、horizontal、none
|
21
|
-
* @default none
|
22
|
-
*/
|
23
|
-
direction?: string;
|
24
|
-
/**
|
25
|
-
* @description.en Whether with inertia
|
26
|
-
* @description.zh 是否带有惯性
|
27
|
-
* @default false
|
28
|
-
*/
|
29
|
-
inertia?: boolean;
|
30
|
-
/**
|
31
|
-
* @description.en Is it possible to move beyond the moveable area
|
32
|
-
* @description.zh 超过可移动区域后,是否还可以移动
|
33
|
-
* @default false
|
34
|
-
*/
|
35
|
-
outOfBounds?: boolean;
|
36
|
-
/**
|
37
|
-
* @description.en Defines an offset in the x-axis direction that will automatically move to the moveable range if the value of x is not in the moveable range. Changing the value of x will trigger an animation
|
38
|
-
* @description.zh 定义 x 轴方向的偏移,如果 x 的值不在可移动范围内,会自动移动到可移动范围。改变 x 的值会触发动画
|
39
|
-
* @default 0
|
40
|
-
*/
|
41
|
-
x?: number;
|
42
|
-
/**
|
43
|
-
* @description.en Defines an offset in the y-axis direction that will automatically move to the moveable range if the value of y is not in the moveable range. Changing the value of y will trigger an animation
|
44
|
-
* @description.zh 定义 y 轴方向的偏移,如果 y 的值不在可移动范围内,会自动移动到可移动范围。改变 y 的值会触发动画
|
45
|
-
* @default 0
|
46
|
-
*/
|
47
|
-
y?: number;
|
48
|
-
/**
|
49
|
-
* @description.en Damping factor, used to control the animation when x or y changes and the animation of over-bound rebound, the higher the value the faster the movement
|
50
|
-
* @description.zh 阻尼系数,用于控制 x 或 y 改变时的动画和过界回弹的动画,值越大移动越快
|
51
|
-
* @default 20
|
52
|
-
*/
|
53
|
-
damping?: number;
|
54
|
-
/**
|
55
|
-
* @description.en Damping factor, used to control the animation when x or y changes and the animation of over-bound rebound, the higher the value the faster the movement
|
56
|
-
* @description.zh 摩擦系数,用于控制惯性滑动的动画,值越大摩擦力越大,滑动越快停止;必须大于 0,否则会被设置成默认值
|
57
|
-
* @default 2
|
58
|
-
*/
|
59
|
-
friction?: number;
|
60
|
-
/**
|
61
|
-
* @description.en Whether to disable
|
62
|
-
* @description.zh 是否禁用
|
63
|
-
* @default false
|
64
|
-
*/
|
65
|
-
disabled?: boolean;
|
66
|
-
/**
|
67
|
-
* @description.en Whether to support two-finger zoom, the default zoom gesture area is inside MovableView
|
68
|
-
* @description.zh 是否支持双指缩放,默认缩放手势生效区域是在 MovableView 内
|
69
|
-
* @default false
|
70
|
-
*/
|
71
|
-
scale?: boolean;
|
72
|
-
/**
|
73
|
-
* @description.en Define the minimum value of the scaling multiplier
|
74
|
-
* @description.zh 定义缩放倍数最小值
|
75
|
-
* @default 0.5
|
76
|
-
*/
|
77
|
-
scaleMin?: number;
|
78
|
-
/**
|
79
|
-
* @description.en Define the scaling multiplier maximum
|
80
|
-
* @description.zh 定义缩放倍数最大值
|
81
|
-
* @default 10
|
82
|
-
*/
|
83
|
-
scaleMax?: number;
|
84
|
-
/**
|
85
|
-
* @description.en Defines the scaling multiplier, in the range of 0.5 - 10
|
86
|
-
* @description.zh 定义缩放倍数,取值范围为 0.5 - 10
|
87
|
-
* @default 1
|
88
|
-
*/
|
89
|
-
scaleValue?: number;
|
90
|
-
/**
|
91
|
-
* @description.en Whether to use animation
|
92
|
-
* @description.zh 是否使用动画
|
93
|
-
* @default true
|
94
|
-
*/
|
95
|
-
animation?: boolean;
|
96
|
-
/**
|
97
|
-
* @description.en Event triggered during dragging
|
98
|
-
* @description.zh 拖动过程中触发的事件
|
99
|
-
* @default undefined
|
100
|
-
*/
|
101
|
-
onChange?: (evt: EventOnChange) => void;
|
102
|
-
/**
|
103
|
-
* @description.en Events triggered during scaling
|
104
|
-
* @description.zh 缩放过程中触发的事件
|
105
|
-
* @default undefined
|
106
|
-
*/
|
107
|
-
onScale?: (evt: EventOnScale) => void;
|
108
|
-
}
|
109
|
-
export declare const defaultMovableViewProps: MovableViewProps;
|
package/lib/MovableView/props.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
export var defaultMovableViewProps = {
|
2
|
-
direction: 'none',
|
3
|
-
inertia: false,
|
4
|
-
outOfBounds: false,
|
5
|
-
x: 0,
|
6
|
-
y: 0,
|
7
|
-
damping: 20,
|
8
|
-
friction: 2,
|
9
|
-
disabled: false,
|
10
|
-
scale: false,
|
11
|
-
scaleMin: 0.5,
|
12
|
-
scaleMax: 10,
|
13
|
-
scaleValue: 1,
|
14
|
-
animation: true
|
15
|
-
};
|