@fleet-frontend/mower-maps 0.2.0-beta.47 → 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
@@ -25765,10 +25765,15 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
25765
25765
  if (!editMap)
25766
25766
  return false;
25767
25767
  if (platform === PlatformType.H5) {
25768
- return editMapInfo?.elementType === DataType.DOODLE;
25768
+ // return editMapInfo?.elementType === DataType.DOODLE;
25769
+ if (editMapInfo.mobileMode === MobileEditMode.CREATE ||
25770
+ editMapInfo.mobileMode === MobileEditMode.EDIT) {
25771
+ return false;
25772
+ }
25773
+ return true;
25769
25774
  }
25770
25775
  return !editMapInfo?.elementType;
25771
- }, [editMapInfo?.elementType, platform, editMap]);
25776
+ }, [editMapInfo?.elementType, editMapInfo.mobileMode, platform, editMap]);
25772
25777
  // 将 DoodleData 转换为父 SVG 坐标系的元素点数组
25773
25778
  const transformedElements = useMemo(() => {
25774
25779
  return transformSvgElements(data);
@@ -26891,6 +26896,8 @@ const useChargingPile = ({ viewBox, rotation = 0 }) => {
26891
26896
  if (!svgElementDatas || !viewBox)
26892
26897
  return [];
26893
26898
  const chargingPiles = svgElementDatas?.[DataType.CHARGING_PILE];
26899
+ if (!chargingPiles)
26900
+ return [];
26894
26901
  const results = [];
26895
26902
  for (const element of chargingPiles) {
26896
26903
  const center = element.points?.[0];
@@ -26929,7 +26936,7 @@ const CharginPile = React__default.memo(({ viewBox, rotation = 0 }) => {
26929
26936
  pointerEvents: 'none',
26930
26937
  zIndex: 750,
26931
26938
  }), []);
26932
- 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: {
26933
26940
  position: 'absolute',
26934
26941
  width: item.size,
26935
26942
  height: item.size,
@@ -28821,7 +28828,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
28821
28828
  return bounds;
28822
28829
  };
28823
28830
  // 默认配置
28824
- const defaultMapConfig = DEFAULT_STYLES;
28831
+ const defaultMapConfig$1 = DEFAULT_STYLES;
28825
28832
  // 地图渲染器组件
28826
28833
  const MowerMapRenderer = forwardRef(({ sn, mowerIconConfig = {}, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
28827
28834
  // pathConfig,
@@ -28917,7 +28924,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
28917
28924
  ]);
28918
28925
  // 合并配置
28919
28926
  const mergedMapConfig = useMemo(() => {
28920
- return merge$1(defaultMapConfig, mapConfig);
28927
+ return merge$1(defaultMapConfig$1, mapConfig);
28921
28928
  }, [mapConfig]);
28922
28929
  const svgElementDatas = useMemo(() => {
28923
28930
  if (unStructMapData) {
@@ -29349,7 +29356,25 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29349
29356
  });
29350
29357
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29351
29358
 
29352
- 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]);
29353
29378
  const svgElementData = useMemo(() => {
29354
29379
  if (unStructMapData) {
29355
29380
  const data = UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, DEFAULT_STYLES) || {};
@@ -29401,18 +29426,18 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
29401
29426
  height: maxWidth,
29402
29427
  };
29403
29428
  }, [boundaryViewBox, maxWidth]);
29404
- return (jsxs("div", { style: {
29405
- position: 'relative',
29406
- width: style.width,
29407
- height: style.height,
29408
- margin: '0 auto',
29409
- }, 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) => {
29410
- return svgElementData[key]?.map((element) => {
29411
- if (key === DataType.VISION_OFF)
29412
- return null;
29413
- return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
29414
- });
29415
- }) }), 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 })] }) }));
29416
29441
  });
29417
29442
 
29418
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
@@ -25785,10 +25785,15 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
25785
25785
  if (!editMap)
25786
25786
  return false;
25787
25787
  if (platform === exports.PlatformType.H5) {
25788
- return editMapInfo?.elementType === exports.DataType.DOODLE;
25788
+ // return editMapInfo?.elementType === DataType.DOODLE;
25789
+ if (editMapInfo.mobileMode === exports.MobileEditMode.CREATE ||
25790
+ editMapInfo.mobileMode === exports.MobileEditMode.EDIT) {
25791
+ return false;
25792
+ }
25793
+ return true;
25789
25794
  }
