@fleet-frontend/mower-maps 0.2.6-beta.1 → 0.2.6-beta.3
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 +118 -82
- package/dist/index.js +118 -82
- package/dist/render/MowerPartitionPickerMap.d.ts +1 -1
- package/dist/render/MowerPartitionPickerMap.d.ts.map +1 -1
- package/dist/render/partitionPicker/constants.d.ts +35 -34
- package/dist/render/partitionPicker/constants.d.ts.map +1 -1
- package/dist/render/partitionPicker/hooks/useGoogleMapsOverlay.d.ts.map +1 -1
- package/dist/render/partitionPicker/hooks/useMapViewport.d.ts.map +1 -1
- package/dist/render/partitionPicker/layers/PartitionNameLabels.d.ts +1 -3
- package/dist/render/partitionPicker/layers/PartitionNameLabels.d.ts.map +1 -1
- package/dist/render/partitionPicker/layers/PartitionPickerGridSvg.d.ts.map +1 -1
- package/dist/render/partitionPicker/layers/PartitionPickerSvg.d.ts +1 -2
- package/dist/render/partitionPicker/layers/PartitionPickerSvg.d.ts.map +1 -1
- package/dist/render/partitionPicker/layers/SelectableBoundaryElement.d.ts +2 -4
- package/dist/render/partitionPicker/layers/SelectableBoundaryElement.d.ts.map +1 -1
- package/dist/render/partitionPicker/types.d.ts +1 -1
- package/dist/render/partitionPicker/types.d.ts.map +1 -1
- package/dist/render/partitionPicker/viewportUtils.d.ts +6 -7
- package/dist/render/partitionPicker/viewportUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23568,15 +23568,13 @@ function computePolygonScreenWidthPx(points, viewBox, containerWidth, containerH
|
|
|
23568
23568
|
const scale = getViewBoxMeetScale(viewBox, containerWidth, containerHeight);
|
|
23569
23569
|
return mapWidth * scale;
|
|
23570
23570
|
}
|
|
23571
|
-
function scaleStrokeWidthForViewBox(
|
|
23572
|
-
const { containerWidth, containerHeight,
|
|
23571
|
+
function scaleStrokeWidthForViewBox(viewBox, options) {
|
|
23572
|
+
const { containerWidth, containerHeight, targetScreenStrokePx = 2 } = options;
|
|
23573
23573
|
const meetScale = getViewBoxMeetScale(viewBox, containerWidth, containerHeight);
|
|
23574
|
-
|
|
23575
|
-
|
|
23576
|
-
return baseStrokeWidth;
|
|
23574
|
+
if (meetScale <= 0 || !Number.isFinite(targetScreenStrokePx)) {
|
|
23575
|
+
return targetScreenStrokePx;
|
|
23577
23576
|
}
|
|
23578
|
-
|
|
23579
|
-
return targetScreenPx / meetScale;
|
|
23577
|
+
return targetScreenStrokePx / meetScale;
|
|
23580
23578
|
}
|
|
23581
23579
|
/** 屏幕拖拽像素 → viewBox 坐标增量(与 mapPointToContainerPercent 互逆,供 applyPan 使用) */
|
|
23582
23580
|
function containerDeltaToViewBoxDelta(deltaXPx, deltaYPx, viewBox, containerWidth, containerHeight, mapRotationDeg = 0) {
|
|
@@ -30864,15 +30862,27 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
|
|
|
30864
30862
|
});
|
|
30865
30863
|
|
|
30866
30864
|
/** ChannelClipPath 等内容裁剪使用的 SVG 坐标边距(与用户传入的屏幕 padding 无关) */
|
|
30867
|
-
const PARTITION_PICKER_CONTENT_CLIP_PADDING =
|
|
30865
|
+
const PARTITION_PICKER_CONTENT_CLIP_PADDING = 0;
|
|
30868
30866
|
/** H5:子区域屏幕宽度超过该值才展示名称标签(px) */
|
|
30869
|
-
const H5_PARTITION_LABEL_MIN_SCREEN_WIDTH_PX =
|
|
30867
|
+
const H5_PARTITION_LABEL_MIN_SCREEN_WIDTH_PX = 92;
|
|
30870
30868
|
/** H5:名称气泡总宽度(px) */
|
|
30871
|
-
const H5_PARTITION_LABEL_WIDTH_PX =
|
|
30872
|
-
/**
|
|
30873
|
-
const
|
|
30874
|
-
/**
|
|
30875
|
-
const
|
|
30869
|
+
const H5_PARTITION_LABEL_WIDTH_PX = 92;
|
|
30870
|
+
/** Web:序号徽章与名称标签间距(px) */
|
|
30871
|
+
const WEB_SELECTION_ORDER_GAP_PX = 8;
|
|
30872
|
+
/** H5:序号徽章与名称标签间距(px) */
|
|
30873
|
+
const H5_SELECTION_ORDER_GAP_PX = 4;
|
|
30874
|
+
/** Standalone:充电桩图标最小屏幕尺寸(px),缩小全图 fit 时避免过小;放大时随 viewBox 同比缩放 */
|
|
30875
|
+
const PARTITION_PICKER_CHARGING_PILE_MIN_DISPLAY_PX = 16;
|
|
30876
|
+
/** Web 地块描边屏幕像素宽度:未选中 2px,选中 3px */
|
|
30877
|
+
const WEB_PARTITION_BOUNDARY_STROKE_PX = {
|
|
30878
|
+
default: 2,
|
|
30879
|
+
selected: 3,
|
|
30880
|
+
};
|
|
30881
|
+
/** H5 地块描边屏幕像素宽度:选中与否均为 1px */
|
|
30882
|
+
const H5_PARTITION_BOUNDARY_STROKE_PX = {
|
|
30883
|
+
default: 1,
|
|
30884
|
+
selected: 1,
|
|
30885
|
+
};
|
|
30876
30886
|
/**
|
|
30877
30887
|
* Figma bg/mapping 地图网格背景(Standalone SVG 层)
|
|
30878
30888
|
* @see https://www.figma.com/design/j0DdUYf8VFkXQ8ikkA6ZzP — node 20490:84886
|
|
@@ -30880,17 +30890,17 @@ const PARTITION_BOUNDARY_EMPHASIZED_TARGET_SCREEN_STROKE_PX = 2.5;
|
|
|
30880
30890
|
/** 网格区域底色,也用于容器 letterbox 留白 */
|
|
30881
30891
|
const PARTITION_PICKER_GRID_BASE_COLOR = '#E3E5EB';
|
|
30882
30892
|
/** 网格单元边长(SVG 地图坐标,与 viewBox 一致;zoom 时间距同比缩放) */
|
|
30883
|
-
const PARTITION_PICKER_GRID_TILE_SIZE =
|
|
30893
|
+
const PARTITION_PICKER_GRID_TILE_SIZE = 10;
|
|
30884
30894
|
/** 网格线宽(地图坐标;随 zoom 同比缩放,不做屏幕像素恒定) */
|
|
30885
|
-
const PARTITION_PICKER_GRID_LINE_WIDTH =
|
|
30895
|
+
const PARTITION_PICKER_GRID_LINE_WIDTH = 0.5;
|
|
30886
30896
|
/** 网格交点圆点半径(地图坐标) */
|
|
30887
|
-
const PARTITION_PICKER_GRID_DOT_RADIUS =
|
|
30897
|
+
const PARTITION_PICKER_GRID_DOT_RADIUS = 0.5;
|
|
30888
30898
|
/** 网格层整体不透明度(Figma 约 80%) */
|
|
30889
|
-
const PARTITION_PICKER_GRID_OPACITY = 0.
|
|
30899
|
+
const PARTITION_PICKER_GRID_OPACITY = 0.4;
|
|
30890
30900
|
/** 网格线与交点颜色 */
|
|
30891
30901
|
const PARTITION_PICKER_GRID_STROKE = '#FFFFFF';
|
|
30892
30902
|
/** 可见范围内交点超过该数量时跳过圆点,仅保留网格线(缩小视野时减轻 DOM 压力) */
|
|
30893
|
-
const PARTITION_PICKER_GRID_MAX_INTERSECTION_DOTS =
|
|
30903
|
+
const PARTITION_PICKER_GRID_MAX_INTERSECTION_DOTS = 2000;
|
|
30894
30904
|
/**
|
|
30895
30905
|
* 分区选择地图专用样式
|
|
30896
30906
|
*
|
|
@@ -30915,37 +30925,27 @@ const PARTITION_PICKER_MAP_CONFIG = {
|
|
|
30915
30925
|
const PARTITION_PICKER_COLORS_WEB = {
|
|
30916
30926
|
defaultFill: 'rgba(222, 225, 231, 1)',
|
|
30917
30927
|
defaultStroke: 'rgba(132, 152, 169, 1)',
|
|
30918
|
-
defaultStrokeWidth: 2,
|
|
30919
30928
|
hoverFill: 'rgba(211, 216, 226, 1)',
|
|
30920
30929
|
hoverStroke: 'rgba(132, 152, 169, 1)',
|
|
30921
|
-
hoverStrokeWidth: 3,
|
|
30922
30930
|
selectedFill: 'rgba(202, 214, 238, 1)',
|
|
30923
30931
|
selectedStroke: 'rgba(132, 152, 169, 1)',
|
|
30924
|
-
selectedStrokeWidth: 3,
|
|
30925
30932
|
selectedHoverFill: 'rgba(202, 214, 238, 1)',
|
|
30926
30933
|
selectedHoverStroke: 'rgba(132, 152, 169, 1)',
|
|
30927
|
-
selectedHoverStrokeWidth: 3,
|
|
30928
30934
|
isolatedFill: 'rgba(225, 227, 233, 1)',
|
|
30929
30935
|
isolatedStroke: 'rgba(189, 198, 208, 1)',
|
|
30930
|
-
isolatedStrokeWidth: 2,
|
|
30931
30936
|
};
|
|
30932
30937
|
/** H5 端地块配色 */
|
|
30933
30938
|
const PARTITION_PICKER_COLORS_H5 = {
|
|
30934
30939
|
defaultFill: 'rgba(222, 225, 231, 1)',
|
|
30935
30940
|
defaultStroke: 'rgba(132, 152, 169, 1)',
|
|
30936
|
-
defaultStrokeWidth: 1,
|
|
30937
30941
|
hoverFill: 'rgba(222, 225, 231, 1)',
|
|
30938
30942
|
hoverStroke: 'rgba(132, 152, 169, 1)',
|
|
30939
|
-
hoverStrokeWidth: 1,
|
|
30940
30943
|
selectedFill: 'rgba(202, 214, 238, 1)',
|
|
30941
30944
|
selectedStroke: 'rgba(132, 152, 169, 1)',
|
|
30942
|
-
selectedStrokeWidth: 1,
|
|
30943
30945
|
selectedHoverFill: 'rgba(202, 214, 238, 1)',
|
|
30944
30946
|
selectedHoverStroke: 'rgba(132, 152, 169, 1)',
|
|
30945
|
-
selectedHoverStrokeWidth: 1,
|
|
30946
30947
|
isolatedFill: 'rgba(225, 227, 233, 1)',
|
|
30947
30948
|
isolatedStroke: 'rgba(189, 198, 208, 1)',
|
|
30948
|
-
isolatedStrokeWidth: 1,
|
|
30949
30949
|
};
|
|
30950
30950
|
function getPartitionPickerMapConfig(platform = exports.PlatformType.WEB) {
|
|
30951
30951
|
return platform === exports.PlatformType.WEB
|
|
@@ -30955,6 +30955,11 @@ function getPartitionPickerMapConfig(platform = exports.PlatformType.WEB) {
|
|
|
30955
30955
|
function getPartitionPickerColors(platform = exports.PlatformType.WEB) {
|
|
30956
30956
|
return platform === exports.PlatformType.WEB ? PARTITION_PICKER_COLORS_WEB : PARTITION_PICKER_COLORS_H5;
|
|
30957
30957
|
}
|
|
30958
|
+
function getPartitionPickerBoundaryStrokePx(platform = exports.PlatformType.WEB) {
|
|
30959
|
+
return platform === exports.PlatformType.WEB
|
|
30960
|
+
? { ...WEB_PARTITION_BOUNDARY_STROKE_PX }
|
|
30961
|
+
: { ...H5_PARTITION_BOUNDARY_STROKE_PX };
|
|
30962
|
+
}
|
|
30958
30963
|
/** Web 分区名气泡(Figma「地块名称」/ 选中区域) */
|
|
30959
30964
|
const PARTITION_PICKER_LABEL_STYLES_WEB = {
|
|
30960
30965
|
default: {
|
|
@@ -30995,6 +31000,7 @@ const PARTITION_PICKER_LABEL_STYLES_H5 = {
|
|
|
30995
31000
|
fontWeight: 400,
|
|
30996
31001
|
padding: '6px',
|
|
30997
31002
|
width: `${H5_PARTITION_LABEL_WIDTH_PX}px`,
|
|
31003
|
+
maxWidth: `${H5_PARTITION_LABEL_WIDTH_PX}px`,
|
|
30998
31004
|
borderRadius: 100,
|
|
30999
31005
|
boxSizing: 'border-box',
|
|
31000
31006
|
},
|
|
@@ -31005,6 +31011,7 @@ const PARTITION_PICKER_LABEL_STYLES_H5 = {
|
|
|
31005
31011
|
fontWeight: 400,
|
|
31006
31012
|
padding: '6px',
|
|
31007
31013
|
width: `${H5_PARTITION_LABEL_WIDTH_PX}px`,
|
|
31014
|
+
maxWidth: `${H5_PARTITION_LABEL_WIDTH_PX}px`,
|
|
31008
31015
|
borderRadius: 100,
|
|
31009
31016
|
boxSizing: 'border-box',
|
|
31010
31017
|
},
|
|
@@ -31042,10 +31049,6 @@ const DEFAULT_PARTITION_PICKER_GRID_STYLE = {
|
|
|
31042
31049
|
opacity: PARTITION_PICKER_GRID_OPACITY,
|
|
31043
31050
|
maxIntersectionDots: PARTITION_PICKER_GRID_MAX_INTERSECTION_DOTS,
|
|
31044
31051
|
};
|
|
31045
|
-
const DEFAULT_PARTITION_PICKER_BOUNDARY_STROKE_PX = {
|
|
31046
|
-
default: PARTITION_BOUNDARY_TARGET_SCREEN_STROKE_PX,
|
|
31047
|
-
emphasized: PARTITION_BOUNDARY_EMPHASIZED_TARGET_SCREEN_STROKE_PX,
|
|
31048
|
-
};
|
|
31049
31052
|
/**
|
|
31050
31053
|
* 将 platform 内置默认值与外部 pickerStyleConfig 深度合并。
|
|
31051
31054
|
* 调用方只需覆盖变化的字段,无需改组件源码。
|
|
@@ -31062,8 +31065,7 @@ function resolvePartitionPickerStyles(platform = exports.PlatformType.WEB, confi
|
|
|
31062
31065
|
}
|
|
31063
31066
|
: baseLabels,
|
|
31064
31067
|
grid: merge$1({}, DEFAULT_PARTITION_PICKER_GRID_STYLE, config?.grid),
|
|
31065
|
-
boundaryStrokePx: merge$1({},
|
|
31066
|
-
labelMinScreenWidthPx: config?.labelMinScreenWidthPx ?? H5_PARTITION_LABEL_MIN_SCREEN_WIDTH_PX,
|
|
31068
|
+
boundaryStrokePx: merge$1({}, getPartitionPickerBoundaryStrokePx(platform), config?.boundaryStrokePx),
|
|
31067
31069
|
};
|
|
31068
31070
|
}
|
|
31069
31071
|
|
|
@@ -31077,7 +31079,7 @@ function resolvePartitionPickerStyles(platform = exports.PlatformType.WEB, confi
|
|
|
31077
31079
|
*
|
|
31078
31080
|
* 平移可在地块/分区名等任意区域发起;仅当位移小于阈值时才视为点击
|
|
31079
31081
|
*/
|
|
31080
|
-
function useMapViewport({ mapJson, containerRef: externalContainerRef, width, height, padding, minZoom = 0.5, maxZoom =
|
|
31082
|
+
function useMapViewport({ mapJson, containerRef: externalContainerRef, width, height, padding, minZoom = 0.5, maxZoom = 3, enablePanZoom = true, refitOnResize = true, onViewportTap, mapRotationDeg = 0, }) {
|
|
31081
31083
|
/** 地图容器 DOM,用于绑定 wheel/pointer/touch 事件 */
|
|
31082
31084
|
const internalContainerRef = React.useRef(null);
|
|
31083
31085
|
const containerRef = externalContainerRef ?? internalContainerRef;
|
|
@@ -31496,7 +31498,17 @@ function useMapViewport({ mapJson, containerRef: externalContainerRef, width, he
|
|
|
31496
31498
|
window.removeEventListener('mouseup', handleWindowPointerUp);
|
|
31497
31499
|
window.removeEventListener('blur', handleWindowPointerUp);
|
|
31498
31500
|
};
|
|
31499
|
-
}, [
|
|
31501
|
+
}, [
|
|
31502
|
+
applyPan,
|
|
31503
|
+
applyZoom,
|
|
31504
|
+
clearPanState,
|
|
31505
|
+
enablePanZoom,
|
|
31506
|
+
height,
|
|
31507
|
+
maxZoom,
|
|
31508
|
+
minZoom,
|
|
31509
|
+
scheduleViewBox,
|
|
31510
|
+
width,
|
|
31511
|
+
]);
|
|
31500
31512
|
return {
|
|
31501
31513
|
/** 绑定到地图外层容器的 ref */
|
|
31502
31514
|
containerRef,
|
|
@@ -31555,10 +31567,12 @@ function useGoogleMapsOverlay({ mapJson, mapRef, defaultTransform, originNorthRo
|
|
|
31555
31567
|
/**
|
|
31556
31568
|
* OverlayViewF 的 LatLngBounds:
|
|
31557
31569
|
* GPS 包围盒 + defaultTransform 在 Web Mercator 下的平移偏移。
|
|
31570
|
+
* 仅 Map 模式(enabled)且 Google Maps 已加载时才计算。
|
|
31558
31571
|
*/
|
|
31559
31572
|
const bounds = React.useMemo(() => {
|
|
31560
|
-
if (!mapJson || typeof window === 'undefined' || !window.google?.maps)
|
|
31573
|
+
if (!enabled || !mapJson || typeof window === 'undefined' || !window.google?.maps) {
|
|
31561
31574
|
return null;
|
|
31575
|
+
}
|
|
31562
31576
|
const validBounds = getValidGpsBounds(mapJson, 0);
|
|
31563
31577
|
const [swLng0, swLat0] = validBounds.sw;
|
|
31564
31578
|
const [neLng0, neLat0] = validBounds.ne;
|
|
@@ -31571,7 +31585,7 @@ function useGoogleMapsOverlay({ mapJson, mapRef, defaultTransform, originNorthRo
|
|
|
31571
31585
|
const [swLng, swLat] = proj4(WEB_MERCATOR, WGS84, [swX, swY]);
|
|
31572
31586
|
const [neLng, neLat] = proj4(WEB_MERCATOR, WGS84, [neX, neY]);
|
|
31573
31587
|
return new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), new window.google.maps.LatLng(neLat, neLng));
|
|
31574
|
-
}, [mapJson, transformX, transformY]);
|
|
31588
|
+
}, [enabled, mapJson, transformX, transformY]);
|
|
31575
31589
|
/** OverlayViewF onDraw:解析 overlay 容器 style,得到像素 layout */
|
|
31576
31590
|
const handleOverlayDraw = React.useCallback((style) => {
|
|
31577
31591
|
const layout = Object.keys(style).reduce((acc, key) => {
|
|
@@ -31586,8 +31600,9 @@ function useGoogleMapsOverlay({ mapJson, mapRef, defaultTransform, originNorthRo
|
|
|
31586
31600
|
}, []);
|
|
31587
31601
|
/** Map 模式 fitToView:调用 google.maps.Map.fitBounds,考虑旋转后的 GPS 包围盒 */
|
|
31588
31602
|
const fitToView = React.useCallback((nextPadding) => {
|
|
31589
|
-
if (!enabled || !mapRef || !mapJson)
|
|
31603
|
+
if (!enabled || !mapRef || !mapJson || typeof window === 'undefined' || !window.google?.maps) {
|
|
31590
31604
|
return;
|
|
31605
|
+
}
|
|
31591
31606
|
const rotate = transformRotation + originNorthRotate;
|
|
31592
31607
|
const validBounds = getValidGpsBounds(mapJson, rotate);
|
|
31593
31608
|
const [swLng0, swLat0] = validBounds.sw;
|
|
@@ -31636,7 +31651,7 @@ function useGoogleMapsOverlay({ mapJson, mapRef, defaultTransform, originNorthRo
|
|
|
31636
31651
|
const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
|
|
31637
31652
|
updateScale();
|
|
31638
31653
|
return () => {
|
|
31639
|
-
if (listener) {
|
|
31654
|
+
if (listener && window.google?.maps?.event) {
|
|
31640
31655
|
window.google.maps.event.removeListener(listener);
|
|
31641
31656
|
}
|
|
31642
31657
|
handleZoomChanged.cancel();
|
|
@@ -31896,19 +31911,16 @@ function usePartitionLabelItems(mapData, viewBox, containerWidth, containerHeigh
|
|
|
31896
31911
|
]);
|
|
31897
31912
|
}
|
|
31898
31913
|
|
|
31899
|
-
var css_248z = "@charset \"UTF-8\";\n/* 地图容器:裁剪溢出,禁用浏览器默认 touch 手势以便自定义 pinch */\n.index-module_container__nNYv7 {\n position: relative;\n overflow: hidden;\n touch-action: none;\n user-select: none;\n cursor: grab;\n /* H5 点击时不出现矩形 tap 高亮 */\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n}\n\n/* 网格 + 地块双层 SVG 叠放,共用 viewBox 保证平移/缩放同步 */\n.index-module_mapSvgStack__nz2s2 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 1;\n}\n\n.index-module_gridSvg__MoJD6 {\n position: absolute;\n inset: 0;\n display: block;\n pointer-events: none;\n}\n\n/* 地图 SVG:地块/通道,可绕 viewBox 中心旋转 */\n.index-module_mapSvg__vN0LV {\n position: absolute;\n inset: 0;\n display: block;\n pointer-events: none;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n}\n\n/* 可点击地块:点击选中由 viewport 统一处理,此处保留 hover */\n.index-module_boundaryPolygon__uHe-E {\n cursor: grab;\n pointer-events: auto;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n outline: none;\n -webkit-touch-callout: none;\n}\n\n.index-module_container__nNYv7:active {\n cursor: grabbing;\n}\n\n.index-module_boundaryPolygon__uHe-E:active {\n cursor: grabbing;\n}\n\n/* Map 模式:OverlayViewF 内根节点,铺满 overlay 像素区域 */\n.index-module_googleOverlayRoot__TQ3II {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: visible;\n}\n\n/* HTML overlay 层:CSS rotate 与 MowerMapRenderer OverlayViewF 一致,子元素自行反向补偿 */\n.index-module_mapOverlayLayer__7jTDy {\n position: absolute;\n inset: 0;\n transform-origin: 50% 50%;\n pointer-events: none;\n z-index: 2;\n}\n\n/* 分区名气泡层,绝对定位覆盖在 SVG 之上 */\n.index-module_labelsLayer__Rcikw {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n.index-module_label__xo3Kc {\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n pointer-events: auto;\n cursor: grab;\n white-space: nowrap;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n outline: none;\n -webkit-touch-callout: none;\n}\n\n.index-module_label__xo3Kc:active {\n cursor: grabbing;\n}\n\n.index-
|
|
31900
|
-
var styles = {"container":"index-module_container__nNYv7","mapSvgStack":"index-module_mapSvgStack__nz2s2","gridSvg":"index-module_gridSvg__MoJD6","mapSvg":"index-module_mapSvg__vN0LV","boundaryPolygon":"index-module_boundaryPolygon__uHe-E","googleOverlayRoot":"index-module_googleOverlayRoot__TQ3II","mapOverlayLayer":"index-module_mapOverlayLayer__7jTDy","labelsLayer":"index-module_labelsLayer__Rcikw","label":"index-module_label__xo3Kc","
|
|
31914
|
+
var css_248z = "@charset \"UTF-8\";\n/* 地图容器:裁剪溢出,禁用浏览器默认 touch 手势以便自定义 pinch */\n.index-module_container__nNYv7 {\n position: relative;\n overflow: hidden;\n touch-action: none;\n user-select: none;\n cursor: grab;\n /* H5 点击时不出现矩形 tap 高亮 */\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n}\n\n/* 网格 + 地块双层 SVG 叠放,共用 viewBox 保证平移/缩放同步 */\n.index-module_mapSvgStack__nz2s2 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 1;\n}\n\n.index-module_gridSvg__MoJD6 {\n position: absolute;\n inset: 0;\n display: block;\n pointer-events: none;\n}\n\n/* 地图 SVG:地块/通道,可绕 viewBox 中心旋转 */\n.index-module_mapSvg__vN0LV {\n position: absolute;\n inset: 0;\n display: block;\n pointer-events: none;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n}\n\n/* 可点击地块:点击选中由 viewport 统一处理,此处保留 hover */\n.index-module_boundaryPolygon__uHe-E {\n cursor: grab;\n pointer-events: auto;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n outline: none;\n -webkit-touch-callout: none;\n}\n\n.index-module_container__nNYv7:active {\n cursor: grabbing;\n}\n\n.index-module_boundaryPolygon__uHe-E:active {\n cursor: grabbing;\n}\n\n/* Map 模式:OverlayViewF 内根节点,铺满 overlay 像素区域 */\n.index-module_googleOverlayRoot__TQ3II {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: visible;\n}\n\n/* HTML overlay 层:CSS rotate 与 MowerMapRenderer OverlayViewF 一致,子元素自行反向补偿 */\n.index-module_mapOverlayLayer__7jTDy {\n position: absolute;\n inset: 0;\n transform-origin: 50% 50%;\n pointer-events: none;\n z-index: 2;\n}\n\n/* 分区名气泡层,绝对定位覆盖在 SVG 之上 */\n.index-module_labelsLayer__Rcikw {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n.index-module_label__xo3Kc {\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: center;\n pointer-events: auto;\n cursor: grab;\n white-space: nowrap;\n -webkit-tap-highlight-color: transparent;\n tap-highlight-color: transparent;\n outline: none;\n -webkit-touch-callout: none;\n}\n\n.index-module_label__xo3Kc:active {\n cursor: grabbing;\n}\n\n.index-module_labelOrderOnly__TDLBU {\n gap: 0;\n}\n\n/* H5 名称标签:气泡宽度 / 文案最大宽度由 constants.ts 内联样式控制 */\n.index-module_labelH5Wrap__Es5cA {\n white-space: normal;\n}\n\n.index-module_labelPill__7jnOo {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: none;\n}\n\n.index-module_labelPillH5__iPeHi {\n box-sizing: border-box;\n}\n\n.index-module_labelText__ialST {\n word-break: break-word;\n text-align: center;\n}\n\n.index-module_labelTextH5__jz8SO {\n max-width: 100%;\n white-space: normal;\n overflow-wrap: anywhere;\n line-height: 1.33;\n}\n\n/* 选中序号徽章:尺寸与颜色由 constants 按 platform 注入 */\n.index-module_selectionOrderBadge__uj7LX {\n flex-shrink: 0;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.index-module_boundaryPolygonIsolated__syN4V {\n cursor: not-allowed;\n}\n\n.index-module_boundaryPolygonIsolated__syN4V:active {\n cursor: grabbing;\n}\n\n.index-module_labelIsolated__K3WAB {\n cursor: not-allowed;\n pointer-events: auto;\n}\n\n.index-module_labelIsolated__K3WAB:active {\n cursor: grabbing;\n}\n\n.index-module_labelIsolatedLayout__k-rwI {\n gap: 4px;\n}\n\n.index-module_isolatedIconBelow__PuVIF {\n position: static;\n transform: none;\n width: 24px;\n height: 24px;\n flex-shrink: 0;\n pointer-events: none;\n}\n\n.index-module_isolatedIconBelow__PuVIF.index-module_isolatedIconWeb__iPkYp {\n width: 20px;\n height: 20px;\n}\n\n.index-module_isolatedIcon__Vbxl0 {\n position: absolute;\n width: 24px;\n height: 24px;\n left: 50%;\n bottom: calc(100% + 4px);\n transform: translateX(-50%);\n}\n\n.index-module_isolatedIconWeb__iPkYp {\n width: 20px;\n height: 20px;\n bottom: calc(100% + 2px);\n}";
|
|
31915
|
+
var styles = {"container":"index-module_container__nNYv7","mapSvgStack":"index-module_mapSvgStack__nz2s2","gridSvg":"index-module_gridSvg__MoJD6","mapSvg":"index-module_mapSvg__vN0LV","boundaryPolygon":"index-module_boundaryPolygon__uHe-E","googleOverlayRoot":"index-module_googleOverlayRoot__TQ3II","mapOverlayLayer":"index-module_mapOverlayLayer__7jTDy","labelsLayer":"index-module_labelsLayer__Rcikw","label":"index-module_label__xo3Kc","labelOrderOnly":"index-module_labelOrderOnly__TDLBU","labelH5Wrap":"index-module_labelH5Wrap__Es5cA","labelPill":"index-module_labelPill__7jnOo","labelPillH5":"index-module_labelPillH5__iPeHi","labelText":"index-module_labelText__ialST","labelTextH5":"index-module_labelTextH5__jz8SO","selectionOrderBadge":"index-module_selectionOrderBadge__uj7LX","boundaryPolygonIsolated":"index-module_boundaryPolygonIsolated__syN4V","labelIsolated":"index-module_labelIsolated__K3WAB","labelIsolatedLayout":"index-module_labelIsolatedLayout__k-rwI","isolatedIconBelow":"index-module_isolatedIconBelow__PuVIF","isolatedIconWeb":"index-module_isolatedIconWeb__iPkYp"};
|
|
31901
31916
|
styleInject(css_248z);
|
|
31902
31917
|
|
|
31903
31918
|
const PARTITION_BOUNDARY_ID_ATTR$1 = 'data-partition-boundary-id';
|
|
31904
|
-
const SelectableBoundaryElement = ({ data, boundaryColors, boundaryStrokePx, isIsolated = false, selected, hovered, viewBoxWidth, viewBoxHeight,
|
|
31919
|
+
const SelectableBoundaryElement = ({ data, boundaryColors, boundaryStrokePx, isIsolated = false, selected, hovered, viewBoxWidth, viewBoxHeight, containerWidth, containerHeight, onHoverChange, onBoundaryClick, }) => {
|
|
31905
31920
|
const style = data.style || {};
|
|
31906
31921
|
const boundaryId = Number(data.id);
|
|
31907
31922
|
const colors = boundaryColors;
|
|
31908
|
-
const strokePx = boundaryStrokePx ?? {
|
|
31909
|
-
default: PARTITION_BOUNDARY_TARGET_SCREEN_STROKE_PX,
|
|
31910
|
-
emphasized: PARTITION_BOUNDARY_EMPHASIZED_TARGET_SCREEN_STROKE_PX,
|
|
31911
|
-
};
|
|
31923
|
+
const strokePx = boundaryStrokePx ?? { ...WEB_PARTITION_BOUNDARY_STROKE_PX };
|
|
31912
31924
|
const pointsString = React.useMemo(() => data.points.map((point) => `${point[0]},${point[1]}`).join(' '), [data.points]);
|
|
31913
31925
|
const fillColor = React.useMemo(() => {
|
|
31914
31926
|
if (isIsolated)
|
|
@@ -31931,31 +31943,16 @@ const SelectableBoundaryElement = ({ data, boundaryColors, boundaryStrokePx, isI
|
|
|
31931
31943
|
return style.lineColor || colors.defaultStroke;
|
|
31932
31944
|
}, [colors, hovered, isIsolated, selected, style.lineColor]);
|
|
31933
31945
|
const strokeWidth = React.useMemo(() => {
|
|
31934
|
-
let baseWidth;
|
|
31935
|
-
let emphasized = false;
|
|
31936
|
-
if (isIsolated)
|
|
31937
|
-
baseWidth = colors.isolatedStrokeWidth;
|
|
31938
|
-
else if (selected) {
|
|
31939
|
-
emphasized = true;
|
|
31940
|
-
baseWidth = hovered ? colors.selectedHoverStrokeWidth : colors.selectedStrokeWidth;
|
|
31941
|
-
}
|
|
31942
|
-
else if (hovered) {
|
|
31943
|
-
emphasized = true;
|
|
31944
|
-
baseWidth = colors.hoverStrokeWidth;
|
|
31945
|
-
}
|
|
31946
|
-
else
|
|
31947
|
-
baseWidth = colors.defaultStrokeWidth;
|
|
31948
31946
|
const viewBox = { width: viewBoxWidth, height: viewBoxHeight };
|
|
31949
|
-
|
|
31947
|
+
const targetScreenStrokePx = !isIsolated && (selected || hovered) ? strokePx.selected : strokePx.default;
|
|
31948
|
+
return scaleStrokeWidthForViewBox(viewBox, {
|
|
31950
31949
|
containerWidth,
|
|
31951
31950
|
containerHeight,
|
|
31952
|
-
|
|
31951
|
+
targetScreenStrokePx,
|
|
31953
31952
|
});
|
|
31954
31953
|
}, [
|
|
31955
|
-
colors,
|
|
31956
31954
|
containerHeight,
|
|
31957
31955
|
containerWidth,
|
|
31958
|
-
fitViewBox,
|
|
31959
31956
|
hovered,
|
|
31960
31957
|
isIsolated,
|
|
31961
31958
|
selected,
|
|
@@ -31975,7 +31972,7 @@ const SelectableBoundaryElement = ({ data, boundaryColors, boundaryStrokePx, isI
|
|
|
31975
31972
|
};
|
|
31976
31973
|
var SelectableBoundaryElement$1 = React.memo(SelectableBoundaryElement);
|
|
31977
31974
|
|
|
31978
|
-
const PartitionPickerSvg = ({ svgElementDatas, viewBox,
|
|
31975
|
+
const PartitionPickerSvg = ({ svgElementDatas, viewBox, containerWidth, containerHeight, mapRotation = 0, boundaryColors, boundaryStrokePx, isolatedBoundaryIds, selectedIds, hoveredId, onHoverChange, onBoundaryClick, }) => {
|
|
31979
31976
|
const boundaries = (svgElementDatas[exports.DataType.BOUNDARY] || []);
|
|
31980
31977
|
const channels = (svgElementDatas[exports.DataType.CHANNEL] || []);
|
|
31981
31978
|
const selectedIdSet = React.useMemo(() => new Set(selectedIds), [selectedIds]);
|
|
@@ -31987,7 +31984,7 @@ const PartitionPickerSvg = ({ svgElementDatas, viewBox, fitViewBox, containerWid
|
|
|
31987
31984
|
}, [mapRotation, viewBox.x, viewBox.y, viewBox.width, viewBox.height]);
|
|
31988
31985
|
const mapContent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(GElement, { type: "boundary", children: boundaries.map((item) => {
|
|
31989
31986
|
const boundaryId = Number(item.id);
|
|
31990
|
-
return (jsxRuntime.jsx(SelectableBoundaryElement$1, { data: item, boundaryColors: boundaryColors, boundaryStrokePx: boundaryStrokePx, isIsolated: isolatedBoundaryIds.has(boundaryId), selected: selectedIdSet.has(boundaryId), hovered: hoveredId === boundaryId, viewBoxWidth: viewBox.width, viewBoxHeight: viewBox.height,
|
|
31987
|
+
return (jsxRuntime.jsx(SelectableBoundaryElement$1, { data: item, boundaryColors: boundaryColors, boundaryStrokePx: boundaryStrokePx, isIsolated: isolatedBoundaryIds.has(boundaryId), selected: selectedIdSet.has(boundaryId), hovered: hoveredId === boundaryId, viewBoxWidth: viewBox.width, viewBoxHeight: viewBox.height, containerWidth: containerWidth, containerHeight: containerHeight, onHoverChange: onHoverChange, onBoundaryClick: onBoundaryClick }, item.id));
|
|
31991
31988
|
}) }), jsxRuntime.jsxs(GElement, { type: "channel", children: [jsxRuntime.jsx(ChannelClipPath, {}), channels.map((item) => (jsxRuntime.jsx(ChannelElement, { data: item }, item.id)))] })] }));
|
|
31992
31989
|
return (jsxRuntime.jsx("svg", { className: styles.mapSvg, xmlns: "http://www.w3.org/2000/svg", viewBox: viewBoxToString(viewBox), width: "100%", height: "100%", preserveAspectRatio: "xMidYMid meet", shapeRendering: "geometricPrecision", children: mapContentTransform ? (jsxRuntime.jsx("g", { transform: mapContentTransform, children: mapContent })) : (mapContent) }));
|
|
31993
31990
|
};
|
|
@@ -32027,10 +32024,21 @@ const MapGridBackground = ({ viewBox, gridStyle }) => {
|
|
|
32027
32024
|
var MapGridBackground$1 = React.memo(MapGridBackground);
|
|
32028
32025
|
|
|
32029
32026
|
const PartitionPickerGridSvg = ({ viewBox, gridStyle }) => {
|
|
32030
|
-
return (jsxRuntime.jsx("svg", { className: styles.gridSvg, "data-viewport-background": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: viewBoxToString(viewBox), width: "100%", height: "100%",
|
|
32027
|
+
return (jsxRuntime.jsx("svg", { className: styles.gridSvg, "data-viewport-background": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: viewBoxToString(viewBox), width: "100%", height: "100%",
|
|
32028
|
+
// 设置缩放的规则
|
|
32029
|
+
//等比缩放 viewBox 内容,使其完整落在容器内;
|
|
32030
|
+
//水平、垂直都居中;
|
|
32031
|
+
//比例不一致时,上下或左右留空(letterboxing),不裁切、不拉伸变形。
|
|
32032
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
32033
|
+
/**
|
|
32034
|
+
* 控制浏览器如何绘制路径/线条:
|
|
32035
|
+
* geometricPrecision:优先几何精度,线条更平滑、对齐更稳,缩放时不易发虚或抖动。
|
|
32036
|
+
* 网格是大量细线,用这个属性能让缩放/平移时网格更清晰稳定。
|
|
32037
|
+
*/
|
|
32038
|
+
shapeRendering: "geometricPrecision", "aria-hidden": true, children: jsxRuntime.jsx(MapGridBackground$1, { viewBox: viewBox, gridStyle: gridStyle }) }));
|
|
32031
32039
|
};
|
|
32032
32040
|
|
|
32033
|
-
const PartitionNameLabels = ({ items, selectedIds, labelStyles,
|
|
32041
|
+
const PartitionNameLabels = ({ items, selectedIds, labelStyles, platform = exports.PlatformType.WEB, showSelectionOrder = false, rotation = 0, onHoverChange, onBoundaryClick, }) => {
|
|
32034
32042
|
const isWeb = platform === exports.PlatformType.WEB;
|
|
32035
32043
|
const orderBadgeStyle = React.useMemo(() => ({
|
|
32036
32044
|
width: labelStyles.selectionOrderBadge.width,
|
|
@@ -32040,18 +32048,18 @@ const PartitionNameLabels = ({ items, selectedIds, labelStyles, labelMinScreenWi
|
|
|
32040
32048
|
color: labelStyles.selectionOrderBadge.color,
|
|
32041
32049
|
fontSize: `${labelStyles.selectionOrderBadge.fontSize}px`,
|
|
32042
32050
|
fontWeight: labelStyles.selectionOrderBadge.fontWeight,
|
|
32051
|
+
fontFamily: labelStyles.selectionOrderBadge.fontFamily,
|
|
32043
32052
|
lineHeight: labelStyles.selectionOrderBadge.lineHeight,
|
|
32044
32053
|
}), [labelStyles]);
|
|
32045
32054
|
return (jsxRuntime.jsx("div", { className: styles.labelsLayer, children: items.map((item) => {
|
|
32046
32055
|
const isIsolated = item.isIsolated === true;
|
|
32047
32056
|
const selected = !isIsolated && selectedIds.includes(item.id);
|
|
32048
32057
|
const selectionOrder = selected ? selectedIds.indexOf(item.id) + 1 : null;
|
|
32049
|
-
const isLargeEnough = item.screenWidthPx >
|
|
32058
|
+
const isLargeEnough = item.screenWidthPx > H5_PARTITION_LABEL_MIN_SCREEN_WIDTH_PX;
|
|
32050
32059
|
// Web 始终展示名称;H5 按屏幕宽度决定
|
|
32051
32060
|
const showNameLabel = isWeb || isLargeEnough;
|
|
32052
32061
|
const showOrderBadge = showSelectionOrder && selected && selectionOrder != null;
|
|
32053
32062
|
const h5OrderOnly = !isWeb && showOrderBadge && !isLargeEnough;
|
|
32054
|
-
const h5OrderWithName = !isWeb && showOrderBadge && isLargeEnough;
|
|
32055
32063
|
if (!showNameLabel && !showOrderBadge && !isIsolated) {
|
|
32056
32064
|
return null;
|
|
32057
32065
|
}
|
|
@@ -32060,18 +32068,21 @@ const PartitionNameLabels = ({ items, selectedIds, labelStyles, labelMinScreenWi
|
|
|
32060
32068
|
styles.label,
|
|
32061
32069
|
!isWeb && showNameLabel ? styles.labelH5Wrap : '',
|
|
32062
32070
|
isIsolated ? styles.labelIsolated : '',
|
|
32063
|
-
isWeb && showOrderBadge ? styles.labelWithOrder : '',
|
|
32064
|
-
h5OrderWithName ? styles.labelWithOrderH5 : '',
|
|
32065
32071
|
h5OrderOnly ? styles.labelOrderOnly : '',
|
|
32066
32072
|
isIsolated ? styles.labelIsolatedLayout : '',
|
|
32067
32073
|
]
|
|
32068
32074
|
.filter(Boolean)
|
|
32069
32075
|
.join(' ');
|
|
32076
|
+
const showOrderWithName = showOrderBadge && showNameLabel;
|
|
32077
|
+
const selectionOrderGapPx = isWeb
|
|
32078
|
+
? WEB_SELECTION_ORDER_GAP_PX
|
|
32079
|
+
: H5_SELECTION_ORDER_GAP_PX;
|
|
32070
32080
|
const boundaryIdProps = isIsolated ? {} : { [PARTITION_BOUNDARY_ID_ATTR$1]: item.id };
|
|
32071
32081
|
return (jsxRuntime.jsxs("div", { className: labelClassName, style: {
|
|
32072
32082
|
left: `${item.leftPct}%`,
|
|
32073
32083
|
top: `${item.topPct}%`,
|
|
32074
32084
|
transform: `translate(-50%, -50%) rotate(${-rotation}deg)`,
|
|
32085
|
+
...(showOrderWithName ? { gap: selectionOrderGapPx } : undefined),
|
|
32075
32086
|
}, ...boundaryIdProps, onMouseEnter: isIsolated ? undefined : () => onHoverChange(item.id), onMouseLeave: isIsolated ? undefined : () => onHoverChange(null), onClick: onBoundaryClick && !isIsolated
|
|
32076
32087
|
? (event) => {
|
|
32077
32088
|
event.stopPropagation();
|
|
@@ -32086,7 +32097,7 @@ const DEFAULT_BACKGROUND = PARTITION_PICKER_GRID_BASE_COLOR;
|
|
|
32086
32097
|
const PARTITION_BOUNDARY_ID_ATTR = 'data-partition-boundary-id';
|
|
32087
32098
|
/** Map 模式下 OverlayViewF 默认 z-index */
|
|
32088
32099
|
const DEFAULT_OVERLAY_Z_INDEX = 100;
|
|
32089
|
-
const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerStyleConfig, sn = '', platform = exports.PlatformType.WEB, width, height, padding =
|
|
32100
|
+
const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerStyleConfig, sn = '', platform = exports.PlatformType.WEB, width, height, padding = 0, backgroundColor = DEFAULT_BACKGROUND, defaultTransform, mapRef, minZoom = 0.5, maxZoom = 3, enablePanZoom = true, refitOnResize = true, onSizeChange, selectedBoundaryIds, defaultSelectedBoundaryIds, onSelectionChange, hoveredBoundaryId, defaultHoveredBoundaryId, onBoundaryHoverChange, showSelectionOrder = false, zIndex = DEFAULT_OVERLAY_Z_INDEX, className, style, }, ref) => {
|
|
32090
32101
|
/**
|
|
32091
32102
|
* 是否为 Map 模式(传入 mapRef 时为 true):
|
|
32092
32103
|
* - true:Google Maps 底图 + OverlayViewF,平移/缩放/fit 由底图负责
|
|
@@ -32097,8 +32108,34 @@ const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerSt
|
|
|
32097
32108
|
const channelClipPathId = React.useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
|
|
32098
32109
|
/** 外部 pickerStyleConfig 与内置 platform 默认值合并后的最终外观(地块/标签/网格等) */
|
|
32099
32110
|
const mergedPickerStyles = React.useMemo(() => resolvePartitionPickerStyles(platform, pickerStyleConfig), [pickerStyleConfig, platform]);
|
|
32100
|
-
/** Standalone
|
|
32101
|
-
const resolvedBackgroundColor =
|
|
32111
|
+
/** Standalone 容器背景与 grid.baseColor 对齐(合并后的最终值) */
|
|
32112
|
+
const resolvedBackgroundColor = React.useMemo(() => {
|
|
32113
|
+
if (isMapMode)
|
|
32114
|
+
return undefined;
|
|
32115
|
+
if (pickerStyleConfig?.grid?.baseColor != null) {
|
|
32116
|
+
return mergedPickerStyles.grid.baseColor;
|
|
32117
|
+
}
|
|
32118
|
+
return backgroundColor ?? mergedPickerStyles.grid.baseColor;
|
|
32119
|
+
}, [
|
|
32120
|
+
backgroundColor,
|
|
32121
|
+
isMapMode,
|
|
32122
|
+
mergedPickerStyles.grid.baseColor,
|
|
32123
|
+
pickerStyleConfig?.grid?.baseColor,
|
|
32124
|
+
]);
|
|
32125
|
+
/** Standalone 网格层:backgroundColor 未显式指定 grid.baseColor 时与容器背景同步 */
|
|
32126
|
+
const standaloneGridStyle = React.useMemo(() => {
|
|
32127
|
+
if (pickerStyleConfig?.grid?.baseColor != null) {
|
|
32128
|
+
return mergedPickerStyles.grid;
|
|
32129
|
+
}
|
|
32130
|
+
if (backgroundColor != null) {
|
|
32131
|
+
return { ...mergedPickerStyles.grid, baseColor: backgroundColor };
|
|
32132
|
+
}
|
|
32133
|
+
return mergedPickerStyles.grid;
|
|
32134
|
+
}, [
|
|
32135
|
+
backgroundColor,
|
|
32136
|
+
mergedPickerStyles.grid,
|
|
32137
|
+
pickerStyleConfig?.grid?.baseColor,
|
|
32138
|
+
]);
|
|
32102
32139
|
const mergedMapConfig = React.useMemo(() => merge$1({}, DEFAULT_STYLES, getPartitionPickerMapConfig(platform), mapConfig), [mapConfig, platform]);
|
|
32103
32140
|
const svgElementDatas = React.useMemo(() => UnifiedMapDataProcessor.processMapData(mapJson, mergedMapConfig) || {}, [mapJson, mergedMapConfig]);
|
|
32104
32141
|
/** 地图 Y 轴相对正北的偏移(度),与 MowerMapRenderer.originNorthRotate 一致 */
|
|
@@ -32173,7 +32210,7 @@ const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerSt
|
|
|
32173
32210
|
}
|
|
32174
32211
|
}, [isMapMode, isReady, onSizeChange, pxWidth, pxHeight]);
|
|
32175
32212
|
/** Standalone:平移/缩放 viewBox;Map 模式 enablePanZoom 关闭,仅保留 hook 结构 */
|
|
32176
|
-
const { viewBox: standaloneViewBox, gridViewBox,
|
|
32213
|
+
const { viewBox: standaloneViewBox, gridViewBox, resetView: standaloneResetView, fitToView: standaloneFitToView, } = useMapViewport({
|
|
32177
32214
|
mapJson,
|
|
32178
32215
|
containerRef,
|
|
32179
32216
|
width: pxWidth,
|
|
@@ -32188,7 +32225,6 @@ const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerSt
|
|
|
32188
32225
|
});
|
|
32189
32226
|
/** 按模式选取 viewBox / 尺寸 / 旋转 / 就绪状态(Map 与 Standalone 数据源不同) */
|
|
32190
32227
|
const viewBox = isMapMode ? googleOverlay.svgViewBox : standaloneViewBox;
|
|
32191
|
-
const fitViewBox = isMapMode ? googleOverlay.fitViewBox : standaloneFitViewBox;
|
|
32192
32228
|
const overlayWidth = isMapMode ? googleOverlay.overlayWidth : pxWidth;
|
|
32193
32229
|
const overlayHeight = isMapMode ? googleOverlay.overlayHeight : pxHeight;
|
|
32194
32230
|
const actureRotate = isMapMode ? googleOverlay.actureRotate : standaloneActureRotate;
|
|
@@ -32262,18 +32298,18 @@ const MowerPartitionPickerMap = React.forwardRef(({ mapJson, mapConfig, pickerSt
|
|
|
32262
32298
|
...(isMapMode ? {} : layoutStyle),
|
|
32263
32299
|
}), [isMapMode, layoutStyle, resolvedBackgroundColor, style]);
|
|
32264
32300
|
/** 地块 + 通道 SVG;Map 模式不在 SVG 内旋转(由 OverlayViewF rotate 处理) */
|
|
32265
|
-
const mapSvgLayer = viewBox && isLayersReady ? (jsxRuntime.jsx(PartitionPickerSvg, { svgElementDatas: svgElementDatas, viewBox: viewBox,
|
|
32301
|
+
const mapSvgLayer = viewBox && isLayersReady ? (jsxRuntime.jsx(PartitionPickerSvg, { svgElementDatas: svgElementDatas, viewBox: viewBox, containerWidth: overlayWidth, containerHeight: overlayHeight, mapRotation: isMapMode ? 0 : actureRotate, boundaryColors: mergedPickerStyles.boundary, boundaryStrokePx: mergedPickerStyles.boundaryStrokePx, isolatedBoundaryIds: isolatedBoundaryIds, selectedIds: selectedIds, hoveredId: hoveredId, onHoverChange: handleHoverChange, onBoundaryClick: isMapMode ? handleBoundaryClick : undefined })) : null;
|
|
32266
32302
|
/**
|
|
32267
32303
|
* 分区标签 + 充电桩 HTML 层。
|
|
32268
32304
|
* Map 模式:平铺于 overlay 根节点;Standalone:包在 mapOverlayLayer 内做 CSS 旋转。
|
|
32269
32305
|
*/
|
|
32270
|
-
const overlayLayers = viewBox && isLayersReady ? (isMapMode ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(PartitionNameLabels, { items: labelItems, selectedIds: selectedIds, labelStyles: mergedPickerStyles.labels,
|
|
32306
|
+
const overlayLayers = viewBox && isLayersReady ? (isMapMode ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(PartitionNameLabels, { items: labelItems, selectedIds: selectedIds, labelStyles: mergedPickerStyles.labels, platform: platform, showSelectionOrder: showSelectionOrder, rotation: actureRotate, onHoverChange: handleHoverChange, onBoundaryClick: handleBoundaryClick }), jsxRuntime.jsx(CharginPile, { viewBox: viewBox, rotation: actureRotate })] })) : (jsxRuntime.jsxs("div", { className: styles.mapOverlayLayer, style: mapOverlayLayerStyle, children: [jsxRuntime.jsx(PartitionNameLabels, { items: labelItems, selectedIds: selectedIds, labelStyles: mergedPickerStyles.labels, platform: platform, showSelectionOrder: showSelectionOrder, rotation: actureRotate, onHoverChange: handleHoverChange }), jsxRuntime.jsx(CharginPile, { viewBox: viewBox, rotation: actureRotate, viewRotationMode: "overlay-parent", containerWidth: overlayWidth, containerHeight: overlayHeight, sizeInSvgUnits: true, minDisplaySizePx: PARTITION_PICKER_CHARGING_PILE_MIN_DISPLAY_PX })] }))) : null;
|
|
32271
32307
|
/** Map 模式:渲染 OverlayViewF,底图为 Google Maps */
|
|
32272
32308
|
if (isMapMode && mapRef) {
|
|
32273
32309
|
return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsx(OverlayViewF, { map: mapRef, mapPaneName: "overlayMouseTarget", bounds: googleOverlay.bounds ?? undefined, rotate: actureRotate, zIndex: zIndex, onDraw: googleOverlay.handleOverlayDraw, children: jsxRuntime.jsxs("div", { className: `${styles.googleOverlayRoot} ${className || ''}`, style: containerStyle, onMouseLeave: () => setHoveredId(null), children: [mapSvgLayer, overlayLayers] }) }) }) }));
|
|
32274
32310
|
}
|
|
32275
32311
|
/** Standalone 模式:固定容器 + 网格底图 + 双层 SVG / HTML overlay */
|
|
32276
|
-
return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsx("div", { ref: containerRef, className: `${styles.container} ${className || ''}`, "data-viewport-background": "true", style: containerStyle, onMouseLeave: () => setHoveredId(null), children: isLayersReady && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles.mapSvgStack, children: [jsxRuntime.jsx(PartitionPickerGridSvg, { viewBox: gridViewBox, gridStyle:
|
|
32312
|
+
return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsx("div", { ref: containerRef, className: `${styles.container} ${className || ''}`, "data-viewport-background": "true", style: containerStyle, onMouseLeave: () => setHoveredId(null), children: isLayersReady && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles.mapSvgStack, children: [jsxRuntime.jsx(PartitionPickerGridSvg, { viewBox: gridViewBox, gridStyle: standaloneGridStyle }), mapSvgLayer] }), overlayLayers] })) }) }) }));
|
|
32277
32313
|
});
|
|
32278
32314
|
MowerPartitionPickerMap.displayName = 'MowerPartitionPickerMap';
|
|
32279
32315
|
|
|
@@ -11,7 +11,7 @@ import React from 'react';
|
|
|
11
11
|
import { MowerPartitionPickerMapProps, MowerPartitionPickerMapRef } from './partitionPicker/types';
|
|
12
12
|
export declare const MowerPartitionPickerMap: React.ForwardRefExoticComponent<MowerPartitionPickerMapProps & React.RefAttributes<MowerPartitionPickerMapRef>>;
|
|
13
13
|
export default MowerPartitionPickerMap;
|
|
14
|
-
export type { MowerPartitionPickerMapProps, MowerPartitionPickerMapRef, CssLength } from './partitionPicker/types';
|
|
14
|
+
export type { MowerPartitionPickerMapProps, MowerPartitionPickerMapRef, CssLength, } from './partitionPicker/types';
|
|
15
15
|
export type { PartitionPickerStyleConfig, PartitionPickerBoundaryColors, PartitionPickerLabelStyles, PartitionPickerGridStyle, ResolvedPartitionPickerStyles, } from './partitionPicker/constants';
|
|
16
16
|
export { resolvePartitionPickerStyles, getPartitionPickerColors, getPartitionPickerLabelStyles, PARTITION_PICKER_COLORS_WEB, PARTITION_PICKER_COLORS_H5, PARTITION_PICKER_LABEL_STYLES_WEB, PARTITION_PICKER_LABEL_STYLES_H5, } from './partitionPicker/constants';
|
|
17
17
|
//# sourceMappingURL=MowerPartitionPickerMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MowerPartitionPickerMap.d.ts","sourceRoot":"","sources":["../../src/render/MowerPartitionPickerMap.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAON,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"MowerPartitionPickerMap.d.ts","sourceRoot":"","sources":["../../src/render/MowerPartitionPickerMap.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAON,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAiBnG,eAAO,MAAM,uBAAuB,iHAwanC,CAAC;AAIF,eAAe,uBAAuB,CAAC;AAEvC,YAAY,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,SAAS,GACV,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAC1B,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,6BAA6B,CAAC"}
|