@fleet-frontend/mower-maps 0.2.0-beta.48 → 0.2.0-beta.49

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/dist/index.esm.js CHANGED
@@ -26896,6 +26896,8 @@ const useChargingPile = ({ viewBox, rotation = 0 }) => {
26896
26896
  if (!svgElementDatas || !viewBox)
26897
26897
  return [];
26898
26898
  const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
26899
+ if (!chargingPiles)
26900
+ return [];
26899
26901
  const results = [];
26900
26902
  for (const element of chargingPiles) {
26901
26903
  const center = element.points?.[0];
@@ -26934,7 +26936,7 @@ const CharginPile = React__default.memo(({ viewBox, rotation = 0 }) => {
26934
26936
  pointerEvents: 'none',
26935
26937
  zIndex: 750,
26936
26938
  }), []);
26937
- return (jsx("div", { style: containerStyle, children: items.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
26939
+ return (jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsx("div", { className: "charging-pile", style: {
26938
26940
  position: 'absolute',
26939
26941
  width: item.size,
26940
26942
  height: item.size,
@@ -28826,7 +28828,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
28826
28828
  return bounds;
28827
28829
  };
28828
28830
  // 默认配置
28829
- const defaultMapConfig = DEFAULT_STYLES;
28831
+ const defaultMapConfig$1 = DEFAULT_STYLES;
28830
28832
  // 地图渲染器组件
28831
28833
  const MowerMapRenderer = forwardRef(({ sn, mowerIconConfig = {}, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
28832
28834
  // pathConfig,
@@ -28922,7 +28924,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
28922
28924
  ]);
28923
28925
  // 合并配置
28924
28926
  const mergedMapConfig = useMemo(() => {
28925
- return merge$1(defaultMapConfig, mapConfig);
28927
+ return merge$1(defaultMapConfig$1, mapConfig);
28926
28928
  }, [mapConfig]);
28927
28929
  const svgElementDatas = useMemo(() => {
28928
28930
  if (unStructMapData) {
@@ -29354,7 +29356,25 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29354
29356
  });
29355
29357
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29356
29358
 
29357
- const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300 }) => {
29359
+ // 默认配置
29360
+ const defaultMapConfig = DEFAULT_STYLES;
29361
+ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, mapConfig }) => {
29362
+ // 合并配置
29363
+ const mergedMapConfig = useMemo(() => {
29364
+ return merge$1(defaultMapConfig, mapConfig);
29365
+ }, [mapConfig]);
29366
+ const svgElementDatas = useMemo(() => {
29367
+ if (unStructMapData) {
29368
+ return (UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, mergedMapConfig || {}) ||
29369
+ {});
29370
+ }
29371
+ return UnifiedMapDataProcessor.processMapData(mapJson, mergedMapConfig || {}) || {};
29372
+ }, [unStructMapData, mergedMapConfig, mapJson]);
29373
+ const svgEditValue = useMemo(() => {
29374
+ return {
29375
+ svgElementDatas,
29376
+ };
29377
+ }, [svgElementDatas]);
29358
29378
  const svgElementData = useMemo(() => {
29359
29379
  if (unStructMapData) {
29360
29380
  const data = UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, DEFAULT_STYLES) || {};
@@ -29406,18 +29426,18 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
29406
29426
  height: maxWidth,
29407
29427
  };
29408
29428
  }, [boundaryViewBox, maxWidth]);
29409
- return (jsxs("div", { style: {
29410
- position: 'relative',
29411
- width: style.width,
29412
- height: style.height,
29413
- margin: '0 auto',
29414
- }, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
29415
- return svgElementData[key]?.map((element) => {
29416
- if (key === DataType.VISION_OFF)
29417
- return null;
29418
- return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
29419
- });
29420
- }) }), jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
29429
+ return (jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs("div", { style: {
29430
+ position: 'relative',
29431
+ width: style.width,
29432
+ height: style.height,
29433
+ margin: '0 auto',
29434
+ }, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
29435
+ return svgElementData[key]?.map((element) => {
29436
+ if (key === DataType.VISION_OFF)
29437
+ return null;
29438
+ return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element }, element.id) }, key));
29439
+ });
29440
+ }) }), jsx(CharginPile, { viewBox: boundaryViewBox || null, rotation: 0 })] }) }));
29421
29441
  });
