@ray-js/adapter 1.7.79 → 1.7.81
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/cjs/hostComponents/Camera/index.d.ts +105 -10
- package/cjs/hostComponents/Camera/index.js +16 -1
- package/cjs/hostComponents/Canvas/index.d.ts +197 -15
- package/cjs/hostComponents/Canvas/index.js +12 -1
- package/cjs/hostComponents/CoverView/index.d.ts +8 -1
- package/cjs/hostComponents/Iframe/index.d.ts +59 -19
- package/cjs/hostComponents/Iframe/index.js +8 -1
- package/cjs/hostComponents/Iframe/node.d.ts +1 -0
- package/cjs/hostComponents/Iframe/node.js +1 -1
- package/cjs/hostComponents/Input/index.d.ts +1 -1
- package/cjs/hostComponents/IpcPlayer/index.d.ts +297 -172
- package/cjs/hostComponents/IpcPlayer/index.js +26 -1
- package/cjs/hostComponents/Map/index.d.ts +202 -49
- package/cjs/hostComponents/Map/index.js +17 -1
- package/cjs/hostComponents/MovableArea/index.d.ts +18 -0
- package/cjs/hostComponents/MovableArea/index.js +10 -1
- package/cjs/hostComponents/MovableView/index.d.ts +92 -6
- package/cjs/hostComponents/MovableView/index.js +19 -3
- package/cjs/hostComponents/NativeVideo/index.d.ts +172 -14
- package/cjs/hostComponents/NativeVideo/index.js +24 -1
- package/cjs/hostComponents/Navigator/index.d.ts +126 -22
- package/cjs/hostComponents/Navigator/index.js +16 -4
- package/cjs/hostComponents/Picker/index.d.ts +98 -43
- package/cjs/hostComponents/Picker/index.js +19 -1
- package/cjs/hostComponents/PickerView/index.d.ts +64 -14
- package/cjs/hostComponents/PickerView/index.js +12 -1
- package/cjs/hostComponents/PickerViewColumn/index.d.ts +11 -1
- package/cjs/hostComponents/Progress/index.d.ts +39 -1
- package/cjs/hostComponents/Progress/index.js +19 -2
- package/cjs/hostComponents/RichText/index.d.ts +50 -7
- package/cjs/hostComponents/RichText/index.js +8 -1
- package/cjs/hostComponents/ScrollView/index.d.ts +190 -54
- package/cjs/hostComponents/ScrollView/index.js +26 -1
- package/cjs/hostComponents/Slider/node.d.ts +1 -0
- package/cjs/hostComponents/Slider/node.js +1 -1
- package/cjs/hostComponents/SvgRender/index.d.ts +16 -1
- package/cjs/hostComponents/SvgRender/index.js +13 -1
- package/cjs/hostComponents/Swiper/node.js +1 -1
- package/cjs/hostComponents/SwiperItem/index.d.ts +86 -1
- package/cjs/hostComponents/Video/index.d.ts +176 -28
- package/cjs/hostComponents/Video/index.js +41 -1
- package/cjs/hostComponents/WebView/index.d.ts +64 -14
- package/cjs/hostComponents/WebView/index.js +10 -1
- package/cjs/types/component.d.ts +15 -6
- package/cjs/types/index.d.ts +2 -2
- package/cjs/types/index.js +1 -1
- package/esm/hostComponents/Camera/index.d.ts +105 -10
- package/esm/hostComponents/Camera/index.js +15 -0
- package/esm/hostComponents/Canvas/index.d.ts +197 -15
- package/esm/hostComponents/Canvas/index.js +11 -0
- package/esm/hostComponents/CoverView/index.d.ts +8 -1
- package/esm/hostComponents/Iframe/index.d.ts +59 -19
- package/esm/hostComponents/Iframe/index.js +7 -0
- package/esm/hostComponents/Iframe/node.d.ts +1 -0
- package/esm/hostComponents/Iframe/node.js +1 -1
- package/esm/hostComponents/Input/index.d.ts +1 -1
- package/esm/hostComponents/IpcPlayer/index.d.ts +297 -172
- package/esm/hostComponents/IpcPlayer/index.js +25 -0
- package/esm/hostComponents/Map/index.d.ts +202 -49
- package/esm/hostComponents/Map/index.js +16 -0
- package/esm/hostComponents/MovableArea/index.d.ts +18 -0
- package/esm/hostComponents/MovableArea/index.js +9 -0
- package/esm/hostComponents/MovableView/index.d.ts +92 -6
- package/esm/hostComponents/MovableView/index.js +18 -2
- package/esm/hostComponents/NativeVideo/index.d.ts +172 -14
- package/esm/hostComponents/NativeVideo/index.js +23 -0
- package/esm/hostComponents/Navigator/index.d.ts +126 -22
- package/esm/hostComponents/Navigator/index.js +15 -3
- package/esm/hostComponents/Picker/index.d.ts +98 -43
- package/esm/hostComponents/Picker/index.js +18 -0
- package/esm/hostComponents/PickerView/index.d.ts +64 -14
- package/esm/hostComponents/PickerView/index.js +11 -0
- package/esm/hostComponents/PickerViewColumn/index.d.ts +11 -1
- package/esm/hostComponents/Progress/index.d.ts +39 -1
- package/esm/hostComponents/Progress/index.js +18 -1
- package/esm/hostComponents/RichText/index.d.ts +50 -7
- package/esm/hostComponents/RichText/index.js +7 -0
- package/esm/hostComponents/ScrollView/index.d.ts +190 -54
- package/esm/hostComponents/ScrollView/index.js +25 -0
- package/esm/hostComponents/Slider/node.d.ts +1 -0
- package/esm/hostComponents/Slider/node.js +1 -1
- package/esm/hostComponents/SvgRender/index.d.ts +16 -1
- package/esm/hostComponents/SvgRender/index.js +12 -0
- package/esm/hostComponents/Swiper/node.js +1 -1
- package/esm/hostComponents/SwiperItem/index.d.ts +86 -1
- package/esm/hostComponents/Video/index.d.ts +176 -28
- package/esm/hostComponents/Video/index.js +40 -0
- package/esm/hostComponents/WebView/index.d.ts +64 -14
- package/esm/hostComponents/WebView/index.js +9 -0
- package/esm/types/component.d.ts +15 -6
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.js +1 -1
- package/node.js +1 -1
- package/package.json +3 -3
|
@@ -1,21 +1,116 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BaseEvent, BaseProps, DiffLayer } from '../../types/component';
|
|
3
|
+
/** 相机非正常终止事件对象 */
|
|
4
|
+
export interface CameraStopEvent extends BaseEvent {
|
|
5
|
+
/** 事件类型 */
|
|
6
|
+
type: 'stop';
|
|
7
|
+
}
|
|
8
|
+
/** 相机错误事件详情 */
|
|
9
|
+
export interface CameraErrorEventDetail {
|
|
10
|
+
/** 错误信息 */
|
|
11
|
+
errMsg: string;
|
|
12
|
+
}
|
|
13
|
+
/** 相机错误事件对象 */
|
|
14
|
+
export interface CameraErrorEvent extends BaseEvent {
|
|
15
|
+
/** 事件类型 */
|
|
16
|
+
type: 'error';
|
|
17
|
+
/** 事件详情 */
|
|
18
|
+
detail: CameraErrorEventDetail;
|
|
19
|
+
}
|
|
20
|
+
/** 相机初始化完成事件详情 */
|
|
21
|
+
export interface CameraInitdoneEventDetail {
|
|
22
|
+
/** 最大缩放倍数 */
|
|
23
|
+
maxZoom: number;
|
|
24
|
+
}
|
|
25
|
+
/** 相机初始化完成事件对象 */
|
|
26
|
+
export interface CameraInitdoneEvent extends BaseEvent {
|
|
27
|
+
/** 事件类型 */
|
|
28
|
+
type: 'initdone';
|
|
29
|
+
/** 事件详情 */
|
|
30
|
+
detail: CameraInitdoneEventDetail;
|
|
31
|
+
}
|
|
32
|
+
export type CameraResolution =
|
|
33
|
+
/** 低分辨率 */
|
|
34
|
+
'low'
|
|
35
|
+
/** 中分辨率 */
|
|
36
|
+
| 'medium'
|
|
37
|
+
/** 高分辨率 */
|
|
38
|
+
| 'high';
|
|
39
|
+
export type CameraDevicePosition =
|
|
40
|
+
/** 前置摄像头 */
|
|
41
|
+
'front'
|
|
42
|
+
/** 后置摄像头 */
|
|
43
|
+
| 'back';
|
|
44
|
+
export type CameraFlash =
|
|
45
|
+
/** 自动闪光灯 */
|
|
46
|
+
'auto'
|
|
47
|
+
/** 开启闪光灯 */
|
|
48
|
+
| 'on'
|
|
49
|
+
/** 关闭闪光灯 */
|
|
50
|
+
| 'off'
|
|
51
|
+
/** 手电筒模式 */
|
|
52
|
+
| 'torch';
|
|
53
|
+
export type CameraBorderStyle =
|
|
54
|
+
/** 实线边框 */
|
|
55
|
+
'solid'
|
|
56
|
+
/** 虚线边框 */
|
|
57
|
+
| 'dashed';
|
|
58
|
+
/**
|
|
59
|
+
* 系统相机组件,用于预览与拍摄。
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @alias Camera
|
|
63
|
+
* @since @ray-js/ray 0.6.9
|
|
64
|
+
* @example 基础用法 ./demos/basic/index.tsx sandbox ide
|
|
65
|
+
* @example 自定义边框 ./demos/custom-border/index.tsx sandbox ide
|
|
66
|
+
*/
|
|
3
67
|
export interface CameraProps extends BaseProps, DiffLayer {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
68
|
+
/** 应用模式,只在初始化时有效,不能动态变更 */
|
|
69
|
+
mode?: 'normal';
|
|
70
|
+
/** 分辨率,不支持动态修改 */
|
|
71
|
+
resolution?: CameraResolution;
|
|
72
|
+
/** 摄像头朝向 */
|
|
73
|
+
devicePosition?: CameraDevicePosition;
|
|
74
|
+
/** 闪光灯模式 */
|
|
75
|
+
flash?: CameraFlash;
|
|
76
|
+
/** 边框宽度,单位 px */
|
|
8
77
|
borderWidth?: number;
|
|
9
|
-
|
|
78
|
+
/** 边框样式 */
|
|
79
|
+
borderStyle?: CameraBorderStyle;
|
|
80
|
+
/** 边框颜色,须为十六进制格式 */
|
|
10
81
|
borderColor?: string;
|
|
82
|
+
/** 边框圆角,单位 px */
|
|
11
83
|
borderRadius?: number;
|
|
84
|
+
/** 边框左上角圆角,单位 px */
|
|
12
85
|
borderRadiusTopLeft?: number;
|
|
86
|
+
/** 边框右上角圆角,单位 px */
|
|
13
87
|
borderRadiusTopRight?: number;
|
|
88
|
+
/** 边框左下角圆角,单位 px */
|
|
14
89
|
borderRadiusBottomLeft?: number;
|
|
90
|
+
/** 边框右下角圆角,单位 px */
|
|
15
91
|
borderRadiusBottomRight?: number;
|
|
92
|
+
/** 背景颜色,须为十六进制格式 */
|
|
16
93
|
backgroundColor?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
94
|
+
/** 摄像头在非正常终止时触发,如退出后台等情况 */
|
|
95
|
+
onBindstop?: (event: CameraStopEvent) => void;
|
|
96
|
+
/** 用户不允许使用摄像头时触发 */
|
|
97
|
+
onError?: (event: CameraErrorEvent) => void;
|
|
98
|
+
/** 相机初始化完成时触发 */
|
|
99
|
+
onInitdone?: (event: CameraInitdoneEvent) => void;
|
|
20
100
|
}
|
|
21
101
|
export declare const Camera: React.ComponentType<CameraProps>;
|
|
102
|
+
/**
|
|
103
|
+
* @belong Camera
|
|
104
|
+
* @defaults
|
|
105
|
+
*/
|
|
106
|
+
export declare const cameraDefaultProps: {
|
|
107
|
+
mode: string;
|
|
108
|
+
resolution: string;
|
|
109
|
+
devicePosition: string;
|
|
110
|
+
flash: string;
|
|
111
|
+
borderWidth: number;
|
|
112
|
+
borderStyle: string;
|
|
113
|
+
borderColor: string;
|
|
114
|
+
borderRadius: number;
|
|
115
|
+
backgroundColor: string;
|
|
116
|
+
};
|
|
@@ -3,9 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Camera = void 0;
|
|
6
|
+
exports.cameraDefaultProps = exports.Camera = void 0;
|
|
7
7
|
const createHostComponent_js_1 = __importDefault(require("../createHostComponent.js"));
|
|
8
8
|
exports.Camera = (0, createHostComponent_js_1.default)('camera');
|
|
9
|
+
/**
|
|
10
|
+
* @belong Camera
|
|
11
|
+
* @defaults
|
|
12
|
+
*/
|
|
13
|
+
exports.cameraDefaultProps = {
|
|
14
|
+
mode: 'normal',
|
|
15
|
+
resolution: 'medium',
|
|
16
|
+
devicePosition: 'back',
|
|
17
|
+
flash: 'auto',
|
|
18
|
+
borderWidth: 0,
|
|
19
|
+
borderStyle: 'solid',
|
|
20
|
+
borderColor: '#ffffff',
|
|
21
|
+
borderRadius: 0,
|
|
22
|
+
backgroundColor: '#ffffff',
|
|
23
|
+
};
|
|
9
24
|
exports.Camera.defaultProps = {
|
|
10
25
|
mode: 'normal',
|
|
11
26
|
resolution: 'medium',
|
|
@@ -1,19 +1,201 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { BaseEvent, BaseProps, TouchEvent } from '../../types/component';
|
|
3
|
+
/** Canvas 触摸点信息(与标准 DOM Touch 不同,仅包含 identifier/x/y) */
|
|
4
|
+
export interface CanvasTouchInfo {
|
|
5
|
+
/** 触摸点标识符 */
|
|
6
|
+
identifier: number;
|
|
7
|
+
/** 触摸点相对于 canvas 左上角的 x 坐标 */
|
|
8
|
+
x: number;
|
|
9
|
+
/** 触摸点相对于 canvas 左上角的 y 坐标 */
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
/** Canvas 触摸事件类型 */
|
|
13
|
+
export type CanvasTouchEvent = TouchEvent<CanvasTouchInfo>;
|
|
14
|
+
/** canvas 错误事件详情 */
|
|
15
|
+
export interface CanvasErrorEventDetail {
|
|
16
|
+
/** 错误信息 */
|
|
17
|
+
errMsg: string;
|
|
18
|
+
}
|
|
19
|
+
/** canvas 错误事件对象 */
|
|
20
|
+
export interface CanvasErrorEvent extends BaseEvent {
|
|
21
|
+
/** 事件类型 */
|
|
22
|
+
type: 'error';
|
|
23
|
+
/** 事件详情 */
|
|
24
|
+
detail: CanvasErrorEventDetail;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 画布组件。
|
|
28
|
+
*
|
|
29
|
+
* @alias Canvas
|
|
30
|
+
* @since @ray-js/ray 0.5.10
|
|
31
|
+
* @example 使用 RJS 进行绘制(推荐)
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // index.tsx
|
|
34
|
+
* import React, { useRef, useEffect } from 'react';
|
|
35
|
+
* import { Canvas, View, Text, usePageEvent } from '@ray-js/ray';
|
|
36
|
+
* import Render from './render.rjs';
|
|
37
|
+
*
|
|
38
|
+
* export default function () {
|
|
39
|
+
* const canvasRef = useRef(null);
|
|
40
|
+
*
|
|
41
|
+
* usePageEvent('onShow', () => {
|
|
42
|
+
* if (canvasRef.current) {
|
|
43
|
+
* const canvas = canvasRef.current;
|
|
44
|
+
* const render = new Render(canvas, canvas.width, canvas.height);
|
|
45
|
+
* render.start();
|
|
46
|
+
* }
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* return (
|
|
50
|
+
* <View style={{ padding: '20px' }}>
|
|
51
|
+
* <Text style={{ marginBottom: '10px', fontSize: '16px' }}>Canvas RJS 绘制示例</Text>
|
|
52
|
+
* <Canvas
|
|
53
|
+
* ref={canvasRef}
|
|
54
|
+
* type="2d"
|
|
55
|
+
* canvasId="rjsCanvas"
|
|
56
|
+
* style={{ width: '100%', height: '300px', backgroundColor: '#f5f5f5' }}
|
|
57
|
+
* />
|
|
58
|
+
* </View>
|
|
59
|
+
* );
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
* ```javascript
|
|
63
|
+
* // render.rjs
|
|
64
|
+
* export default class Render {
|
|
65
|
+
* constructor(canvas, width, height) {
|
|
66
|
+
* this.canvas = canvas;
|
|
67
|
+
* this.width = width;
|
|
68
|
+
* this.height = height;
|
|
69
|
+
* this.ctx = canvas.getContext('2d');
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* start() {
|
|
73
|
+
* this.drawBackground();
|
|
74
|
+
* this.drawCircle();
|
|
75
|
+
* this.drawRect();
|
|
76
|
+
* this.drawText();
|
|
77
|
+
* }
|
|
78
|
+
*
|
|
79
|
+
* drawBackground() {
|
|
80
|
+
* this.ctx.fillStyle = '#ffffff';
|
|
81
|
+
* this.ctx.fillRect(0, 0, this.width, this.height);
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* drawCircle() {
|
|
85
|
+
* this.ctx.beginPath();
|
|
86
|
+
* this.ctx.arc(100, 100, 50, 0, 2 * Math.PI);
|
|
87
|
+
* this.ctx.fillStyle = '#ff6b6b';
|
|
88
|
+
* this.ctx.fill();
|
|
89
|
+
* this.ctx.strokeStyle = '#c92a2a';
|
|
90
|
+
* this.ctx.lineWidth = 3;
|
|
91
|
+
* this.ctx.stroke();
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* drawRect() {
|
|
95
|
+
* this.ctx.fillStyle = '#4dabf7';
|
|
96
|
+
* this.ctx.fillRect(200, 50, 100, 100);
|
|
97
|
+
* this.ctx.strokeStyle = '#1971c2';
|
|
98
|
+
* this.ctx.lineWidth = 3;
|
|
99
|
+
* this.ctx.strokeRect(200, 50, 100, 100);
|
|
100
|
+
* }
|
|
101
|
+
*
|
|
102
|
+
* drawText() {
|
|
103
|
+
* this.ctx.font = '20px sans-serif';
|
|
104
|
+
* this.ctx.fillStyle = '#333';
|
|
105
|
+
* this.ctx.fillText('RJS Canvas', 120, 200);
|
|
106
|
+
* }
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
* @example 使用 createCanvasContext API 绘制
|
|
110
|
+
* ```tsx | sandbox previewTitle="使用 API 绘制" ide
|
|
111
|
+
* import React, { useEffect } from 'react';
|
|
112
|
+
* import { Canvas, View, Button, createCanvasContext } from '@ray-js/ray';
|
|
113
|
+
*
|
|
114
|
+
* export default function () {
|
|
115
|
+
* const drawSmile = () => {
|
|
116
|
+
* const context = createCanvasContext('apiCanvas');
|
|
117
|
+
* context.setStrokeStyle('#ff0000');
|
|
118
|
+
* context.setLineWidth(2);
|
|
119
|
+
* context.arc(100, 100, 60, 0, 2 * Math.PI, true);
|
|
120
|
+
* context.stroke();
|
|
121
|
+
* context.beginPath();
|
|
122
|
+
* context.arc(100, 100, 40, 0, Math.PI, false);
|
|
123
|
+
* context.stroke();
|
|
124
|
+
* context.beginPath();
|
|
125
|
+
* context.arc(80, 80, 5, 0, 2 * Math.PI, true);
|
|
126
|
+
* context.fill();
|
|
127
|
+
* context.beginPath();
|
|
128
|
+
* context.arc(120, 80, 5, 0, 2 * Math.PI, true);
|
|
129
|
+
* context.fill();
|
|
130
|
+
* context.draw();
|
|
131
|
+
* };
|
|
132
|
+
*
|
|
133
|
+
* const drawRect = () => {
|
|
134
|
+
* const context = createCanvasContext('apiCanvas');
|
|
135
|
+
* context.setFillStyle('rgb(200, 0, 0)');
|
|
136
|
+
* context.fillRect(10, 10, 55, 50);
|
|
137
|
+
* context.setFillStyle('rgba(0, 0, 200, 0.5)');
|
|
138
|
+
* context.fillRect(30, 30, 55, 50);
|
|
139
|
+
* context.draw();
|
|
140
|
+
* };
|
|
141
|
+
*
|
|
142
|
+
* const clearCanvas = () => {
|
|
143
|
+
* const context = createCanvasContext('apiCanvas');
|
|
144
|
+
* context.clearRect(0, 0, 300, 200);
|
|
145
|
+
* context.draw();
|
|
146
|
+
* };
|
|
147
|
+
*
|
|
148
|
+
* useEffect(() => {
|
|
149
|
+
* drawSmile();
|
|
150
|
+
* }, []);
|
|
151
|
+
*
|
|
152
|
+
* return (
|
|
153
|
+
* <View style={{ padding: '20px' }}>
|
|
154
|
+
* <Canvas
|
|
155
|
+
* canvasId="apiCanvas"
|
|
156
|
+
* type="2d"
|
|
157
|
+
* style={{ width: '100%', height: '200px', border: '1px solid #eee' }}
|
|
158
|
+
* onTouchStart={(e) => console.log('触摸开始:', e.touches[0]?.x, e.touches[0]?.y)}
|
|
159
|
+
* />
|
|
160
|
+
* <View style={{ marginTop: '10px', display: 'flex', flexDirection: 'row', gap: '8px', flexWrap: 'wrap' }}>
|
|
161
|
+
* <Button size="mini" onClick={drawSmile}>绘制笑脸</Button>
|
|
162
|
+
* <Button size="mini" onClick={drawRect}>绘制矩形</Button>
|
|
163
|
+
* <Button size="mini" onClick={clearCanvas}>清空画布</Button>
|
|
164
|
+
* </View>
|
|
165
|
+
* </View>
|
|
166
|
+
* );
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export interface CanvasProps extends Omit<BaseProps, 'onTouchStart' | 'onTouchMove' | 'onTouchEnd' | 'onTouchCancel' | 'onLongTap'> {
|
|
171
|
+
/** 指定 canvas 类型,有效值为 2d、webgl */
|
|
172
|
+
type?: '2d' | 'webgl' | string;
|
|
173
|
+
/** canvas 组件的唯一标识符;若指定了 type 为 2d/webgl 可不再指定 */
|
|
10
174
|
canvasId?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
175
|
+
/** 在 canvas 中移动且绑定了手势事件时,是否禁止页面滚动与下拉刷新 */
|
|
176
|
+
disableScroll?: boolean;
|
|
177
|
+
/** 手指触摸动作开始 */
|
|
178
|
+
onTouchStart?: (event: CanvasTouchEvent) => void;
|
|
179
|
+
/** 手指触摸后移动 */
|
|
180
|
+
onTouchMove?: (event: CanvasTouchEvent) => void;
|
|
181
|
+
/** 手指触摸动作结束 */
|
|
182
|
+
onTouchEnd?: (event: CanvasTouchEvent) => void;
|
|
183
|
+
/** 手指触摸动作被打断,如来电提醒、弹窗 */
|
|
184
|
+
onTouchCancel?: (event: CanvasTouchEvent) => void;
|
|
185
|
+
/** 手指长按约 500ms 后触发;触发后移动不会引起页面滚动 */
|
|
186
|
+
onLongTap?: (event: CanvasTouchEvent) => void;
|
|
187
|
+
/** 当发生错误时触发,detail 含 errMsg */
|
|
188
|
+
onError?: (event: CanvasErrorEvent) => void;
|
|
18
189
|
}
|
|
19
190
|
export declare const Canvas: React.ComponentType<CanvasProps>;
|
|
191
|
+
/**
|
|
192
|
+
* Canvas 组件文档用默认值(与运行时 defaultProps 分离;当前运行时未设置 defaultProps)
|
|
193
|
+
*
|
|
194
|
+
* @belong Canvas
|
|
195
|
+
* @defaults
|
|
196
|
+
*/
|
|
197
|
+
export declare const canvasDefaultProps: {
|
|
198
|
+
type: string;
|
|
199
|
+
canvasId: string;
|
|
200
|
+
disableScroll: boolean;
|
|
201
|
+
};
|
|
@@ -3,6 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Canvas = void 0;
|
|
6
|
+
exports.canvasDefaultProps = exports.Canvas = void 0;
|
|
7
7
|
const createHostComponent_js_1 = __importDefault(require("../createHostComponent.js"));
|
|
8
8
|
exports.Canvas = (0, createHostComponent_js_1.default)('canvas');
|
|
9
|
+
/**
|
|
10
|
+
* Canvas 组件文档用默认值(与运行时 defaultProps 分离;当前运行时未设置 defaultProps)
|
|
11
|
+
*
|
|
12
|
+
* @belong Canvas
|
|
13
|
+
* @defaults
|
|
14
|
+
*/
|
|
15
|
+
exports.canvasDefaultProps = {
|
|
16
|
+
type: '2d',
|
|
17
|
+
canvasId: '',
|
|
18
|
+
disableScroll: false,
|
|
19
|
+
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseProps } from '../../types/component.js';
|
|
3
|
+
/**
|
|
4
|
+
* 覆盖在原生组件之上的视图容器,可覆盖 Map、Video 等原生组件。
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @alias CoverView
|
|
8
|
+
* @since @ray-js/ray 0.5.10
|
|
9
|
+
* @example 基础用法 ./demos/basic/index.tsx sandbox ide e2e
|
|
10
|
+
*/
|
|
3
11
|
export interface CoverViewProps extends BaseProps {
|
|
4
|
-
children?: any;
|
|
5
12
|
}
|
|
6
13
|
export declare const CoverView: React.ComponentType<CoverViewProps>;
|
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseProps, DiffLayer
|
|
2
|
+
import type { BaseEvent, BaseProps, DiffLayer } from '../../types/component';
|
|
3
|
+
/** iframe 网页加载失败事件数据 */
|
|
4
|
+
export interface IframeErrorDetail {
|
|
5
|
+
/** 加载失败的地址 */
|
|
6
|
+
url: string;
|
|
7
|
+
/** 加载失败时的完整 URL */
|
|
8
|
+
fullUrl: string;
|
|
9
|
+
}
|
|
10
|
+
/** 网页加载失败时触发 */
|
|
11
|
+
export interface IframeErrorEvent extends BaseEvent {
|
|
12
|
+
/** 事件类型 */
|
|
13
|
+
type: 'error';
|
|
14
|
+
/** 事件数据 */
|
|
15
|
+
detail: IframeErrorDetail;
|
|
16
|
+
}
|
|
17
|
+
/** iframe 网页加载成功事件数据 */
|
|
18
|
+
export interface IframeLoadDetail {
|
|
19
|
+
/** 已加载网页地址 */
|
|
20
|
+
src: string;
|
|
21
|
+
}
|
|
22
|
+
/** 网页加载成功时触发 */
|
|
23
|
+
export interface IframeLoadEvent extends BaseEvent {
|
|
24
|
+
/** 事件类型 */
|
|
25
|
+
type: 'load';
|
|
26
|
+
/** 事件数据 */
|
|
27
|
+
detail: IframeLoadDetail;
|
|
28
|
+
}
|
|
29
|
+
/** iframe 网页向小程序 postMessage 事件数据 */
|
|
30
|
+
export interface IframeMessageDetail {
|
|
31
|
+
/** 多次 `postMessage` 入参组成的数组 */
|
|
32
|
+
data: unknown[];
|
|
33
|
+
}
|
|
34
|
+
/** 在特定时机收到网页 `postMessage` 时触发 */
|
|
35
|
+
export interface IframeMessageEvent extends BaseEvent {
|
|
36
|
+
/** 事件类型 */
|
|
37
|
+
type: 'message';
|
|
38
|
+
/** 事件数据 */
|
|
39
|
+
detail: IframeMessageDetail;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 内嵌网页(iframe)
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
3
46
|
export interface IframeProps extends BaseProps, DiffLayer {
|
|
4
|
-
/**
|
|
5
|
-
* webview 指向网页的链接,网页需登录小程序管理后台配置业务域名。
|
|
6
|
-
*/
|
|
47
|
+
/** 网页链接(需在小程序后台配置业务域名) */
|
|
7
48
|
src?: string;
|
|
8
|
-
/**
|
|
9
|
-
* 是否向 iframe 中注入 TTT SDK
|
|
10
|
-
*/
|
|
49
|
+
/** 是否向 iframe 中注入 TTT SDK */
|
|
11
50
|
injectTTT?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
onLoad?: (event: GenericEvent) => any;
|
|
20
|
-
/**
|
|
21
|
-
* 网页向小程序 postMessage 时,会在特定时机(小程序后退、组件销毁、分享)触发并收到消息。e.detail = { data },data是多次 postMessage 的参数组成的数组
|
|
22
|
-
*/
|
|
23
|
-
onMessage?: (event: GenericEvent) => any;
|
|
51
|
+
/** 网页加载失败时触发 */
|
|
52
|
+
onError?: (event: IframeErrorEvent) => void;
|
|
53
|
+
/** 网页加载成功时触发 */
|
|
54
|
+
onLoad?: (event: IframeLoadEvent) => void;
|
|
55
|
+
/** 网页向小程序 postMessage 时,在特定时机触发并收到消息 */
|
|
56
|
+
onMessage?: (event: IframeMessageEvent) => void;
|
|
24
57
|
}
|
|
25
58
|
export declare const Iframe: React.ComponentType<IframeProps>;
|
|
59
|
+
/**
|
|
60
|
+
* Iframe 组件默认值
|
|
61
|
+
*
|
|
62
|
+
* @belong Iframe
|
|
63
|
+
* @defaults
|
|
64
|
+
*/
|
|
65
|
+
export declare const iframeDefaultProps: {};
|
|
@@ -3,7 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Iframe = void 0;
|
|
6
|
+
exports.iframeDefaultProps = exports.Iframe = void 0;
|
|
7
7
|
const createHostComponent_js_1 = __importDefault(require("../createHostComponent.js"));
|
|
8
8
|
exports.Iframe = (0, createHostComponent_js_1.default)('iframe');
|
|
9
|
+
/**
|
|
10
|
+
* Iframe 组件默认值
|
|
11
|
+
*
|
|
12
|
+
* @belong Iframe
|
|
13
|
+
* @defaults
|
|
14
|
+
*/
|
|
15
|
+
exports.iframeDefaultProps = {};
|
|
9
16
|
exports.Iframe.defaultProps = {};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.props = exports.alias = void 0;
|
|
4
4
|
const universal_js_1 = require("../universal.js");
|
|
5
|
-
exports.alias = Object.assign(Object.assign({}, universal_js_1.universalAlias), { src: 'src', injectTTT: 'inject-ttt', onError: 'bind:error', onLoad: 'bind:load', onMessage: 'bind:message' });
|
|
5
|
+
exports.alias = Object.assign(Object.assign({}, universal_js_1.universalAlias), { src: 'src', injectTTT: 'inject-ttt', updateLayout: 'update-layout', onError: 'bind:error', onLoad: 'bind:load', onMessage: 'bind:message' });
|
|
6
6
|
exports.props = Object.values(exports.alias);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { BaseProps, GenericEvent } from '../../types/component.js';
|
|
3
3
|
export interface InputProps extends BaseProps {
|
|
4
4
|
value?: string;
|
|
5
|
-
type?: 'text' | 'number';
|
|
5
|
+
type?: 'text' | 'number' | 'digit';
|
|
6
6
|
password?: boolean;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
placeholderStyle?: string;
|