@ray-js/robot-map 0.0.2-beta-42 → 0.0.2-beta-44
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/RjsComponent/index.js +11 -0
- package/lib/RjsComponent/index.rjs +6 -0
- package/lib/RjsRobotMap.js +3 -1
- package/lib/RobotMap.d.ts +1 -1
- package/lib/RobotMap.js +9 -1
- package/lib/props.d.ts +35 -1
- package/package.json +2 -2
|
@@ -72,6 +72,14 @@ const componentOptions = {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
+
wayPoints: {
|
|
76
|
+
type: Array,
|
|
77
|
+
observer: function (newValue, oldValue) {
|
|
78
|
+
if (!isEqual(newValue, oldValue) && this.data.initialized && this.render) {
|
|
79
|
+
this.render.onReceiveWayPoints(newValue);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
75
83
|
virtualWalls: {
|
|
76
84
|
type: Array,
|
|
77
85
|
observer: function (newValue, oldValue) {
|
|
@@ -150,6 +158,9 @@ const componentOptions = {
|
|
|
150
158
|
if (this.data.spots) {
|
|
151
159
|
this.render.onReceiveSpots(this.data.spots);
|
|
152
160
|
}
|
|
161
|
+
if (this.data.wayPoints) {
|
|
162
|
+
this.render.onReceiveWayPoints(this.data.wayPoints);
|
|
163
|
+
}
|
|
153
164
|
if (this.data.detectedObjects) {
|
|
154
165
|
this.render.onReceiveDetectedObjects(this.data.detectedObjects);
|
|
155
166
|
}
|
|
@@ -105,6 +105,12 @@ export default Render({
|
|
|
105
105
|
this.mapInstance.drawSpots(spots)
|
|
106
106
|
},
|
|
107
107
|
|
|
108
|
+
// 接收途经点
|
|
109
|
+
onReceiveWayPoints(wayPoints) {
|
|
110
|
+
if (!this.mapInstance || !wayPoints) return
|
|
111
|
+
this.mapInstance.drawWayPoints(wayPoints)
|
|
112
|
+
},
|
|
113
|
+
|
|
108
114
|
// 接收检测对象
|
|
109
115
|
onReceiveDetectedObjects(objects) {
|
|
110
116
|
if (!this.mapInstance || !objects) return
|
package/lib/RjsRobotMap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
const _excluded = ["map", "path", "roomProperties", "forbiddenSweepZones", "forbiddenMopZones", "cleanZones", "virtualWalls", "spots", "detectedObjects", "customElements", "config", "runtime", "onMapReady"];
|
|
4
|
+
const _excluded = ["map", "path", "roomProperties", "forbiddenSweepZones", "forbiddenMopZones", "cleanZones", "virtualWalls", "spots", "wayPoints", "detectedObjects", "customElements", "config", "runtime", "onMapReady"];
|
|
5
5
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
6
6
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
7
7
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -29,6 +29,7 @@ const RjsRobotMap = _ref => {
|
|
|
29
29
|
cleanZones = [],
|
|
30
30
|
virtualWalls = [],
|
|
31
31
|
spots = [],
|
|
32
|
+
wayPoints = [],
|
|
32
33
|
detectedObjects = [],
|
|
33
34
|
customElements = [],
|
|
34
35
|
config,
|
|
@@ -87,6 +88,7 @@ const RjsRobotMap = _ref => {
|
|
|
87
88
|
cleanZones: cleanZones,
|
|
88
89
|
virtualWalls: virtualWalls,
|
|
89
90
|
spots: spots,
|
|
91
|
+
wayPoints: wayPoints,
|
|
90
92
|
detectedObjects: detectedObjects,
|
|
91
93
|
customElements: customElements,
|
|
92
94
|
config: config,
|
package/lib/RobotMap.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { AppOptions } from '@ray-js/robot-map-sdk';
|
|
3
3
|
import { RobotMapProps } from './props';
|
|
4
4
|
declare const RobotMap: {
|
|
5
|
-
({ map, path, roomProperties, forbiddenSweepZones, forbiddenMopZones, cleanZones, virtualWalls, spots, detectedObjects, customElements, onMapReady, config, runtime, ...callbacks }: RobotMapProps & AppOptions['events']): React.JSX.Element;
|
|
5
|
+
({ map, path, roomProperties, forbiddenSweepZones, forbiddenMopZones, cleanZones, virtualWalls, spots, wayPoints, detectedObjects, customElements, onMapReady, config, runtime, ...callbacks }: RobotMapProps & AppOptions['events']): React.JSX.Element;
|
|
6
6
|
defaultProps: RobotMapProps;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
package/lib/RobotMap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
const _excluded = ["map", "path", "roomProperties", "forbiddenSweepZones", "forbiddenMopZones", "cleanZones", "virtualWalls", "spots", "detectedObjects", "customElements", "onMapReady", "config", "runtime"];
|
|
3
|
+
const _excluded = ["map", "path", "roomProperties", "forbiddenSweepZones", "forbiddenMopZones", "cleanZones", "virtualWalls", "spots", "wayPoints", "detectedObjects", "customElements", "onMapReady", "config", "runtime"];
|
|
4
4
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
5
5
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
6
6
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -31,6 +31,7 @@ const RobotMap = _ref => {
|
|
|
31
31
|
cleanZones,
|
|
32
32
|
virtualWalls,
|
|
33
33
|
spots,
|
|
34
|
+
wayPoints,
|
|
34
35
|
detectedObjects,
|
|
35
36
|
customElements,
|
|
36
37
|
onMapReady,
|
|
@@ -52,6 +53,7 @@ const RobotMap = _ref => {
|
|
|
52
53
|
onReceiveCleanZones: () => {},
|
|
53
54
|
onReceiveVirtualWalls: () => {},
|
|
54
55
|
onReceiveSpots: () => {},
|
|
56
|
+
onReceiveWayPoints: () => {},
|
|
55
57
|
onReceiveDetectedObjects: () => {},
|
|
56
58
|
onReceiveCustomElements: () => {},
|
|
57
59
|
onUpdateRuntime: () => {}
|
|
@@ -98,6 +100,7 @@ const RobotMap = _ref => {
|
|
|
98
100
|
triggersRef.current.onReceiveCleanZones = invoke.current.bind('onReceiveCleanZones');
|
|
99
101
|
triggersRef.current.onReceiveVirtualWalls = invoke.current.bind('onReceiveVirtualWalls');
|
|
100
102
|
triggersRef.current.onReceiveSpots = invoke.current.bind('onReceiveSpots');
|
|
103
|
+
triggersRef.current.onReceiveWayPoints = invoke.current.bind('onReceiveWayPoints');
|
|
101
104
|
triggersRef.current.onReceiveDetectedObjects = invoke.current.bind('onReceiveDetectedObjects');
|
|
102
105
|
triggersRef.current.onReceiveCustomElements = invoke.current.bind('onReceiveCustomElements');
|
|
103
106
|
triggersRef.current.onUpdateRuntime = invoke.current.bind('onUpdateRuntime');
|
|
@@ -160,6 +163,11 @@ const RobotMap = _ref => {
|
|
|
160
163
|
triggersRef.current.onReceiveSpots(spots);
|
|
161
164
|
}
|
|
162
165
|
}, [spots, mapApi]);
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (mapApi && wayPoints) {
|
|
168
|
+
triggersRef.current.onReceiveWayPoints(wayPoints);
|
|
169
|
+
}
|
|
170
|
+
}, [wayPoints, mapApi]);
|
|
163
171
|
useEffect(() => {
|
|
164
172
|
if (mapApi && detectedObjects) {
|
|
165
173
|
triggersRef.current.onReceiveDetectedObjects(detectedObjects);
|
package/lib/props.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeepPartialAppConfig, DeepPartialRuntimeConfig, MapApi, RoomProperty, ZoneParam, VirtualWallParam, DetectedObjectParam, CustomElementParam, MapState, PathState, Point, RoomData, SpotParam } from '@ray-js/robot-map-sdk';
|
|
1
|
+
import { DeepPartialAppConfig, DeepPartialRuntimeConfig, MapApi, RoomProperty, ZoneParam, VirtualWallParam, DetectedObjectParam, CustomElementParam, MapState, PathState, Point, RoomData, SpotParam, WayPointParam } from '@ray-js/robot-map-sdk';
|
|
2
2
|
/**
|
|
3
3
|
* 机器人地图组件属性接口
|
|
4
4
|
*
|
|
@@ -62,6 +62,13 @@ export interface RobotMapProps {
|
|
|
62
62
|
* @description.en Spot clean points, the robot will perform cleaning operations at these points.
|
|
63
63
|
*/
|
|
64
64
|
spots?: SpotParam[];
|
|
65
|
+
/**
|
|
66
|
+
* @description.zh 途经点
|
|
67
|
+
* @description.en Way points
|
|
68
|
+
* @description.zh 路径点,机器人将在这些点之间巡航。
|
|
69
|
+
* @description.en Way points, the robot will move between these points.
|
|
70
|
+
*/
|
|
71
|
+
wayPoints?: WayPointParam[];
|
|
65
72
|
/**
|
|
66
73
|
* @description.zh 检测对象
|
|
67
74
|
* @description.en Detected objects
|
|
@@ -233,6 +240,15 @@ export interface RobotMapProps {
|
|
|
233
240
|
* @param.en spot - Updated spot clean data
|
|
234
241
|
*/
|
|
235
242
|
onUpdateSpot?: (spot: SpotParam) => void;
|
|
243
|
+
/**
|
|
244
|
+
* @description.zh 更新途经点的回调
|
|
245
|
+
* @description.en Callback when updating way point
|
|
246
|
+
* @description.zh 当用户操作途经点后触发。
|
|
247
|
+
* @description.en Triggered when user operates way point.
|
|
248
|
+
* @param.zh wayPoint - 更新后的途经点数据
|
|
249
|
+
* @param.en wayPoint - Updated way point data
|
|
250
|
+
*/
|
|
251
|
+
onUpdateWayPoint?: (wayPoint: WayPointParam) => void;
|
|
236
252
|
/**
|
|
237
253
|
* @description.zh 点击禁扫区域回调
|
|
238
254
|
* @description.en Callback when clicking forbidden sweep zone
|
|
@@ -278,6 +294,15 @@ export interface RobotMapProps {
|
|
|
278
294
|
* @param.en spot - Clicked spot clean data
|
|
279
295
|
*/
|
|
280
296
|
onClickSpot?: (spot: SpotParam) => void;
|
|
297
|
+
/**
|
|
298
|
+
* @description.zh 点击途经点回调
|
|
299
|
+
* @description.en Callback when clicking way point
|
|
300
|
+
* @description.zh 当用户点击途经点时触发。
|
|
301
|
+
* @description.en Triggered when user clicks way point.
|
|
302
|
+
* @param.zh wayPoint - 被点击的途经点数据
|
|
303
|
+
* @param.en wayPoint - Clicked way point data
|
|
304
|
+
*/
|
|
305
|
+
onClickWayPoint?: (wayPoint: WayPointParam) => void;
|
|
281
306
|
/**
|
|
282
307
|
* @description.zh 点击检测物体回调
|
|
283
308
|
* @description.en Callback when clicking detected object
|
|
@@ -305,5 +330,14 @@ export interface RobotMapProps {
|
|
|
305
330
|
* @param.en divider - Updated divider data
|
|
306
331
|
*/
|
|
307
332
|
onUpdateDivider?: (divider: Point[]) => void;
|
|
333
|
+
/**
|
|
334
|
+
* @description.zh 点击地图回调
|
|
335
|
+
* @description.en Callback when clicking map
|
|
336
|
+
* @description.zh 当用户点击地图时触发。
|
|
337
|
+
* @description.en Triggered when user clicks map.
|
|
338
|
+
* @param.zh point - 被点击的点数据
|
|
339
|
+
* @param.en point - Clicked point data
|
|
340
|
+
*/
|
|
341
|
+
onClickMap?: (point: Point) => void;
|
|
308
342
|
}
|
|
309
343
|
export declare const robotMapDefaultProps: RobotMapProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/robot-map",
|
|
3
|
-
"version": "0.0.2-beta-
|
|
3
|
+
"version": "0.0.2-beta-44",
|
|
4
4
|
"description": "机器人地图组件",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@ray-js/ray": "^1.7.39"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ray-js/robot-map-sdk": "0.0.3-beta-
|
|
36
|
+
"@ray-js/robot-map-sdk": "0.0.3-beta-49",
|
|
37
37
|
"clsx": "^1.2.1",
|
|
38
38
|
"nanoid": "^5.1.6"
|
|
39
39
|
},
|