25790
25795
  return !editMapInfo?.elementType;
25791
- }, [editMapInfo?.elementType, platform, editMap]);
25796
+ }, [editMapInfo?.elementType, editMapInfo.mobileMode, platform, editMap]);
25792
25797
  // 将 DoodleData 转换为父 SVG 坐标系的元素点数组
25793
25798
  const transformedElements = React.useMemo(() => {
25794
25799
  return transformSvgElements(data);
@@ -26911,6 +26916,8 @@ const useChargingPile = ({ viewBox, rotation = 0 }) => {
26911
26916
  if (!svgElementDatas || !viewBox)
26912
26917
  return [];
26913
26918
  const chargingPiles = svgElementDatas?.[exports.DataType.CHARGING_PILE];
26919
+ if (!chargingPiles)
26920
+ return [];
26914
26921
  const results = [];
26915
26922
  for (const element of chargingPiles) {
26916
26923
  const center = element.points?.[0];
@@ -26949,7 +26956,7 @@ const CharginPile = React.memo(({ viewBox, rotation = 0 }) => {
26949
26956
  pointerEvents: 'none',
26950
26957
  zIndex: 750,
26951
26958
  }), []);
26952
- 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: {
26953
26960
  position: 'absolute',
26954
26961
  width: item.size,
26955
26962
  height: item.size,
@@ -28841,7 +28848,7 @@ const getValidGpsBounds = (mapData, rotation = 0) => {
28841
28848
  return bounds;
28842
28849
  };
28843
28850
  // 默认配置
28844
- const defaultMapConfig = DEFAULT_STYLES;
28851
+ const defaultMapConfig$1 = DEFAULT_STYLES;
28845
28852
  // 地图渲染器组件
28846
28853
  const MowerMapRenderer = React.forwardRef(({ sn, mowerIconConfig = {}, platform = exports.PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
28847
28854
  // pathConfig,
@@ -28937,7 +28944,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
28937
28944
  ]);
28938
28945
  // 合并配置
28939
28946
  const mergedMapConfig = React.useMemo(() => {
28940
- return merge$1(defaultMapConfig, mapConfig);
28947
+ return merge$1(defaultMapConfig$1, mapConfig);
28941
28948
  }, [mapConfig]);
28942
28949
  const svgElementDatas = React.useMemo(() => {
28943
28950
  if (unStructMapData) {
@@ -29369,7 +29376,25 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29369
29376
  });
29370
29377
  MowerMapRenderer.displayName = 'MowerMapRenderer';
29371
29378
 
29372
- 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]);
29373
29398
  const svgElementData = React.useMemo(() => {
29374
29399
  if (unStructMapData) {
29375
29400
  const data = UnifiedMapDataProcessor.processUnstructMapData(unStructMapData, DEFAULT_STYLES) || {};
@@ -29421,18 +29446,18 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
29421
29446
  height: maxWidth,
29422
29447
  };
29423
29448
  }, [boundaryViewBox, maxWidth]);
29424
- return (jsxRuntime.jsxs("div", { style: {
29425
- position: 'relative',
29426
- width: style.width,
29427
- height: style.height,
29428
- margin: '0 auto',
29429
- }, 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) => {
29430
- return svgElementData[key]?.map((element) => {
29431
- if (key === exports.DataType.VISION_OFF)
29432
- return null;
29433
- return (jsxRuntime.jsx(GElement, { type: key, data: svgElementData[key], children: jsxRuntime.jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
29434
- });
29435
- }) }), 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 })] }) }));
29436
29461
  });
29437
29462
 
29438
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/DoodleTransform/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAO3D,UAAU,oBAAoB;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,QAAA,MAAM,eAAe,GAAI,6CAA6C,oBAAoB,4CAwGzF,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/DoodleTransform/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAO3D,UAAU,oBAAoB;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,QAAA,MAAM,eAAe,GAAI,6CAA6C,oBAAoB,4CA+GzF,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleet-frontend/mower-maps",
3
- "version": "0.2.0-beta.47",
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",