@fleet-frontend/mower-maps 0.2.5-beta.31 → 0.2.5-beta.32
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/context/common.d.ts +0 -4
- package/dist/context/common.d.ts.map +1 -1
- package/dist/index.esm.js +8 -33
- package/dist/index.js +7 -32
- package/dist/render/BoundarySvgRender.d.ts +1 -1
- package/dist/render/BoundarySvgRender.d.ts.map +1 -1
- package/dist/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/render/svgElement/ChannelElement/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/render/svgElement/ChannelClipPath/constants.d.ts +0 -9
- package/dist/render/svgElement/ChannelClipPath/constants.d.ts.map +0 -1
package/dist/context/common.d.ts
CHANGED
|
@@ -37,8 +37,6 @@ interface CommonContextType {
|
|
|
37
37
|
/** 宿主服务端签名回调(优先于 googleMapStaticUrlSigningSecret) */
|
|
38
38
|
signGoogleStaticMapUrl?: (unsignedUrl: string) => Promise<string> | string;
|
|
39
39
|
onH5FirstSelectObstaclePoint?: () => void;
|
|
40
|
-
/** MowerMap 实例创建时内部生成的通道 clipPath id,同一实例内共用 */
|
|
41
|
-
channelClipPathId?: string;
|
|
42
40
|
}
|
|
43
41
|
export declare const CommonContext: import("react").Context<{
|
|
44
42
|
sn: string;
|
|
@@ -70,7 +68,6 @@ export declare const CommonContext: import("react").Context<{
|
|
|
70
68
|
locale: {};
|
|
71
69
|
signGoogleStaticMapUrl: any;
|
|
72
70
|
onH5FirstSelectObstaclePoint: any;
|
|
73
|
-
channelClipPathId: string;
|
|
74
71
|
}>;
|
|
75
72
|
export declare const CommonContextProvider: import("react").Provider<{
|
|
76
73
|
sn: string;
|
|
@@ -102,7 +99,6 @@ export declare const CommonContextProvider: import("react").Provider<{
|
|
|
102
99
|
locale: {};
|
|
103
100
|
signGoogleStaticMapUrl: any;
|
|
104
101
|
onH5FirstSelectObstaclePoint: any;
|
|
105
|
-
channelClipPathId: string;
|
|
106
102
|
}>;
|
|
107
103
|
export declare const useCommonContext: () => CommonContextType;
|
|
108
104
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/context/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,MAAM,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IACjC,qDAAqD;IACrD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3E,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/context/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,MAAM,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IACjC,qDAAqD;IACrD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3E,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,yBAAqD,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, useLayoutEffect, forwardRef, useImperativeHandle
|
|
3
|
+
import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
|
|
4
4
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
function globals (defs) {
|
|
@@ -22709,13 +22709,12 @@ const CommonContext = createContext({
|
|
|
22709
22709
|
locale: {},
|
|
22710
22710
|
signGoogleStaticMapUrl: undefined,
|
|
22711
22711
|
onH5FirstSelectObstaclePoint: undefined,
|
|
22712
|
-
channelClipPathId: '',
|
|
22713
22712
|
});
|
|
22714
22713
|
const CommonContextProvider = CommonContext.Provider;
|
|
22715
22714
|
const useCommonContext = () => useContext(CommonContext);
|
|
22716
22715
|
|
|
22717
22716
|
const ChannelClipPath = React__default.memo(() => {
|
|
22718
|
-
const { svgViewBox,
|
|
22717
|
+
const { svgViewBox, sn } = useCommonContext();
|
|
22719
22718
|
const { svgElementDatas } = useSvgEditContext();
|
|
22720
22719
|
const boundaryData = svgElementDatas?.[DataType.BOUNDARY] || [];
|
|
22721
22720
|
const [minX, minY, maxX, maxY] = useMemo(() => {
|
|
@@ -22894,7 +22893,7 @@ const ChannelClipPath = React__default.memo(() => {
|
|
|
22894
22893
|
});
|
|
22895
22894
|
return baseD;
|
|
22896
22895
|
}, [boundaryData, minX, minY, maxX, maxY]);
|
|
22897
|
-
return (jsx("defs", { children: jsx("clipPath", { id:
|
|
22896
|
+
return (jsx("defs", { children: jsx("clipPath", { id: `channel-clip-path-${sn}`, fillRule: "evenodd", children: jsx("path", { d: d }) }) }));
|
|
22898
22897
|
});
|
|
22899
22898
|
|
|
22900
22899
|
/**
|
|
@@ -25383,8 +25382,7 @@ const BoundaryElement = ({ data, isHover }) => {
|
|
|
25383
25382
|
};
|
|
25384
25383
|
|
|
25385
25384
|
const ChannelElement = ({ data }) => {
|
|
25386
|
-
const {
|
|
25387
|
-
const clipPathUrl = `url(#${channelClipPathId})`;
|
|
25385
|
+
const { sn } = useCommonContext();
|
|
25388
25386
|
const points = data.points;
|
|
25389
25387
|
const style = data.style;
|
|
25390
25388
|
let pathData = `M ${points[0][0]} ${points[0][1]}`;
|
|
@@ -25394,7 +25392,7 @@ const ChannelElement = ({ data }) => {
|
|
|
25394
25392
|
const topLineWidth = dp2px(style.lineWidth).toString();
|
|
25395
25393
|
const bottomLineWidth = dp2px(style.bottomLineWidth).toString();
|
|
25396
25394
|
const dashLength = dp2px(style.lineWidth);
|
|
25397
|
-
return (jsxs("g", { id: data.id.toString(), children: [jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath:
|
|
25395
|
+
return (jsxs("g", { id: data.id.toString(), children: [jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } }), jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } })] }));
|
|
25398
25396
|
};
|
|
25399
25397
|
|
|
25400
25398
|
/**
|
|
@@ -27121,7 +27119,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
27121
27119
|
justifyContent: 'center',
|
|
27122
27120
|
gap: '10px',
|
|
27123
27121
|
color: '#325069',
|
|
27124
|
-
}, children: jsxs("div", { children: [locale?.['map.renderer.
|
|
27122
|
+
}, children: jsxs("div", { children: [locale?.['map.renderer.remainTime'] || 'Remaining time', ": ", remainingTime] }) }) }) }))] }));
|
|
27125
27123
|
};
|
|
27126
27124
|
useEffect(() => {
|
|
27127
27125
|
const isMove = isDragging || isRotating || isScaling;
|
|
@@ -29750,22 +29748,6 @@ const SvgEditMap = forwardRef(({ mapConfig, onEditInfoMapChange, editMap }, ref)
|
|
|
29750
29748
|
});
|
|
29751
29749
|
SvgEditMap.displayName = 'SvgEditMap';
|
|
29752
29750
|
|
|
29753
|
-
/** 清理为合法的 SVG/HTML id 片段 */
|
|
29754
|
-
function sanitizeSvgIdPart(value) {
|
|
29755
|
-
return value.replace(/[^a-zA-Z0-9_.-]/g, '_');
|
|
29756
|
-
}
|
|
29757
|
-
/**
|
|
29758
|
-
* 通道 clipPath 的 SVG id
|
|
29759
|
-
* 组合 sn、useId、时间戳、随机数,避免同页多地图实例 id 冲突
|
|
29760
|
-
*/
|
|
29761
|
-
function createChannelClipPathId(params) {
|
|
29762
|
-
const snPart = sanitizeSvgIdPart(params.sn || 'map');
|
|
29763
|
-
const reactPart = sanitizeSvgIdPart(params.reactId.replace(/:/g, ''));
|
|
29764
|
-
const timestamp = Date.now();
|
|
29765
|
-
const randomPart = Math.random().toString(36).slice(2, 10);
|
|
29766
|
-
return `channel-clip-path-${snPart}-${reactPart}-${timestamp}-${randomPart}`;
|
|
29767
|
-
}
|
|
29768
|
-
|
|
29769
29751
|
var _path;
|
|
29770
29752
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
29771
29753
|
var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
|
|
@@ -29842,8 +29824,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
29842
29824
|
...INIT_EDIT_MAP_INFO,
|
|
29843
29825
|
});
|
|
29844
29826
|
const [mowingPartitions, setMowingPartitions] = useState([]);
|
|
29845
|
-
const reactInstanceId = useId();
|
|
29846
|
-
const channelClipPathId = useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
|
|
29847
29827
|
const minDistance = useMemo(() => {
|
|
29848
29828
|
return getMinSvgDistanceByModel(modelType);
|
|
29849
29829
|
}, [modelType]);
|
|
@@ -30078,7 +30058,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
30078
30058
|
locale,
|
|
30079
30059
|
signGoogleStaticMapUrl,
|
|
30080
30060
|
onH5FirstSelectObstaclePoint,
|
|
30081
|
-
channelClipPathId,
|
|
30082
30061
|
};
|
|
30083
30062
|
}, [
|
|
30084
30063
|
sn,
|
|
@@ -30105,7 +30084,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
30105
30084
|
locale,
|
|
30106
30085
|
signGoogleStaticMapUrl,
|
|
30107
30086
|
onH5FirstSelectObstaclePoint,
|
|
30108
|
-
channelClipPathId,
|
|
30109
30087
|
]);
|
|
30110
30088
|
/**
|
|
30111
30089
|
* 这里做了一个配置,以防以后如果有多种不同的类型的情况,需要展示不同的元素
|
|
@@ -30450,9 +30428,7 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
|
30450
30428
|
|
|
30451
30429
|
// 默认配置
|
|
30452
30430
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
30453
|
-
const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn
|
|
30454
|
-
const reactInstanceId = useId();
|
|
30455
|
-
const channelClipPathId = useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
|
|
30431
|
+
const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
|
|
30456
30432
|
// 合并配置
|
|
30457
30433
|
const mergedMapConfig = useMemo(() => {
|
|
30458
30434
|
return merge$1(defaultMapConfig, mapConfig);
|
|
@@ -30512,9 +30488,8 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
|
|
|
30512
30488
|
return {
|
|
30513
30489
|
sn,
|
|
30514
30490
|
svgViewBox: boundaryViewBox,
|
|
30515
|
-
channelClipPathId,
|
|
30516
30491
|
};
|
|
30517
|
-
}, [sn, boundaryViewBox
|
|
30492
|
+
}, [sn, boundaryViewBox]);
|
|
30518
30493
|
const style = useMemo(() => {
|
|
30519
30494
|
if (!maxHeight) {
|
|
30520
30495
|
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
package/dist/index.js
CHANGED
|
@@ -22729,13 +22729,12 @@ const CommonContext = React.createContext({
|
|
|
22729
22729
|
locale: {},
|
|
22730
22730
|
signGoogleStaticMapUrl: undefined,
|
|
22731
22731
|
onH5FirstSelectObstaclePoint: undefined,
|
|
22732
|
-
channelClipPathId: '',
|
|
22733
22732
|
});
|
|
22734
22733
|
const CommonContextProvider = CommonContext.Provider;
|
|
22735
22734
|
const useCommonContext = () => React.useContext(CommonContext);
|
|
22736
22735
|
|
|
22737
22736
|
const ChannelClipPath = React.memo(() => {
|
|
22738
|
-
const { svgViewBox,
|
|
22737
|
+
const { svgViewBox, sn } = useCommonContext();
|
|
22739
22738
|
const { svgElementDatas } = useSvgEditContext();
|
|
22740
22739
|
const boundaryData = svgElementDatas?.[exports.DataType.BOUNDARY] || [];
|
|
22741
22740
|
const [minX, minY, maxX, maxY] = React.useMemo(() => {
|
|
@@ -22914,7 +22913,7 @@ const ChannelClipPath = React.memo(() => {
|
|
|
22914
22913
|
});
|
|
22915
22914
|
return baseD;
|
|
22916
22915
|
}, [boundaryData, minX, minY, maxX, maxY]);
|
|
22917
|
-
return (jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id:
|
|
22916
|
+
return (jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: `channel-clip-path-${sn}`, fillRule: "evenodd", children: jsxRuntime.jsx("path", { d: d }) }) }));
|
|
22918
22917
|
});
|
|
22919
22918
|
|
|
22920
22919
|
/**
|
|
@@ -25403,8 +25402,7 @@ const BoundaryElement = ({ data, isHover }) => {
|
|
|
25403
25402
|
};
|
|
25404
25403
|
|
|
25405
25404
|
const ChannelElement = ({ data }) => {
|
|
25406
|
-
const {
|
|
25407
|
-
const clipPathUrl = `url(#${channelClipPathId})`;
|
|
25405
|
+
const { sn } = useCommonContext();
|
|
25408
25406
|
const points = data.points;
|
|
25409
25407
|
const style = data.style;
|
|
25410
25408
|
let pathData = `M ${points[0][0]} ${points[0][1]}`;
|
|
@@ -25414,7 +25412,7 @@ const ChannelElement = ({ data }) => {
|
|
|
25414
25412
|
const topLineWidth = dp2px(style.lineWidth).toString();
|
|
25415
25413
|
const bottomLineWidth = dp2px(style.bottomLineWidth).toString();
|
|
25416
25414
|
const dashLength = dp2px(style.lineWidth);
|
|
25417
|
-
return (jsxRuntime.jsxs("g", { id: data.id.toString(), children: [jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath:
|
|
25415
|
+
return (jsxRuntime.jsxs("g", { id: data.id.toString(), children: [jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } }), jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } })] }));
|
|
25418
25416
|
};
|
|
25419
25417
|
|
|
25420
25418
|
/**
|
|
@@ -27141,7 +27139,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
27141
27139
|
justifyContent: 'center',
|
|
27142
27140
|
gap: '10px',
|
|
27143
27141
|
color: '#325069',
|
|
27144
|
-
}, children: jsxRuntime.jsxs("div", { children: [locale?.['map.renderer.
|
|
27142
|
+
}, children: jsxRuntime.jsxs("div", { children: [locale?.['map.renderer.remainTime'] || 'Remaining time', ": ", remainingTime] }) }) }) }))] }));
|
|
27145
27143
|
};
|
|
27146
27144
|
React.useEffect(() => {
|
|
27147
27145
|
const isMove = isDragging || isRotating || isScaling;
|
|
@@ -29770,22 +29768,6 @@ const SvgEditMap = React.forwardRef(({ mapConfig, onEditInfoMapChange, editMap }
|
|
|
29770
29768
|
});
|
|
29771
29769
|
SvgEditMap.displayName = 'SvgEditMap';
|
|
29772
29770
|
|
|
29773
|
-
/** 清理为合法的 SVG/HTML id 片段 */
|
|
29774
|
-
function sanitizeSvgIdPart(value) {
|
|
29775
|
-
return value.replace(/[^a-zA-Z0-9_.-]/g, '_');
|
|
29776
|
-
}
|
|
29777
|
-
/**
|
|
29778
|
-
* 通道 clipPath 的 SVG id
|
|
29779
|
-
* 组合 sn、useId、时间戳、随机数,避免同页多地图实例 id 冲突
|
|
29780
|
-
*/
|
|
29781
|
-
function createChannelClipPathId(params) {
|
|
29782
|
-
const snPart = sanitizeSvgIdPart(params.sn || 'map');
|
|
29783
|
-
const reactPart = sanitizeSvgIdPart(params.reactId.replace(/:/g, ''));
|
|
29784
|
-
const timestamp = Date.now();
|
|
29785
|
-
const randomPart = Math.random().toString(36).slice(2, 10);
|
|
29786
|
-
return `channel-clip-path-${snPart}-${reactPart}-${timestamp}-${randomPart}`;
|
|
29787
|
-
}
|
|
29788
|
-
|
|
29789
29771
|
var _path;
|
|
29790
29772
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
29791
29773
|
var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
|
|
@@ -29862,8 +29844,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
29862
29844
|
...INIT_EDIT_MAP_INFO,
|
|
29863
29845
|
});
|
|
29864
29846
|
const [mowingPartitions, setMowingPartitions] = React.useState([]);
|
|
29865
|
-
const reactInstanceId = React.useId();
|
|
29866
|
-
const channelClipPathId = React.useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
|
|
29867
29847
|
const minDistance = React.useMemo(() => {
|
|
29868
29848
|
return getMinSvgDistanceByModel(modelType);
|
|
29869
29849
|
}, [modelType]);
|
|
@@ -30098,7 +30078,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
30098
30078
|
locale,
|
|
30099
30079
|
signGoogleStaticMapUrl,
|
|
30100
30080
|
onH5FirstSelectObstaclePoint,
|
|
30101
|
-
channelClipPathId,
|
|
30102
30081
|
};
|
|
30103
30082
|
}, [
|
|
30104
30083
|
sn,
|
|
@@ -30125,7 +30104,6 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
|
|
|
30125
30104
|
locale,
|
|
30126
30105
|
signGoogleStaticMapUrl,
|
|
30127
30106
|
onH5FirstSelectObstaclePoint,
|
|
30128
|
-
channelClipPathId,
|
|
30129
30107
|
]);
|
|
30130
30108
|
/**
|
|
30131
30109
|
* 这里做了一个配置,以防以后如果有多种不同的类型的情况,需要展示不同的元素
|
|
@@ -30470,9 +30448,7 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
|
30470
30448
|
|
|
30471
30449
|
// 默认配置
|
|
30472
30450
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
30473
|
-
const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn
|
|
30474
|
-
const reactInstanceId = React.useId();
|
|
30475
|
-
const channelClipPathId = React.useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
|
|
30451
|
+
const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
|
|
30476
30452
|
// 合并配置
|
|
30477
30453
|
const mergedMapConfig = React.useMemo(() => {
|
|
30478
30454
|
return merge$1(defaultMapConfig, mapConfig);
|
|
@@ -30532,9 +30508,8 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
|
|
|
30532
30508
|
return {
|
|
30533
30509
|
sn,
|
|
30534
30510
|
svgViewBox: boundaryViewBox,
|
|
30535
|
-
channelClipPathId,
|
|
30536
30511
|
};
|
|
30537
|
-
}, [sn, boundaryViewBox
|
|
30512
|
+
}, [sn, boundaryViewBox]);
|
|
30538
30513
|
const style = React.useMemo(() => {
|
|
30539
30514
|
if (!maxHeight) {
|
|
30540
30515
|
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
@@ -11,6 +11,6 @@ interface BoundarySvgRenderProps {
|
|
|
11
11
|
mapConfig?: MapConfig;
|
|
12
12
|
sn?: string;
|
|
13
13
|
}
|
|
14
|
-
declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, maxHeight, boundaryPadding, mapConfig, sn
|
|
14
|
+
declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, maxHeight, boundaryPadding, mapConfig, sn }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
15
|
export default BoundarySvgRender;
|
|
16
16
|
//# 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,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,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;AAM3C,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,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,oHAC8E,sBAAsB,6CA4I1H,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAwBf,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AA0B3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAMD,eAAO,MAAM,gBAAgB,mGAy1B5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,GAAI,UAAU,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,GAAI,UAAU,mBAAmB,4CAqCpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelClipPath/constants.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMxF"}
|