29422
29442
 
29423
29443
  export { ALL_DIRECTION_SELECTED, AntennaData, BaseData, BoundaryData, BoundarySvgRender, ChannelData, ChargingPileData, CheckDoodleErrorType, CheckObstaclePointErrorType, ClickEventType, CreateStatus, DataType, DoodleData, MAX_DIRECTION_ANGLE, MIN_DIRECTION_ANGLE, MobileEditMode, MowGateData, MowerMapRenderer, ObstacleData, PathData, PlatformType, RecordFunctionEnum, RecordTypeEnum, RenderType, SCALE_FACTOR, SvgParserNative, UnifiedMapDataProcessor, VisionOffData, calculateMapGpsCenter, estimateGpsFromMapBounds, initBoundary, initChannel, initDoodle, initObstacle, initVisionOff, restorePointsFormat };
package/dist/index.js CHANGED
@@ -26916,6 +26916,8 @@ const useChargingPile = ({ viewBox, rotation = 0 }) => {
26916
26916
  if (!svgElementDatas || !viewBox)
26917
26917
  return [];
26918
26918
  const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
26919
+ if (!chargingPiles)
26920
+ return [];
26919
26921
  const results = [];
26920
26922
  for (const element of chargingPiles) {
26921
26923
  const center = element.points?.[0];
@@ -26954,7 +26956,7 @@ const CharginPile = React.memo(({ viewBox, rotation = 0 }) => {
26954
26956
  pointerEvents: 'none',
26955
26957
  zIndex: 750,
26956
26958
  }), []);
26957
- return (jsxRuntime.jsx("div", { style: containerStyle, children: items.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
26959
+ return (jsxRuntime.jsx("div", { style: containerStyle, children: items?.map((item, idx) => (jsxRuntime.jsx("div", { className: "charging-pile", style: {
26958
26960
  position: 'absolute',
26959
26961
  width: item.size,
26960
26962
  height: item.size,
@@ -28846,7 +28848,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
28846
28848
  return bounds;
28847
28849
  };
28848
28850
  // 默认配置
28849
- const defaultMapConfig = DEFAULT_STYLES;
28851
+ const defaultMapConfig$1 = DEFAULT_STYLES;
28850
28852
  // 地图渲染器组件
28851
28853
  const MowerMapRenderer = React.forwardRef(({ sn, mowerIconConfig = {}, platform = exports.PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
28852
28854
  // pathConfig,
@@ -28942,7 +28944,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
28942
28944
  ]);
28943
28945
  // 合并配置
28944
28946
  const mergedMapConfig = React.useMemo(() => {
28945
- return merge$1(defaultMapConfig, mapConfig);
28947
+ return merge$1(defaultMapConfig$1, mapConfig);
28946
28948
  }, [mapConfig]);
28947
28949
  const svgElementDatas = React.useMemo(() => {
28948
28950
  if (unStructMapData) {
@@ -29374,7 +29376,25 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29374
29376
  });
29375
29377
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29376
29378
 
29377
- const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300 }) => {
29379
+ // 默认配置
29380
+ const defaultMapConfig = DEFAULT_STYLES;
29381
+ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, mapConfig }) => {
29382
+ // 合并配置
29383
+ const mergedMapConfig = React.useMemo(() => {
29384
+ return merge$1(defaultMapConfig, mapConfig);
29385
+ }, [mapConfig]);
29386
+ const svgElementDatas = React.useMemo(() => {
29387
+ if (unStructMapData) {
29388
+ return (UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, mergedMapConfig || {}) ||
29389
+ {});
29390
+ }
29391
+ return UnifiedMapDataProcessor.processMapData(mapJson, mergedMapConfig || {}) || {};
29392
+ }, [unStructMapData, mergedMapConfig, mapJson]);
29393
+ const svgEditValue = React.useMemo(() => {
29394
+ return {
29395
+ svgElementDatas,
29396
+ };
29397
+ }, [svgElementDatas]);
29378
29398
  const svgElementData = React.useMemo(() => {
29379
29399
  if (unStructMapData) {
29380
29400
  const data = UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, DEFAULT_STYLES) || {};
@@ -29426,18 +29446,18 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
29426
29446
  height: maxWidth,
29427
29447
  };
29428
29448
  }, [boundaryViewBox, maxWidth]);
29429
- return (jsxRuntime.jsxs("div", { style: {
29430
- position: 'relative',
29431
- width: style.width,
29432
- height: style.height,
29433
- margin: '0 auto',
29434
- }, children: [jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
29435
- return svgElementData[key]?.map((element) => {
29436
- if (key === exports.DataType.VISION_OFF)
29437
- return null;
29438
- return (jsxRuntime.jsx(GElement, { type: key, data: svgElementData[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
29439
- });
29440
- }) }), jsxRuntime.jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
29449
+ return (jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsxs("div", { style: {
29450
+ position: 'relative',
29451
+ width: style.width,
29452
+ height: style.height,
29453
+ margin: '0 auto',
29454
+ }, children: [jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
29455
+ return svgElementData[key]?.map((element) => {
29456
+ if (key === exports.DataType.VISION_OFF)
29457
+ return null;
29458
+ return (jsxRuntime.jsx(GElement, { type: key, data: svgElementData[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element }, element.id) }, key));
29459
+ });
29460
+ }) }), jsxRuntime.jsx(CharginPile, { viewBox: boundaryViewBox || null, rotation: 0 })] }) }));
29441
29461
  });
29442
29462
 
29443
29463
  exports.ALL_DIRECTION_SELECTED = ALL_DIRECTION_SELECTED;
@@ -1,4 +1,4 @@
1
- import { MapData } from '../types';
1
+ import { MapConfig, MapData } from '../types';
2
2
  import React from 'react';
3
3
  import { UnstructMapData } from '../types';
4
4
  interface BoundarySvgRenderProps {
@@ -6,7 +6,9 @@ interface BoundarySvgRenderProps {
6
6
  unStructMapData: UnstructMapData;
7
7
  id: number;
8
8
  maxWidth?: number;
9
+ mapConfig?: MapConfig;
10
+ sn?: string;
9
11
  }
10
- declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
12
+ declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, mapConfig }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
11
13
  export default BoundarySvgRender;
12
14
  //# sourceMappingURL=BoundarySvgRender.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,iBAAiB,yEAC8B,sBAAsB,6CAuG1E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,oFACyC,sBAAsB,6CAmHrF,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useChargingPile.d.ts","sourceRoot":"","sources":["../../../src/render/charginPile/useChargingPile.ts"],"names":[],"mappings":"AAMA,UAAU,sBAAsB;IAC9B,OAAO,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,GAAI,uBAA2B,sBAAsB,uBAiChF,CAAC"}
1
+ {"version":3,"file":"useChargingPile.d.ts","sourceRoot":"","sources":["../../../src/render/charginPile/useChargingPile.ts"],"names":[],"mappings":"AAMA,UAAU,sBAAsB;IAC9B,OAAO,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,GAAI,uBAA2B,sBAAsB,uBAkChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleet-frontend/mower-maps",
3
- "version": "0.2.0-beta.48",
3
+ "version": "0.2.0-beta.49",
4
4
  "type": "module",
5
5
  "description": "a mower maps in google maps",
6
6
  "main": "dist/index.js",