@pisell/materials 6.11.100 → 6.11.101
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/PisellCards/components/MultilevelCard/hooks/useMultilevelCardExpand.d.ts +1 -0
- package/es/components/PisellCards/components/PisellImageCard/hooks/useImageLoad.d.ts +1 -0
- package/es/components/PisellCards/index.d.ts +1 -0
- package/es/components/PisellFields/index.d.ts +1 -0
- package/es/components/PisellLayouts/index.d.ts +1 -0
- package/es/components/PisellMetrics/index.d.ts +1 -0
- package/es/components/PisellScrollView/PisellScrollView.d.ts +5 -0
- package/es/components/PisellScrollView/components/Actions/index.d.ts +18 -0
- package/es/components/PisellScrollView/types.d.ts +203 -0
- package/es/components/batch-editor/fields/index.d.ts +1 -0
- package/es/components/calendar/index.d.ts +1 -0
- package/es/components/checkbox/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/DatePicker/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +26 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +27 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +1 -0
- package/es/components/date-picker/index.d.ts +1 -0
- package/es/components/filter/components/items/index.d.ts +1 -0
- package/es/components/filter/components/items/text/Editor/index.d.ts +1 -0
- package/es/components/filter/components/items/text/Preview/index.d.ts +1 -0
- package/es/components/filter/components/items/text/index.d.ts +1 -0
- package/es/components/pisellDataSourceContainer/components/Pagination/index.d.ts +6 -0
- package/es/components/pisellDataSourceContainer/hooks/useDataSourceKey.d.ts +1 -0
- package/es/components/pisellDatePicker/index.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +13 -0
- package/es/components/pisellFloorMapLayout/appearance/floorMapAppearance.d.ts +29 -0
- package/es/components/pisellFloorMapLayout/components/EdgeLayer.d.ts +37 -0
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +66 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.d.ts +16 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +14 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.d.ts +26 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapOverview.d.ts +44 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +84 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.d.ts +20 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +9 -0
- package/es/components/pisellFloorMapLayout/components/NodePortMarkers.d.ts +20 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +61 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +28 -0
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +5 -0
- package/es/components/pisellFloorMapLayout/floorMapLayoutConstants.d.ts +35 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.d.ts +61 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.d.ts +15 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +79 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +91 -0
- package/es/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.d.ts +19 -0
- package/es/components/pisellFloorMapLayout/index.d.ts +37 -0
- package/es/components/pisellFloorMapLayout/locales-ja.d.ts +184 -0
- package/es/components/pisellFloorMapLayout/locales-pt.d.ts +184 -0
- package/es/components/pisellFloorMapLayout/locales.d.ts +969 -0
- package/es/components/pisellFloorMapLayout/types.d.ts +778 -0
- package/es/components/pisellFloorMapLayout/utils/alignSnap.d.ts +64 -0
- package/es/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.d.ts +45 -0
- package/es/components/pisellFloorMapLayout/utils/edgeRouting.d.ts +267 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +8 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +35 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +11 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.d.ts +44 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +27 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +109 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.d.ts +34 -0
- package/es/components/pisellModal/components/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.less +2 -2
- package/es/components/productCard/cartSkuCard/components/weighing/index.js +5 -7
- package/es/components/productCard/cartSkuCard/components/weighing/index.less +15 -2
- package/es/components/productCard/lineItem/BookingLineItem.js +24 -14
- package/es/components/productCard/lineItem/components/TimeRange/index.d.ts +12 -0
- package/es/components/productCard/lineItem/index.less +22 -0
- package/es/components/radio/index.d.ts +1 -0
- package/es/components/skeleton/index.d.ts +1 -0
- package/es/components/table/Table/fields/date/index.d.ts +1 -0
- package/es/components/table/Table/fields/image/index.d.ts +1 -0
- package/es/components/table/Table/fields/index.d.ts +1 -0
- package/es/components/table/Table/fields/link/index.d.ts +1 -0
- package/es/components/table/Table/fields/number/index.d.ts +1 -0
- package/es/components/table/Table/fields/numberRange/index.d.ts +1 -0
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +1 -0
- package/es/components/table/Table/fields/pSwitch/index.d.ts +1 -0
- package/es/components/table/Table/fields/rangePicker/index.d.ts +1 -0
- package/es/components/table/Table/fields/search/index.d.ts +1 -0
- package/es/components/table/Table/fields/select/index.d.ts +1 -0
- package/es/components/table/Table/fields/text/index.d.ts +1 -0
- package/es/components/table/Table/fields/treeSelect/index.d.ts +1 -0
- package/es/components/time-picker/index.d.ts +1 -0
- package/es/components/upload/index.d.ts +1 -0
- package/es/components/virtual-keyboard/Time/utils.d.ts +1 -0
- package/lib/components/PisellCards/components/MultilevelCard/hooks/useMultilevelCardExpand.d.ts +1 -0
- package/lib/components/PisellCards/components/PisellImageCard/hooks/useImageLoad.d.ts +1 -0
- package/lib/components/PisellCards/index.d.ts +1 -0
- package/lib/components/PisellFields/index.d.ts +1 -0
- package/lib/components/PisellLayouts/index.d.ts +1 -0
- package/lib/components/PisellMetrics/index.d.ts +1 -0
- package/lib/components/PisellScrollView/PisellScrollView.d.ts +5 -0
- package/lib/components/PisellScrollView/components/Actions/index.d.ts +18 -0
- package/lib/components/PisellScrollView/types.d.ts +203 -0
- package/lib/components/batch-editor/fields/index.d.ts +1 -0
- package/lib/components/calendar/index.d.ts +1 -0
- package/lib/components/checkbox/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/DatePicker/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +26 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +27 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +1 -0
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/filter/components/items/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/Editor/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/Preview/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/index.d.ts +1 -0
- package/lib/components/pisellDataSourceContainer/components/Pagination/index.d.ts +6 -0
- package/lib/components/pisellDataSourceContainer/hooks/useDataSourceKey.d.ts +1 -0
- package/lib/components/pisellDatePicker/index.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +13 -0
- package/lib/components/pisellFloorMapLayout/appearance/floorMapAppearance.d.ts +29 -0
- package/lib/components/pisellFloorMapLayout/components/EdgeLayer.d.ts +37 -0
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +66 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.d.ts +16 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +14 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.d.ts +26 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapOverview.d.ts +44 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +84 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.d.ts +20 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +9 -0
- package/lib/components/pisellFloorMapLayout/components/NodePortMarkers.d.ts +20 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +61 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +28 -0
- package/lib/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +5 -0
- package/lib/components/pisellFloorMapLayout/floorMapLayoutConstants.d.ts +35 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.d.ts +61 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.d.ts +15 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +79 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +91 -0
- package/lib/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.d.ts +19 -0
- package/lib/components/pisellFloorMapLayout/index.d.ts +37 -0
- package/lib/components/pisellFloorMapLayout/locales-ja.d.ts +184 -0
- package/lib/components/pisellFloorMapLayout/locales-pt.d.ts +184 -0
- package/lib/components/pisellFloorMapLayout/locales.d.ts +969 -0
- package/lib/components/pisellFloorMapLayout/types.d.ts +778 -0
- package/lib/components/pisellFloorMapLayout/utils/alignSnap.d.ts +64 -0
- package/lib/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.d.ts +45 -0
- package/lib/components/pisellFloorMapLayout/utils/edgeRouting.d.ts +267 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +8 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +35 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +11 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.d.ts +44 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +27 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +109 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.d.ts +34 -0
- package/lib/components/pisellModal/components/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.less +2 -2
- package/lib/components/productCard/cartSkuCard/components/weighing/index.js +14 -7
- package/lib/components/productCard/cartSkuCard/components/weighing/index.less +15 -2
- package/lib/components/productCard/lineItem/BookingLineItem.js +32 -21
- package/lib/components/productCard/lineItem/components/TimeRange/index.d.ts +12 -0
- package/lib/components/productCard/lineItem/index.less +22 -0
- package/lib/components/radio/index.d.ts +1 -0
- package/lib/components/skeleton/index.d.ts +1 -0
- package/lib/components/table/Table/fields/date/index.d.ts +1 -0
- package/lib/components/table/Table/fields/image/index.d.ts +1 -0
- package/lib/components/table/Table/fields/index.d.ts +1 -0
- package/lib/components/table/Table/fields/link/index.d.ts +1 -0
- package/lib/components/table/Table/fields/number/index.d.ts +1 -0
- package/lib/components/table/Table/fields/numberRange/index.d.ts +1 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +1 -0
- package/lib/components/table/Table/fields/pSwitch/index.d.ts +1 -0
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +1 -0
- package/lib/components/table/Table/fields/search/index.d.ts +1 -0
- package/lib/components/table/Table/fields/select/index.d.ts +1 -0
- package/lib/components/table/Table/fields/text/index.d.ts +1 -0
- package/lib/components/table/Table/fields/treeSelect/index.d.ts +1 -0
- package/lib/components/time-picker/index.d.ts +1 -0
- package/lib/components/upload/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Time/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 编辑态选中图元旁的快捷操作:锁定 / 复制 / 删除(与侧栏同源逻辑)
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export interface FloorMapEditQuickActionLabels {
|
|
6
|
+
lock: string;
|
|
7
|
+
unlock: string;
|
|
8
|
+
duplicate: string;
|
|
9
|
+
delete: string;
|
|
10
|
+
popTitle: string;
|
|
11
|
+
popDesc: string;
|
|
12
|
+
cancel: string;
|
|
13
|
+
okDelete: string;
|
|
14
|
+
ariaToolbar: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FloorMapEditQuickActionsProps {
|
|
17
|
+
className?: string;
|
|
18
|
+
labels: FloorMapEditQuickActionLabels;
|
|
19
|
+
isLocked: boolean;
|
|
20
|
+
onToggleLock: () => void;
|
|
21
|
+
onDuplicate: () => void;
|
|
22
|
+
onDelete: () => void;
|
|
23
|
+
/** 画布 viewport scale,用于按 1/scale 反向缩放整个工具条,保持视觉尺寸恒定 */
|
|
24
|
+
viewportScale?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function FloorMapEditQuickActions(props: FloorMapEditQuickActionsProps): React.JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FloorMapOverview - 阅读态「All」全览视图(纯渲染版)
|
|
3
|
+
*
|
|
4
|
+
* 仅负责把 {@link OverviewLayout} 中各画布的图元渲染到对应的绝对定位区域里;
|
|
5
|
+
* 由 PisellFloorMapLayout 在主 TransformWrapper 内挂载,与单画布共享同一套
|
|
6
|
+
* 视口控件(缩放、平移、锁定、全屏、fitBounds、网格按钮等)。
|
|
7
|
+
*
|
|
8
|
+
* 设计要点:
|
|
9
|
+
* - 不再自带 TransformWrapper / ResizeObserver / fit 算法;
|
|
10
|
+
* - 每个画布作为独立区域,仅一条细边框作分隔,无背景色/网格;
|
|
11
|
+
* - 画布名显示在边框外的标题带;标题不拦截图元交互;
|
|
12
|
+
* - 仅渲染 ItemLayer(阅读态),与单画布的 hover/click 行为一致;编辑层不渲染。
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import type { OverviewLayout } from '../utils/floorMapOverviewLayout';
|
|
16
|
+
import type { FloorMapItemBase, FloorMapItemUnit, FloorMapRenderOptions, FloorMapViewConfig } from '../types';
|
|
17
|
+
import './FloorMapOverview.less';
|
|
18
|
+
export interface FloorMapOverviewProps<T extends FloorMapItemBase> {
|
|
19
|
+
/** 由 PisellFloorMapLayout 算好的整体布局(区域位置 + 总尺寸) */
|
|
20
|
+
overviewLayout: OverviewLayout;
|
|
21
|
+
/**
|
|
22
|
+
* 仅用于把 `canvas.id` 映射成展示名(区域左上角 chip)。
|
|
23
|
+
* 直接传 config 而非映射表,避免父组件再多构造一层。
|
|
24
|
+
*/
|
|
25
|
+
config: FloorMapViewConfig;
|
|
26
|
+
itemUnit?: FloorMapItemUnit;
|
|
27
|
+
renderItem: (item: T, index: number, options?: FloorMapRenderOptions) => React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* 主 TransformWrapper 的当前缩放,透传到各区域 ItemLayer 的 `viewportScale`。
|
|
30
|
+
* 缺省(undefined)时下游 `renderItem` 拿不到 viewportScale,预约/桌位卡只能
|
|
31
|
+
* 按布局像素算 visualShortSide,**永远停在 comfortable 档**,进不去 tooltip-time
|
|
32
|
+
* 小卡片模式——这正是 All 视图缩放后看不到小卡的根因。
|
|
33
|
+
*/
|
|
34
|
+
viewportScale?: number;
|
|
35
|
+
enableHover?: boolean;
|
|
36
|
+
onItemClick?: (item: T, index: number, e: React.MouseEvent<HTMLElement>) => void;
|
|
37
|
+
onItemHover?: (item: T, index: number, e: React.MouseEvent<HTMLElement>) => void;
|
|
38
|
+
onItemLeave?: (item: T, index: number, e: React.MouseEvent<HTMLElement>) => void;
|
|
39
|
+
getMergedItemWrapperStyle?: (item: T, index: number) => React.CSSProperties | undefined;
|
|
40
|
+
readModeSelectedItemId?: string | null;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function FloorMapOverview<T extends FloorMapItemBase>(props: FloorMapOverviewProps<T>): React.JSX.Element;
|
|
44
|
+
export default FloorMapOverview;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FloorMapToolbar - 编辑态左侧侧边栏:按分类添加图元、绑定数据源与行;保存可选(默认用顶栏)
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { FloorMapViewConfig, FloorMapDataSources, FloorMapMergedItem, FloorMapSceneElement, FloorMapPlaceMode } from '../types';
|
|
6
|
+
import { type FloorMapPaletteDragPayload } from '../utils/floorMapDropUtils';
|
|
7
|
+
import { type FloorMapPaletteBulkPlaceItem, type FloorMapToolbarPaletteEntry } from '../utils/floorMapToolbarPalette';
|
|
8
|
+
import type { FloorMapResourcePickerSlotProps } from '../utils/floorMapResourcePickerTypes';
|
|
9
|
+
import './FloorMapToolbar.less';
|
|
10
|
+
export type { FloorMapPlaceMode as PlaceMode };
|
|
11
|
+
export interface FloorMapToolbarProps {
|
|
12
|
+
config: FloorMapViewConfig;
|
|
13
|
+
dataSources: FloorMapDataSources;
|
|
14
|
+
dataSourceLabels?: Record<string, string>;
|
|
15
|
+
canCreate: boolean;
|
|
16
|
+
placeMode: FloorMapPlaceMode;
|
|
17
|
+
onPlaceModeChange: (mode: FloorMapPlaceMode) => void;
|
|
18
|
+
renderPreviewItem?: (item: FloorMapMergedItem) => React.ReactNode;
|
|
19
|
+
placementPreviewSize?: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
decorationPreviewSize?: number;
|
|
24
|
+
sceneElements?: FloorMapSceneElement[];
|
|
25
|
+
onSave?: () => void;
|
|
26
|
+
saving?: boolean;
|
|
27
|
+
saveError?: Error | string;
|
|
28
|
+
/** 布局草稿已相对持久化配置变更,提示用户点击本栏「保存」 */
|
|
29
|
+
layoutDirty?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
/** 触摸/笔:Pointer 拖拽落点(mouse 仍用 HTML5 DnD) */
|
|
32
|
+
onPaletteCardPointerDown?: (payload: FloorMapPaletteDragPayload, e: React.PointerEvent<HTMLButtonElement>) => void;
|
|
33
|
+
/** 触摸拖放结束后吞掉按钮 click,避免误触切换落点模式 */
|
|
34
|
+
consumeToolbarClickIfTouchDrag?: () => boolean;
|
|
35
|
+
/** 手机布局:侧栏悬浮覆盖画布(由 PisellFloorMapLayout + Less 控制定位) */
|
|
36
|
+
phoneLayout?: boolean;
|
|
37
|
+
/** 为 true 时初始为收起(预约手机编辑态默认收起图元栏) */
|
|
38
|
+
defaultCollapsed?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 手机布局:选中图元种类后,一键在当前视口中心落点(与画布点击落点规则一致)。
|
|
41
|
+
*/
|
|
42
|
+
onRequestPlaceAtCanvasCenter?: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* 每个调色板分类在侧栏直接展示的图元数量;超出则显示「查看全部」(默认见
|
|
45
|
+
* floorMapLayoutConstants.FLOOR_MAP_TOOLBAR_PALETTE_SIDEBAR_LIMIT,默认 5)。
|
|
46
|
+
*/
|
|
47
|
+
paletteSidebarVisibleLimit?: number;
|
|
48
|
+
/** 「查看全部」弹窗确认:批量落在画布右侧空白区(所有分类通用)。 */
|
|
49
|
+
onBulkAddPaletteToCanvas?: (items: FloorMapPaletteBulkPlaceItem[]) => void;
|
|
50
|
+
/**
|
|
51
|
+
* 「查看全部」弹窗渲染槽位:用于业务侧复用统一的选择弹窗(如 Selector + 数量选择)。
|
|
52
|
+
* 未传时使用内置 `FloorMapToolbarViewAllModal`(加减步进器)。
|
|
53
|
+
*/
|
|
54
|
+
renderPaletteViewAllModal?: (props: {
|
|
55
|
+
open: boolean;
|
|
56
|
+
categoryLabel: string;
|
|
57
|
+
entries: FloorMapToolbarPaletteEntry[];
|
|
58
|
+
onClose: () => void;
|
|
59
|
+
onConfirm: (items: FloorMapPaletteBulkPlaceItem[]) => void;
|
|
60
|
+
renderEntryPreview: (entry: FloorMapToolbarPaletteEntry) => React.ReactNode;
|
|
61
|
+
/** 容器平台:手机布局透传 `'h5'`,默认 `'pc'` */
|
|
62
|
+
platform?: 'pc' | 'h5' | 'ipad';
|
|
63
|
+
}) => React.ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* 资源选择弹窗点「确定」:按已选 recordIds 落画布(多选走批量网格,单选落视口中心附近)。
|
|
66
|
+
* @returns 是否已成功写入草稿
|
|
67
|
+
*/
|
|
68
|
+
onResourcePickerConfirmPlace?: (scene: Extract<FloorMapPlaceMode, {
|
|
69
|
+
type: 'scene';
|
|
70
|
+
}>) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* 资源选择 Modal 渲染(必传)。
|
|
73
|
+
* 通用基础 modal 已下线,业务侧需注入实现(如 `PisellProResourcePickerModal`);
|
|
74
|
+
* 未注入时仅打 warn,不渲染选择弹窗,资源选择交互不可用。
|
|
75
|
+
*/
|
|
76
|
+
renderResourcePickerModal?: (props: FloorMapResourcePickerSlotProps) => React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* 无二次选择的调色板项(装饰内置图形、底图图片、`dataBindingPolicy: none` 等):
|
|
79
|
+
* 侧栏点击即落在画布右侧空白区,不进入「再点画布」落点模式。
|
|
80
|
+
*/
|
|
81
|
+
onDirectPlacePaletteItem?: (item: FloorMapPaletteBulkPlaceItem) => void;
|
|
82
|
+
}
|
|
83
|
+
export declare function FloorMapToolbar(props: FloorMapToolbarProps): React.JSX.Element;
|
|
84
|
+
export default FloorMapToolbar;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 侧栏 palette「查看全部」:任意分类下图元超过展示上限时,弹窗内按数量多选并一键落点。
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { type FloorMapPaletteBulkPlaceItem, type FloorMapToolbarPaletteEntry } from '../utils/floorMapToolbarPalette';
|
|
6
|
+
export interface FloorMapToolbarViewAllModalProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
categoryLabel: string;
|
|
9
|
+
entries: FloorMapToolbarPaletteEntry[];
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onConfirm: (items: FloorMapPaletteBulkPlaceItem[]) => void;
|
|
12
|
+
renderEntryPreview: (entry: FloorMapToolbarPaletteEntry) => React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 容器平台:透传到 `PisellContainer` 的 `props.platform`。
|
|
15
|
+
* 手机布局应传 `'h5'`,否则默认 `'pc'`。
|
|
16
|
+
*/
|
|
17
|
+
platform?: 'pc' | 'h5' | 'ipad';
|
|
18
|
+
}
|
|
19
|
+
export declare function FloorMapToolbarViewAllModal(props: FloorMapToolbarViewAllModalProps): React.JSX.Element;
|
|
20
|
+
export default FloorMapToolbarViewAllModal;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 分区(zone)图元展示:虚线容器 + 左上角标题标签,避免与空白占位资源混淆。
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import './FloorMapZoneElement.less';
|
|
6
|
+
export interface FloorMapZoneElementProps {
|
|
7
|
+
name?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function FloorMapZoneElement(props: FloorMapZoneElementProps): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodePortMarkers - 选中图元时显示四向锚点,用于拉线
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { FloorMapEdgeAnchor } from '../types';
|
|
6
|
+
import { type FloorMapItemPixelRect } from '../utils/edgeRouting';
|
|
7
|
+
import './NodePortMarkers.less';
|
|
8
|
+
export interface NodePortMarkersProps {
|
|
9
|
+
rect: FloorMapItemPixelRect;
|
|
10
|
+
contentOffsetX?: number;
|
|
11
|
+
contentOffsetY?: number;
|
|
12
|
+
/** 仅展示/高亮(拉线吸附目标),不可点击 */
|
|
13
|
+
previewOnly?: boolean;
|
|
14
|
+
onAnchorPointerDown?: (anchor: FloorMapEdgeAnchor, event: React.PointerEvent) => void;
|
|
15
|
+
highlightAnchors?: FloorMapEdgeAnchor[];
|
|
16
|
+
className?: string;
|
|
17
|
+
/** 画布 viewport scale,用于把圆点和外移距离按 1/scale 反向缩放,保持视觉尺寸恒定 */
|
|
18
|
+
viewportScale?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function NodePortMarkers(props: NodePortMarkersProps): React.JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewControls - 内置视图控制:默认仅缩放;可选复位、区域定位、全屏等
|
|
3
|
+
* 平面图(dockChrome):Dock 折叠入口 + 展开条(含业务插槽、空闲自动收起)
|
|
4
|
+
* 非平面图:单条横栏,缩放与工具始终同排(无 Menu 折叠)
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { FloorMapControlsConfig } from '../types';
|
|
8
|
+
import './ViewControls.less';
|
|
9
|
+
/** 从 react-zoom-pan-pinch 拿到的控制 API(由主组件传入) */
|
|
10
|
+
export interface ViewControlsApi {
|
|
11
|
+
zoomIn: () => void;
|
|
12
|
+
zoomOut: () => void;
|
|
13
|
+
resetTransform: () => void;
|
|
14
|
+
/** 区域定位,可能由主组件基于 items 计算后封装 */
|
|
15
|
+
fitBounds?: () => void;
|
|
16
|
+
/** 切换全屏(requestFullscreen / exitFullscreen) */
|
|
17
|
+
toggleFullscreen?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ViewControlsProps {
|
|
20
|
+
/** 控制 API */
|
|
21
|
+
api: ViewControlsApi;
|
|
22
|
+
/** 显隐配置 */
|
|
23
|
+
config?: FloorMapControlsConfig;
|
|
24
|
+
/** 当前缩放比例(1 = 100%),用于 Stepper 展示 */
|
|
25
|
+
scale?: number;
|
|
26
|
+
/** 当前是否处于全屏 */
|
|
27
|
+
isFullscreen?: boolean;
|
|
28
|
+
/** 当前 transform 是否处于「适配视口」结果(用于按钮激活态) */
|
|
29
|
+
fitBoundsActive?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
/** 与 config.showGridToggle 联用:当前画布是否显示网格 */
|
|
32
|
+
mapGridVisible?: boolean;
|
|
33
|
+
/** 切换当前画布 draft 的 mapLayer.showGrid */
|
|
34
|
+
onToggleMapGrid?: () => void;
|
|
35
|
+
/** 当前是否显示连线层(与 `enableEdges` 联用) */
|
|
36
|
+
edgesLayerVisible?: boolean;
|
|
37
|
+
/** 切换连线层显隐;未传时不展示连线开关 */
|
|
38
|
+
onToggleEdgesLayer?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* 视口锁定态:true 时显示「已锁定」图标,并禁用所有改变视角的按钮
|
|
41
|
+
* (zoom +/- / reset / fitBounds)。pan / wheel / pinch 由调用方在 TransformWrapper 上同步关闭。
|
|
42
|
+
*/
|
|
43
|
+
viewportLocked?: boolean;
|
|
44
|
+
/** 切换视口锁定;未传时不展示锁定按钮 */
|
|
45
|
+
onToggleViewportLock?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* 平面图 Dock:圆角浅底样式,默认折叠为单入口;展开后含缩放、工具、全屏与 dockExpandedTrailing
|
|
48
|
+
*/
|
|
49
|
+
dockChrome?: boolean;
|
|
50
|
+
/** Dock 展开区内、与缩放/网格等按钮平级的业务工具按钮 */
|
|
51
|
+
dockExpandedToolButtons?: React.ReactNode;
|
|
52
|
+
/** Dock 展开区最右侧业务插槽(如「编辑画布」) */
|
|
53
|
+
dockExpandedTrailing?: React.ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Dock 展开后无操作自动收起(毫秒);0 表示不自动收起
|
|
56
|
+
* @default 10000
|
|
57
|
+
*/
|
|
58
|
+
autoCollapseDockMs?: number;
|
|
59
|
+
}
|
|
60
|
+
export declare function ViewControls(props: ViewControlsProps): React.JSX.Element | null;
|
|
61
|
+
export default ViewControls;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 在 TransformWrapper 内用 useControls 拿到 zoom 控制并渲染 ViewControls,确保点击加减能缩放
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { FloorMapControlsConfig } from '../types';
|
|
6
|
+
export interface ViewControlsWithZoomProps {
|
|
7
|
+
config?: FloorMapControlsConfig;
|
|
8
|
+
scale?: number;
|
|
9
|
+
isFullscreen?: boolean;
|
|
10
|
+
/** 当前 transform 是否吻合「适配视口」结果,用于按钮激活态 */
|
|
11
|
+
fitBoundsActive?: boolean;
|
|
12
|
+
fitBounds: () => void;
|
|
13
|
+
/** 未传时不展示全屏按钮(如编辑态 floorMapFullscreenMode 为 disabled) */
|
|
14
|
+
toggleFullscreen?: () => void;
|
|
15
|
+
mapGridVisible?: boolean;
|
|
16
|
+
onToggleMapGrid?: () => void;
|
|
17
|
+
edgesLayerVisible?: boolean;
|
|
18
|
+
onToggleEdgesLayer?: () => void;
|
|
19
|
+
/** 视口锁定态(true 时所有视角写入入口被禁用) */
|
|
20
|
+
viewportLocked?: boolean;
|
|
21
|
+
/** 切换视口锁定;未传时不展示锁定按钮 */
|
|
22
|
+
onToggleViewportLock?: () => void;
|
|
23
|
+
dockChrome?: boolean;
|
|
24
|
+
dockExpandedToolButtons?: React.ReactNode;
|
|
25
|
+
dockExpandedTrailing?: React.ReactNode;
|
|
26
|
+
autoCollapseDockMs?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function ViewControlsWithZoom(props: ViewControlsWithZoomProps): React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FloorMapItemBase, FloorMapLayoutContextValue, PisellFloorMapLayoutProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 将 `FloorMapLayoutContext` 与 Layout props 合并:各字段 props ?? ctx,props 显式值优先。
|
|
4
|
+
*/
|
|
5
|
+
export declare function mergeFloorMapLayoutPropsFromContext<T extends FloorMapItemBase>(props: PisellFloorMapLayoutProps<T>, ctx: FloorMapLayoutContextValue | undefined): PisellFloorMapLayoutProps<T>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 平面图布局根节点 BEM 前缀,与 `PisellFloorMapLayout.less` 中主 class 一致。
|
|
3
|
+
*/
|
|
4
|
+
export declare const FLOOR_MAP_LAYOUT_CLASS_PREFIX = "pisell-floor-map-layout";
|
|
5
|
+
/** 手机左侧图元栏 Drawer,低于右侧属性抽屉 */
|
|
6
|
+
export declare const FLOOR_MAP_PHONE_TOOLBAR_DRAWER_Z_INDEX = 2001;
|
|
7
|
+
/** 手机右侧图元详情 Drawer */
|
|
8
|
+
export declare const FLOOR_MAP_PHONE_EDIT_DRAWER_Z_INDEX = 2002;
|
|
9
|
+
/**
|
|
10
|
+
* 高于 {@link FLOOR_MAP_PHONE_EDIT_DRAWER_Z_INDEX},用于面板内 Popconfirm 等,避免被抽屉挡住。
|
|
11
|
+
*/
|
|
12
|
+
export declare const FLOOR_MAP_CONFIRM_OVERLAY_Z_INDEX = 2100;
|
|
13
|
+
/**
|
|
14
|
+
* 「全览」伪画布 Tab id。
|
|
15
|
+
* 仅在阅读态、启用画布 > 1 时插入到画布 Tab 列表末尾,用来承载「同时查看所有画布」的入口。
|
|
16
|
+
* 不会写入 `config.canvases`,也不参与视口持久化、items 计算等真实画布逻辑。
|
|
17
|
+
*/
|
|
18
|
+
export declare const FLOOR_MAP_OVERVIEW_TAB_ID = "__pisell_floor_map_overview__";
|
|
19
|
+
/**
|
|
20
|
+
* 全览视图:每个画布区块上方预留的标题带高度(像素)。
|
|
21
|
+
* 装箱时计入画布有效高度,保证画布之间的 gap 能容纳外置标题条。
|
|
22
|
+
*/
|
|
23
|
+
export declare const FLOOR_MAP_OVERVIEW_TITLE_BAND_HEIGHT = 36;
|
|
24
|
+
/** 全览视图:画布区块之间的最小间距(像素,含标题带外的净距) */
|
|
25
|
+
export declare const FLOOR_MAP_OVERVIEW_AREA_GAP = 40;
|
|
26
|
+
/**
|
|
27
|
+
* 编辑态侧栏调色板:每个分类直接展示的图元数量上限。
|
|
28
|
+
* 超出时显示「查看全部」,在弹窗内选择数量并批量落点(所有分类通用)。
|
|
29
|
+
*/
|
|
30
|
+
export declare const FLOOR_MAP_TOOLBAR_PALETTE_SIDEBAR_LIMIT = 5;
|
|
31
|
+
/**
|
|
32
|
+
* 右下 ViewControls Dock 底部留白(px):`bottom: 14` + chrome `56` + 与面板间距 `8`。
|
|
33
|
+
* 编辑/连线属性面板滚动区 `padding-bottom` 引用同名 CSS 变量。
|
|
34
|
+
*/
|
|
35
|
+
export declare const FLOOR_MAP_VIEWPORT_DOCK_BOTTOM_CLEARANCE = 78;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { FloorMapEdge, FloorMapEdgeAnchor, FloorMapItemBase, FloorMapMergedItem, FloorMapViewConfig } from '../types';
|
|
3
|
+
import { type FloorMapItemPixelRect } from '../utils/edgeRouting';
|
|
4
|
+
export interface FloorMapEdgeDrawingState {
|
|
5
|
+
fromInstanceId: string;
|
|
6
|
+
fromAnchor: FloorMapEdgeAnchor;
|
|
7
|
+
}
|
|
8
|
+
export interface UseFloorMapEdgeEditingParams<T extends FloorMapItemBase> {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
config: FloorMapViewConfig | null;
|
|
11
|
+
items: T[];
|
|
12
|
+
mergedItems: FloorMapMergedItem[];
|
|
13
|
+
cellSize: number;
|
|
14
|
+
itemUnit: 'cell' | 'pixel';
|
|
15
|
+
itemGap?: number;
|
|
16
|
+
contentOffsetRef: MutableRefObject<{
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}>;
|
|
20
|
+
selectedId: string | null;
|
|
21
|
+
setSelectedId: (id: string | null) => void;
|
|
22
|
+
commitDraft: (updater: FloorMapViewConfig | ((prev: FloorMapViewConfig) => FloorMapViewConfig)) => void;
|
|
23
|
+
/** 画布内容区 DOM,用于 client → 内容坐标 */
|
|
24
|
+
mapContentRef: MutableRefObject<HTMLElement | null>;
|
|
25
|
+
scale?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function useFloorMapEdgeEditing<T extends FloorMapItemBase>(params: UseFloorMapEdgeEditingParams<T>): {
|
|
28
|
+
edges: FloorMapEdge[];
|
|
29
|
+
routes: import("../utils/edgeRouting").FloorMapEdgeRoute[];
|
|
30
|
+
rectsById: Map<string, FloorMapItemPixelRect>;
|
|
31
|
+
selectedEdgeId: string | null;
|
|
32
|
+
selectedEdge: FloorMapEdge | null;
|
|
33
|
+
selectedNodeRect: FloorMapItemPixelRect | null;
|
|
34
|
+
drawing: FloorMapEdgeDrawingState | null;
|
|
35
|
+
drawingTargetPreview: {
|
|
36
|
+
instanceId: string;
|
|
37
|
+
rect: FloorMapItemPixelRect;
|
|
38
|
+
anchor: FloorMapEdgeAnchor;
|
|
39
|
+
} | null;
|
|
40
|
+
ghostPathD: string | null;
|
|
41
|
+
selectNode: (id: string | null) => void;
|
|
42
|
+
selectEdge: (edgeId: string | null) => void;
|
|
43
|
+
clearEdgeSelection: () => void;
|
|
44
|
+
startDrawingFromAnchor: (instanceId: string, anchor: FloorMapEdgeAnchor) => void;
|
|
45
|
+
handleEdgeClick: (edgeId: string) => void;
|
|
46
|
+
handleMapBackgroundClick: () => void;
|
|
47
|
+
updateEdge: (edgeId: string, patch: Partial<FloorMapEdge>) => void;
|
|
48
|
+
deleteEdge: (edgeId: string) => void;
|
|
49
|
+
setPendingRectsById: import("react").Dispatch<import("react").SetStateAction<Record<string, Partial<FloorMapItemPixelRect>>>>;
|
|
50
|
+
startDraggingSegment: (params: {
|
|
51
|
+
edgeId: string;
|
|
52
|
+
role: 'first' | 'last' | 'inner';
|
|
53
|
+
segmentIndex: number;
|
|
54
|
+
axis: 'h' | 'v';
|
|
55
|
+
startPosition: number;
|
|
56
|
+
clientX: number;
|
|
57
|
+
clientY: number;
|
|
58
|
+
/** 用于计算 stub 长度上限 */
|
|
59
|
+
segmentLength?: number;
|
|
60
|
+
}) => void;
|
|
61
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FloorMapEdge, FloorMapEdgeRouting, FloorMapItemBase } from '../types';
|
|
2
|
+
import { type FloorMapEdgeRoute, type FloorMapItemPixelRect } from '../utils/edgeRouting';
|
|
3
|
+
export declare function useFloorMapEdgeViewModel<T extends FloorMapItemBase>(params: {
|
|
4
|
+
edges: FloorMapEdge[] | undefined;
|
|
5
|
+
items: T[];
|
|
6
|
+
cellSize: number;
|
|
7
|
+
itemUnit: 'cell' | 'pixel';
|
|
8
|
+
itemGap?: number;
|
|
9
|
+
pendingRectsById?: Record<string, Partial<FloorMapItemPixelRect>>;
|
|
10
|
+
/** 拖动中段手柄时的临时 routing 覆盖;优先于 edge.routing */
|
|
11
|
+
pendingRoutingByEdge?: Record<string, FloorMapEdgeRouting>;
|
|
12
|
+
}): {
|
|
13
|
+
routes: FloorMapEdgeRoute[];
|
|
14
|
+
rectsById: Map<string, FloorMapItemPixelRect>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { MouseEvent, MutableRefObject } from 'react';
|
|
2
|
+
import { type PlacementBoundingBox } from '../utils/batchScenePlacementLayout';
|
|
3
|
+
import type { DataSourceFormColumn, FloorMapCanvasNameI18n, FloorMapDataSourceRecordFormContent, FloorMapDataSources, FloorMapItemBase, FloorMapMergedItem, FloorMapPlaceMode, FloorMapSceneElement, FloorMapViewConfig } from '../types';
|
|
4
|
+
export interface UseFloorMapEditStateParams<T extends FloorMapItemBase> {
|
|
5
|
+
floorMapConfigProp: FloorMapViewConfig | undefined;
|
|
6
|
+
isFloorMapView: boolean;
|
|
7
|
+
itemsProp: T[];
|
|
8
|
+
cellSizeProp?: number;
|
|
9
|
+
dataSources: FloorMapDataSources | undefined;
|
|
10
|
+
onSave: ((config: FloorMapViewConfig) => void) | undefined;
|
|
11
|
+
onDataSourceRecordSave: ((dataSourceKey: string, id: string, newData: Record<string, unknown>) => void) | undefined;
|
|
12
|
+
dataSourceFormColumns: Record<string, DataSourceFormColumn[]> | undefined;
|
|
13
|
+
dataSourceRecordForm: Record<string, FloorMapDataSourceRecordFormContent> | undefined;
|
|
14
|
+
dataSourceLabels?: Record<string, string>;
|
|
15
|
+
layoutPrefix: string;
|
|
16
|
+
contentOffsetRef: MutableRefObject<{
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}>;
|
|
20
|
+
showDataSourceRecordFormBlock?: boolean;
|
|
21
|
+
/** 批量落点后由布局层注入:将视口移至新增图元区域 */
|
|
22
|
+
focusViewportOnBoundsRef?: MutableRefObject<((bounds: PlacementBoundingBox) => void) | null>;
|
|
23
|
+
}
|
|
24
|
+
export declare function useFloorMapEditState<T extends FloorMapItemBase>(params: UseFloorMapEditStateParams<T>): {
|
|
25
|
+
config: FloorMapViewConfig | null;
|
|
26
|
+
currentCanvasId: string | null;
|
|
27
|
+
setCurrentCanvasId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
28
|
+
selectedId: string | null;
|
|
29
|
+
setSelectedId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
30
|
+
placeMode: FloorMapPlaceMode;
|
|
31
|
+
setPlaceMode: import("react").Dispatch<import("react").SetStateAction<FloorMapPlaceMode>>;
|
|
32
|
+
mergedItems: FloorMapMergedItem[];
|
|
33
|
+
items: T[];
|
|
34
|
+
saving: boolean;
|
|
35
|
+
savingRecord: boolean;
|
|
36
|
+
handleAddCanvas: () => void;
|
|
37
|
+
handleRemoveCanvas: (canvasId: string) => void;
|
|
38
|
+
handleRenameCanvas: (canvasId: string, name: string | FloorMapCanvasNameI18n) => void;
|
|
39
|
+
handleUpdateItem: (itemId: string, patch: Partial<{
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}>) => void;
|
|
45
|
+
handleCanvasPlaceClick: (e: MouseEvent<HTMLDivElement>) => void;
|
|
46
|
+
handleSave: () => void;
|
|
47
|
+
discardDraft: () => void;
|
|
48
|
+
placeSceneElementFromPaletteDrop: (contentX: number, contentY: number, scene: Extract<FloorMapPlaceMode, {
|
|
49
|
+
type: 'scene';
|
|
50
|
+
}>) => boolean;
|
|
51
|
+
bulkPlacePaletteItems: (items: Array<{
|
|
52
|
+
elementKind: string;
|
|
53
|
+
builtinShapeKey?: string;
|
|
54
|
+
}>) => void;
|
|
55
|
+
editPanelParams: {
|
|
56
|
+
itemId: string;
|
|
57
|
+
sceneElement: FloorMapSceneElement;
|
|
58
|
+
onUpdate: (patch: Partial<FloorMapSceneElement>) => void;
|
|
59
|
+
onSaveRecord: ((dataSourceKey: string, id: string, newData: Record<string, unknown>) => void) | undefined;
|
|
60
|
+
onClose: () => void;
|
|
61
|
+
onDelete: (() => void) | undefined;
|
|
62
|
+
recordFormColumns: Record<string, DataSourceFormColumn[]> | undefined;
|
|
63
|
+
dataSourceRecordForm: Record<string, FloorMapDataSourceRecordFormContent> | undefined;
|
|
64
|
+
dataSourceLabels: Record<string, string> | undefined;
|
|
65
|
+
layoutDraftDirty: boolean;
|
|
66
|
+
showDataSourceRecordFormBlock: boolean | undefined;
|
|
67
|
+
} | null;
|
|
68
|
+
placeOverlayClass: string;
|
|
69
|
+
isLayoutDirty: boolean;
|
|
70
|
+
toggleDraftCanvasShowGrid: () => void;
|
|
71
|
+
toggleSelectedLayoutLock: () => void;
|
|
72
|
+
duplicateSelectedElement: () => void;
|
|
73
|
+
deleteSelectedElement: () => void;
|
|
74
|
+
undoDraft: () => void;
|
|
75
|
+
redoDraft: () => void;
|
|
76
|
+
canUndo: boolean;
|
|
77
|
+
canRedo: boolean;
|
|
78
|
+
commitDraft: (next: FloorMapViewConfig | ((prev: FloorMapViewConfig | null) => FloorMapViewConfig | null) | null, options?: import("./useDraftConfigHistory").DraftHistoryCommitOptions | undefined) => void;
|
|
79
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { FloorMapItemBase, FloorMapItemUnit, FloorMapZoomConfig } from '../types';
|
|
3
|
+
import type { PlacementBoundingBox } from '../utils/batchScenePlacementLayout';
|
|
4
|
+
/** react-zoom-pan-pinch TransformWrapper render 注入的上下文 */
|
|
5
|
+
export declare type FloorMapTransformContext = {
|
|
6
|
+
zoomIn: () => void;
|
|
7
|
+
zoomOut: () => void;
|
|
8
|
+
resetTransform: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* react-zoom-pan-pinch v3 实际签名:(x, y, scale, animationTime?, animationType?)
|
|
11
|
+
* 默认 animationTime≈200ms;传 0 立即落点,避免被前一次动画吃掉或与之冲突
|
|
12
|
+
* (restore / 缓存恢复路径应使用 0 立即覆盖已在缓动中的 fit 动画)。
|
|
13
|
+
* 这里只暴露我们用到的前 4 参;库 animationType 是 `keyof typeof animations` 联合,
|
|
14
|
+
* 暴露过来反而限制传入对象的兼容性,我们也确实不传它。
|
|
15
|
+
*/
|
|
16
|
+
setTransform: (x: number, y: number, scale: number, animationTime?: number) => void;
|
|
17
|
+
} | null;
|
|
18
|
+
export interface UseFloorMapTransformMetricsParams<T extends FloorMapItemBase> {
|
|
19
|
+
items: T[];
|
|
20
|
+
cellSize: number;
|
|
21
|
+
itemGap: number;
|
|
22
|
+
effectiveItemUnit: FloorMapItemUnit;
|
|
23
|
+
isFloorMapView: boolean;
|
|
24
|
+
mode: 'read' | 'edit';
|
|
25
|
+
zoom: FloorMapZoomConfig;
|
|
26
|
+
transformRef: MutableRefObject<FloorMapTransformContext>;
|
|
27
|
+
/** 由父组件创建并传入 useFloorMapEditState,本 hook 每帧写入内容区偏移 */
|
|
28
|
+
contentOffsetRef: MutableRefObject<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}>;
|
|
32
|
+
/** 与 mapLayer.boundingPadding 一致;未传用 DEFAULT_BOUNDING_PADDING */
|
|
33
|
+
boundingPadding?: number;
|
|
34
|
+
/**
|
|
35
|
+
* 平面图:当前画布 id(或其它在切换画布时应重置平移/对齐会话的 key)。
|
|
36
|
+
* 不传则不跑「异步加载图元后的首次左上对齐」逻辑。
|
|
37
|
+
*/
|
|
38
|
+
frameResetKey?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 视口持久化标识(通常拼自 canvasId)。传入后:
|
|
41
|
+
* - 切换 / 挂载时若 localStorage 中有缓存,自动恢复 transform 并跳过本帧 autoFit;
|
|
42
|
+
* - 用户拖动 / 缩放时(节流 300ms)写回缓存;
|
|
43
|
+
* - 主动 fitBounds / 进入伪全屏后由 fitBounds 触发的写入也会同步保存。
|
|
44
|
+
* 不传则完全不读不写 localStorage。
|
|
45
|
+
*/
|
|
46
|
+
viewportPersistKey?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function useFloorMapTransformMetrics<T extends FloorMapItemBase>(params: UseFloorMapTransformMetricsParams<T>): {
|
|
49
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
50
|
+
mapAreaRef: import("react").RefObject<HTMLDivElement>;
|
|
51
|
+
viewportSize: {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
};
|
|
55
|
+
mapAreaSize: {
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
};
|
|
59
|
+
contentWidth: number;
|
|
60
|
+
contentHeight: number;
|
|
61
|
+
contentOffsetX: number;
|
|
62
|
+
contentOffsetY: number;
|
|
63
|
+
initialPositionX: number;
|
|
64
|
+
initialPositionY: number;
|
|
65
|
+
zoomConfig: {
|
|
66
|
+
initialScale: number;
|
|
67
|
+
minScale: number;
|
|
68
|
+
maxScale: number;
|
|
69
|
+
step: number;
|
|
70
|
+
};
|
|
71
|
+
scale: number;
|
|
72
|
+
setScale: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
73
|
+
isFullscreen: boolean;
|
|
74
|
+
toggleFullscreen: () => void;
|
|
75
|
+
fitBounds: () => boolean;
|
|
76
|
+
focusContentBounds: (bounds: PlacementBoundingBox | null) => boolean;
|
|
77
|
+
isAtFitBounds: boolean;
|
|
78
|
+
notifyTransformed: (x: number, y: number, nextScale: number) => void;
|
|
79
|
+
persistCurrentViewport: () => void;
|
|
80
|
+
attachTransformContext: (ctx: NonNullable<FloorMapTransformContext>) => void;
|
|
81
|
+
lastTransformRef: MutableRefObject<{
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
scale: number;
|
|
85
|
+
}>;
|
|
86
|
+
isInteractingWithElement: boolean;
|
|
87
|
+
setIsInteractingWithElement: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
88
|
+
viewportLocked: boolean;
|
|
89
|
+
setViewportLocked: (next: boolean) => void;
|
|
90
|
+
toggleViewportLocked: () => void;
|
|
91
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ShopFloorPlanDetail } from '../shopFloorPlan/shopFloorPlanTypes';
|
|
2
|
+
import type { ShopFloorPlanByCodeRequestOptions } from '../shopFloorPlan/shopFloorPlanTypes';
|
|
3
|
+
export declare type UseShopFloorPlanSubscriptionParams = {
|
|
4
|
+
/** `null` 时不发起请求(与预约页 `resolvedFloorPlanId` 一致);清空状态由调用方处理 */
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
code: string;
|
|
7
|
+
subscriberId: string;
|
|
8
|
+
ensureByCode: (code: string, opts?: ShopFloorPlanByCodeRequestOptions) => Promise<ShopFloorPlanDetail | null>;
|
|
9
|
+
unsubscribeQuery: (subscriberId: string) => Promise<void>;
|
|
10
|
+
onDetail: (detail: ShopFloorPlanDetail) => void;
|
|
11
|
+
onLoadError?: (err: unknown) => void;
|
|
12
|
+
/** 与预约一致:默认 true */
|
|
13
|
+
osServer?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 按 code 订阅店铺平面图:首包 Promise + WebSocket callback 均归一为 `onDetail`。
|
|
17
|
+
* 不包含与业务默认 {@link FloorMapViewConfig} 的合并(由调用方在 `onDetail` 或后续 useMemo 完成)。
|
|
18
|
+
*/
|
|
19
|
+
export declare function useShopFloorPlanSubscription(params: UseShopFloorPlanSubscriptionParams): void;
|