@pisell/materials 1.8.54 → 1.8.55
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 +3 -3
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +35 -35
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +35 -35
- package/es/components/buttonGroupPreview/index.js +8 -4
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +207 -49
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.less +33 -2
- package/es/components/pisellFloorMapLayout/appearance/floorMapAppearance.js +50 -2
- package/es/components/pisellFloorMapLayout/components/EdgeLayer.js +252 -0
- package/es/components/pisellFloorMapLayout/components/EdgeLayer.less +11 -0
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.js +179 -29
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.less +0 -28
- package/es/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.js +131 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.less +65 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +5 -4
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +12 -1
- package/es/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.js +8 -1
- package/es/components/pisellFloorMapLayout/components/FloorMapOverview.js +16 -8
- package/es/components/pisellFloorMapLayout/components/FloorMapOverview.less +69 -17
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.js +290 -147
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.less +210 -11
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.js +81 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +8 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapZoneElement.js +21 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapZoneElement.less +74 -0
- package/es/components/pisellFloorMapLayout/components/ItemLayer.less +3 -1
- package/es/components/pisellFloorMapLayout/components/NodePortMarkers.js +70 -0
- package/es/components/pisellFloorMapLayout/components/NodePortMarkers.less +33 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.js +13 -5
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +2 -0
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +2 -1
- package/es/components/pisellFloorMapLayout/floorMapLayoutConstants.js +1 -1
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.js +340 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.js +102 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +244 -84
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +54 -0
- package/es/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.js +7 -4
- package/es/components/pisellFloorMapLayout/index.d.ts +5 -1
- package/es/components/pisellFloorMapLayout/locales-ja.js +14 -2
- package/es/components/pisellFloorMapLayout/locales-pt.js +14 -2
- package/es/components/pisellFloorMapLayout/locales.js +161 -8
- package/es/components/pisellFloorMapLayout/types.d.ts +86 -4
- package/es/components/pisellFloorMapLayout/types.js +5 -1
- package/es/components/pisellFloorMapLayout/utils/alignSnap.js +170 -0
- package/es/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.js +86 -0
- package/es/components/pisellFloorMapLayout/utils/edgeRouting.js +942 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.d.ts +7 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapCanvasStage.js +23 -1
- package/es/components/pisellFloorMapLayout/utils/floorMapConfigMerge.js +11 -2
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +20 -3
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +11 -5
- package/es/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.js +5 -3
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +20 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.js +62 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +83 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.js +29 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.js +51 -0
- package/es/components/productCard/cartSkuCard/components/BookingItem/index.js +14 -0
- package/es/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
- package/es/components/productCard/cartSkuCard/components/timeRange/index.js +1 -2
- package/es/components/productCard/cartSkuCard/index.js +17 -11
- package/es/components/productCard/lineItem/BookingLineItem.js +6 -4
- package/es/components/productCard/lineItem/components/Resources/index.js +45 -0
- package/es/components/productCard/lineItem/components/TimeRange/index.js +64 -0
- package/es/components/productCard/lineItem/index.js +2 -1
- package/es/components/productCard/lineItem/index.less +21 -10
- package/es/index.d.ts +6 -2
- package/es/index.js +6 -2
- package/es/pisell-materials.tw.css +3 -0
- package/lib/components/buttonGroupPreview/index.js +8 -4
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +206 -48
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.less +33 -2
- package/lib/components/pisellFloorMapLayout/appearance/floorMapAppearance.js +50 -2
- package/lib/components/pisellFloorMapLayout/components/EdgeLayer.js +255 -0
- package/lib/components/pisellFloorMapLayout/components/EdgeLayer.less +11 -0
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.js +179 -29
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.less +0 -28
- package/lib/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.js +134 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.less +65 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +4 -3
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +12 -1
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.js +8 -1
- package/lib/components/pisellFloorMapLayout/components/FloorMapOverview.js +16 -8
- package/lib/components/pisellFloorMapLayout/components/FloorMapOverview.less +69 -17
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.js +287 -144
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.less +210 -11
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.js +84 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +8 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapZoneElement.js +23 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapZoneElement.less +74 -0
- package/lib/components/pisellFloorMapLayout/components/ItemLayer.less +3 -1
- package/lib/components/pisellFloorMapLayout/components/NodePortMarkers.js +73 -0
- package/lib/components/pisellFloorMapLayout/components/NodePortMarkers.less +33 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.js +12 -4
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +2 -0
- package/lib/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +2 -1
- package/lib/components/pisellFloorMapLayout/floorMapLayoutConstants.js +1 -1
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.js +341 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.js +103 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +242 -82
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +54 -0
- package/lib/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.js +7 -4
- package/lib/components/pisellFloorMapLayout/index.d.ts +5 -1
- package/lib/components/pisellFloorMapLayout/locales-ja.js +14 -2
- package/lib/components/pisellFloorMapLayout/locales-pt.js +14 -2
- package/lib/components/pisellFloorMapLayout/locales.js +161 -8
- package/lib/components/pisellFloorMapLayout/types.d.ts +86 -4
- package/lib/components/pisellFloorMapLayout/types.js +5 -0
- package/lib/components/pisellFloorMapLayout/utils/alignSnap.js +170 -0
- package/lib/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.js +87 -0
- package/lib/components/pisellFloorMapLayout/utils/edgeRouting.js +956 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapCanvasDisplay.d.ts +7 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapCanvasStage.js +23 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapConfigMerge.js +11 -2
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +21 -2
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +11 -5
- package/lib/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.js +5 -3
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +20 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.js +64 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +83 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.js +29 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.js +54 -0
- package/lib/components/productCard/cartSkuCard/components/BookingItem/index.js +17 -0
- package/lib/components/productCard/cartSkuCard/components/BookingItem/index.less +32 -0
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.js +1 -2
- package/lib/components/productCard/cartSkuCard/index.js +17 -11
- package/lib/components/productCard/lineItem/BookingLineItem.js +6 -4
- package/lib/components/productCard/lineItem/components/Resources/index.js +47 -0
- package/lib/components/productCard/lineItem/components/TimeRange/index.js +67 -0
- package/lib/components/productCard/lineItem/index.js +2 -1
- package/lib/components/productCard/lineItem/index.less +21 -10
- package/lib/index.d.ts +6 -2
- package/lib/index.js +11 -0
- package/lib/pisell-materials.tw.css +3 -0
- package/package.json +4 -1
|
@@ -4,8 +4,9 @@ const require_types = require("../types.js");
|
|
|
4
4
|
const require_floorMapBuiltinShapes = require("../utils/floorMapBuiltinShapes.js");
|
|
5
5
|
const require_floorMapElementKindUtils = require("../utils/floorMapElementKindUtils.js");
|
|
6
6
|
const require_floorMapDropUtils = require("../utils/floorMapDropUtils.js");
|
|
7
|
-
const require_floorMapDataRecordLabel = require("../utils/floorMapDataRecordLabel.js");
|
|
8
7
|
const require_floorMapLayoutConstants = require("../floorMapLayoutConstants.js");
|
|
8
|
+
const require_floorMapToolbarPalette = require("../utils/floorMapToolbarPalette.js");
|
|
9
|
+
const require_FloorMapToolbarViewAllModal = require("./FloorMapToolbarViewAllModal.js");
|
|
9
10
|
let react = require("react");
|
|
10
11
|
react = require_runtime.__toESM(react);
|
|
11
12
|
let _pisell_utils = require("@pisell/utils");
|
|
@@ -19,12 +20,26 @@ require("./FloorMapToolbar.less");
|
|
|
19
20
|
* FloorMapToolbar - 编辑态左侧侧边栏:按分类添加图元、绑定数据源与行;保存可选(默认用顶栏)
|
|
20
21
|
*/
|
|
21
22
|
const I18N_TB = "pisell-floor-map-layout.toolbar";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/** 绑定类图元:解析默认数据源 key(allowedDataSourceKeys 与 dataSources 交集的首项) */
|
|
24
|
+
function resolveBindingDataSourceKey(kind, dataSources) {
|
|
25
|
+
var _kind$allowedDataSour;
|
|
26
|
+
const allKeys = Object.keys(dataSources !== null && dataSources !== void 0 ? dataSources : {});
|
|
27
|
+
return (((_kind$allowedDataSour = kind.allowedDataSourceKeys) === null || _kind$allowedDataSour === void 0 ? void 0 : _kind$allowedDataSour.length) ? kind.allowedDataSourceKeys.filter((x) => allKeys.includes(x)) : allKeys)[0];
|
|
28
|
+
}
|
|
29
|
+
const DEFAULT_PLACEMENT_SIZE = require_floorMapElementKindUtils.FLOOR_MAP_RESOURCE_PLACE_DEFAULT;
|
|
27
30
|
const DEFAULT_DECORATION_SIZE = 48;
|
|
31
|
+
/**
|
|
32
|
+
* 侧栏 palette 预览:按 cell 尺寸 contain 缩放,并在 cell 内水平/垂直居中。
|
|
33
|
+
* 避免瘦高图形(分隔 / 门)因 `transform-origin: top left` 贴左显示。
|
|
34
|
+
*/
|
|
35
|
+
function getToolbarPreviewScaledStyle(cellW, cellH, contentW, contentH) {
|
|
36
|
+
return {
|
|
37
|
+
width: contentW,
|
|
38
|
+
height: contentH,
|
|
39
|
+
transform: `translate(-50%, -50%) scale(${Math.min(cellW / contentW, cellH / contentH)})`,
|
|
40
|
+
transformOrigin: "center center"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
28
43
|
function getUnplacedRecordsForKey(dataSourceKey, dataSources, elements) {
|
|
29
44
|
var _dataSources$dataSour;
|
|
30
45
|
const used = new Set(elements.filter((e) => {
|
|
@@ -74,13 +89,50 @@ const BUILTIN_SHAPE_PREVIEW_SIZE = {
|
|
|
74
89
|
width: 96,
|
|
75
90
|
height: 96
|
|
76
91
|
};
|
|
92
|
+
/** 侧栏 palette 预览 cell 基准尺寸(再乘 {@link SIDEBAR_PALETTE_PREVIEW_SCALE}) */
|
|
93
|
+
const PALETTE_PREVIEW_CELL_BASE = {
|
|
94
|
+
stage: {
|
|
95
|
+
w: 92,
|
|
96
|
+
h: 40
|
|
97
|
+
},
|
|
98
|
+
placement: {
|
|
99
|
+
w: 80,
|
|
100
|
+
h: 54
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/** 侧栏缩略图相对历史尺寸:现为原先一半(stage 46×20、placement 40×27、装饰 24×24) */
|
|
104
|
+
const SIDEBAR_PALETTE_PREVIEW_SCALE = .5;
|
|
105
|
+
/** 「查看全部」弹窗内预览与侧栏同尺寸(相对历史全尺寸仍为 0.5) */
|
|
106
|
+
const MODAL_PALETTE_PREVIEW_SCALE_RELATIVE_TO_SIDEBAR = 1;
|
|
107
|
+
function resolvePalettePreviewScale(modal) {
|
|
108
|
+
return modal ? SIDEBAR_PALETTE_PREVIEW_SCALE * MODAL_PALETTE_PREVIEW_SCALE_RELATIVE_TO_SIDEBAR : SIDEBAR_PALETTE_PREVIEW_SCALE;
|
|
109
|
+
}
|
|
110
|
+
function scalePalettePreviewCell(n, modal) {
|
|
111
|
+
return Math.max(8, Math.round(n * resolvePalettePreviewScale(modal)));
|
|
112
|
+
}
|
|
113
|
+
/** 侧栏 / 弹窗 palette 预览区外框尺寸 */
|
|
114
|
+
function getPalettePreviewCellSize(options) {
|
|
115
|
+
const { isStage, placementLike, decorationPreviewSize, modal = false } = options;
|
|
116
|
+
const baseW = isStage ? PALETTE_PREVIEW_CELL_BASE.stage.w : placementLike ? PALETTE_PREVIEW_CELL_BASE.placement.w : decorationPreviewSize;
|
|
117
|
+
const baseH = isStage ? PALETTE_PREVIEW_CELL_BASE.stage.h : placementLike ? PALETTE_PREVIEW_CELL_BASE.placement.h : decorationPreviewSize;
|
|
118
|
+
return {
|
|
119
|
+
cellW: scalePalettePreviewCell(baseW, modal),
|
|
120
|
+
cellH: scalePalettePreviewCell(baseH, modal)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
77
123
|
function FloorMapToolbar(props) {
|
|
78
|
-
|
|
124
|
+
var _resourcePickerCtx$mo;
|
|
125
|
+
const { config, dataSources, dataSourceLabels = {}, canCreate, placeMode, onPlaceModeChange, renderPreviewItem, placementPreviewSize = DEFAULT_PLACEMENT_SIZE, decorationPreviewSize = DEFAULT_DECORATION_SIZE, sceneElements = [], onSave, saving, saveError, layoutDirty, className, onPaletteCardPointerDown, consumeToolbarClickIfTouchDrag, phoneLayout = false, defaultCollapsed = false, onRequestPlaceAtCanvasCenter, paletteSidebarVisibleLimit, onBulkAddPaletteToCanvas, onDirectPlacePaletteItem, onResourcePickerConfirmPlace, renderResourcePickerModal } = props;
|
|
79
126
|
/**
|
|
80
127
|
* 侧栏收起 / 展开:仅会话内状态,**不写入 localStorage**。
|
|
81
128
|
* 桌面默认展开;手机编辑态可由 `defaultCollapsed` 默认收起。
|
|
82
129
|
*/
|
|
83
130
|
const [collapsed, setCollapsed] = (0, react.useState)(() => defaultCollapsed === true);
|
|
131
|
+
/** 当前打开的「查看全部」弹窗所属分类(任意分类超过展示上限时触发) */
|
|
132
|
+
const [viewAllModal, setViewAllModal] = (0, react.useState)(null);
|
|
133
|
+
/** 新建绑定类图元:在弹窗内选择数据行(替代侧栏 Select 多选) */
|
|
134
|
+
const [resourcePickerOpen, setResourcePickerOpen] = (0, react.useState)(false);
|
|
135
|
+
const [resourcePickerCtx, setResourcePickerCtx] = (0, react.useState)(null);
|
|
84
136
|
const handleToggleCollapsed = (0, react.useCallback)(() => {
|
|
85
137
|
setCollapsed((prev) => !prev);
|
|
86
138
|
}, []);
|
|
@@ -113,40 +165,212 @@ function FloorMapToolbar(props) {
|
|
|
113
165
|
}
|
|
114
166
|
return map;
|
|
115
167
|
}, [categories, paletteKinds]);
|
|
116
|
-
const
|
|
117
|
-
const
|
|
168
|
+
const paletteEntriesByCategory = (0, react.useMemo)(() => {
|
|
169
|
+
const map = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const c of categories) {
|
|
171
|
+
var _kindsByCategory$get;
|
|
172
|
+
const kinds = (_kindsByCategory$get = kindsByCategory.get(c.id)) !== null && _kindsByCategory$get !== void 0 ? _kindsByCategory$get : [];
|
|
173
|
+
map.set(c.id, require_floorMapToolbarPalette.buildToolbarPaletteEntries(kinds, (shapeDef) => _pisell_utils.locales.getText(shapeDef.labelKey)));
|
|
174
|
+
}
|
|
175
|
+
return map;
|
|
176
|
+
}, [categories, kindsByCategory]);
|
|
177
|
+
const directPlacePaletteItem = (item) => {
|
|
178
|
+
onDirectPlacePaletteItem === null || onDirectPlacePaletteItem === void 0 || onDirectPlacePaletteItem(item);
|
|
179
|
+
onPlaceModeChange(null);
|
|
180
|
+
};
|
|
181
|
+
const cancelPlaceMode = () => {
|
|
182
|
+
onPlaceModeChange(null);
|
|
183
|
+
setResourcePickerOpen(false);
|
|
184
|
+
setResourcePickerCtx(null);
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* 绑定类图元:自动选定数据源并打开资源筛选弹窗(不再在侧栏先选单选项数据源)。
|
|
188
|
+
*/
|
|
189
|
+
const openResourcePickerForBindingKind = (0, react.useCallback)((kind, carryMode) => {
|
|
190
|
+
const key = resolveBindingDataSourceKey(kind, dataSources);
|
|
191
|
+
if (!key) {
|
|
192
|
+
antd.message.warning(_pisell_utils.locales.getText(`${I18N_TB}.no-data-sources`));
|
|
193
|
+
setResourcePickerOpen(false);
|
|
194
|
+
setResourcePickerCtx(null);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const unplaced = getUnplacedRecordsForKey(key, dataSources, sceneElements);
|
|
198
|
+
const sameKind = (carryMode === null || carryMode === void 0 ? void 0 : carryMode.elementKind) === kind.value ? carryMode : void 0;
|
|
199
|
+
const mode = {
|
|
118
200
|
type: "scene",
|
|
119
201
|
elementKind: kind.value,
|
|
120
|
-
dataSourceKey:
|
|
121
|
-
recordId: void 0
|
|
202
|
+
dataSourceKey: key,
|
|
203
|
+
recordId: sameKind === null || sameKind === void 0 ? void 0 : sameKind.recordId,
|
|
204
|
+
recordIds: sameKind === null || sameKind === void 0 ? void 0 : sameKind.recordIds
|
|
122
205
|
};
|
|
123
|
-
onPlaceModeChange(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
onPlaceModeChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, mode), {}, {
|
|
206
|
+
onPlaceModeChange(mode);
|
|
207
|
+
setResourcePickerCtx({
|
|
208
|
+
mode,
|
|
127
209
|
dataSourceKey: key,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
210
|
+
records: unplaced
|
|
211
|
+
});
|
|
212
|
+
setResourcePickerOpen(true);
|
|
213
|
+
}, [
|
|
214
|
+
dataSources,
|
|
215
|
+
sceneElements,
|
|
216
|
+
onPlaceModeChange
|
|
217
|
+
]);
|
|
218
|
+
const handleSelectKind = (kind) => {
|
|
219
|
+
/** 装饰分类下无绑定项(如底图图片):点击即落画布 */
|
|
220
|
+
if (require_floorMapElementKindUtils.isDirectPlacePaletteKind(kind)) {
|
|
221
|
+
setResourcePickerOpen(false);
|
|
222
|
+
setResourcePickerCtx(null);
|
|
223
|
+
directPlacePaletteItem({ elementKind: kind.value });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if ((placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" && placeMode.elementKind === kind.value) {
|
|
227
|
+
cancelPlaceMode();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
openResourcePickerForBindingKind(kind, (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" ? placeMode : void 0);
|
|
131
231
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}));
|
|
232
|
+
/** 内置图形(厕所/分隔/柱子等):点击即落画布,无需再点画布 */
|
|
233
|
+
const handleSelectBuiltinShape = (kind, shapeKey) => {
|
|
234
|
+
directPlacePaletteItem({
|
|
235
|
+
elementKind: kind.value,
|
|
236
|
+
builtinShapeKey: shapeKey
|
|
237
|
+
});
|
|
139
238
|
};
|
|
239
|
+
const resourcePickerModalProps = resourcePickerOpen && resourcePickerCtx ? {
|
|
240
|
+
open: true,
|
|
241
|
+
records: resourcePickerCtx.records,
|
|
242
|
+
mode: "multiple",
|
|
243
|
+
value: ((_resourcePickerCtx$mo = resourcePickerCtx.mode.recordIds) === null || _resourcePickerCtx$mo === void 0 ? void 0 : _resourcePickerCtx$mo.length) ? resourcePickerCtx.mode.recordIds : resourcePickerCtx.mode.recordId ? [resourcePickerCtx.mode.recordId] : [],
|
|
244
|
+
title: dataSourceLabels[resourcePickerCtx.dataSourceKey] ? `${_pisell_utils.locales.getText(`${I18N_TB}.open-resource-picker`)} — ${dataSourceLabels[resourcePickerCtx.dataSourceKey]}` : _pisell_utils.locales.getText(`${I18N_TB}.open-resource-picker`),
|
|
245
|
+
onClose: cancelPlaceMode,
|
|
246
|
+
onConfirm: (ids) => {
|
|
247
|
+
var _ids$filter, _onResourcePickerConf;
|
|
248
|
+
const list = (_ids$filter = ids === null || ids === void 0 ? void 0 : ids.filter(Boolean)) !== null && _ids$filter !== void 0 ? _ids$filter : [];
|
|
249
|
+
if (list.length === 0) {
|
|
250
|
+
antd.message.warning(_pisell_utils.locales.getText(`${I18N_TB}.resource-picker-none-selected`));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const scene = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, resourcePickerCtx.mode), {}, {
|
|
254
|
+
recordIds: list,
|
|
255
|
+
recordId: void 0
|
|
256
|
+
});
|
|
257
|
+
setResourcePickerOpen(false);
|
|
258
|
+
setResourcePickerCtx(null);
|
|
259
|
+
if (!((_onResourcePickerConf = onResourcePickerConfirmPlace === null || onResourcePickerConfirmPlace === void 0 ? void 0 : onResourcePickerConfirmPlace(scene)) !== null && _onResourcePickerConf !== void 0 ? _onResourcePickerConf : false)) onPlaceModeChange(scene);
|
|
260
|
+
}
|
|
261
|
+
} : null;
|
|
262
|
+
const resourcePickerModal = resourcePickerModalProps && renderResourcePickerModal ? renderResourcePickerModal(resourcePickerModalProps) : null;
|
|
263
|
+
const warnedMissingResourcePickerRef = (0, react.useRef)(false);
|
|
264
|
+
(0, react.useEffect)(() => {
|
|
265
|
+
if (!resourcePickerModalProps || renderResourcePickerModal) return;
|
|
266
|
+
if (warnedMissingResourcePickerRef.current) return;
|
|
267
|
+
warnedMissingResourcePickerRef.current = true;
|
|
268
|
+
/**
|
|
269
|
+
* 通用基础 modal 已下线;业务侧需通过 `renderResourcePickerModal` 注入实现。
|
|
270
|
+
*/
|
|
271
|
+
if (typeof console !== "undefined") console.warn("[PisellFloorMapLayout] renderResourcePickerModal 未注入,资源选择弹窗不会渲染。");
|
|
272
|
+
}, [resourcePickerModalProps, renderResourcePickerModal]);
|
|
140
273
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
274
|
+
* 弹窗 / 侧栏缩略图:仅渲染预览 cell,不含落点控件。
|
|
275
|
+
* @param modal 为 true 时用于「查看全部」弹窗(尺寸与侧栏预览一致)
|
|
143
276
|
*/
|
|
144
|
-
const
|
|
145
|
-
|
|
277
|
+
const renderPaletteEntryPreview = (entry, modal = false) => {
|
|
278
|
+
var _item$width, _item$height;
|
|
279
|
+
const k = entry.kind;
|
|
280
|
+
const policy = require_floorMapElementKindUtils.resolveDataBindingPolicy(k);
|
|
281
|
+
const isStage = k.value === require_types.FLOOR_MAP_STAGE_ELEMENT_KIND;
|
|
282
|
+
const isImageKind = k.value === require_types.FLOOR_MAP_IMAGE_ELEMENT_KIND;
|
|
283
|
+
const isBuiltinShapeKind = k.value === require_types.FLOOR_MAP_BUILTIN_SHAPE_ELEMENT_KIND;
|
|
284
|
+
const placementLike = policy !== "none" && !isStage || isImageKind || isBuiltinShapeKind;
|
|
285
|
+
const size = entry.shapeDef ? entry.shapeDef.defaultSize : isStage ? STAGE_PREVIEW_SIZE : placementLike ? isImageKind ? IMAGE_PREVIEW_SIZE : isBuiltinShapeKind ? BUILTIN_SHAPE_PREVIEW_SIZE : placementPreviewSize : {
|
|
286
|
+
width: decorationPreviewSize,
|
|
287
|
+
height: decorationPreviewSize
|
|
288
|
+
};
|
|
289
|
+
const item = buildScenePreviewMergedItem(k, void 0, {
|
|
290
|
+
width: size.width,
|
|
291
|
+
height: size.height
|
|
292
|
+
}, entry.builtinShapeKey);
|
|
293
|
+
const { cellW, cellH } = getPalettePreviewCellSize({
|
|
294
|
+
isStage,
|
|
295
|
+
placementLike,
|
|
296
|
+
decorationPreviewSize,
|
|
297
|
+
modal
|
|
298
|
+
});
|
|
299
|
+
const previewW = entry.shapeDef ? entry.shapeDef.defaultSize.width : isImageKind ? IMAGE_PREVIEW_SIZE.width : isBuiltinShapeKind ? BUILTIN_SHAPE_PREVIEW_SIZE.width : placementPreviewSize.width;
|
|
300
|
+
const previewH = entry.shapeDef ? entry.shapeDef.defaultSize.height : isImageKind ? IMAGE_PREVIEW_SIZE.height : isBuiltinShapeKind ? BUILTIN_SHAPE_PREVIEW_SIZE.height : placementPreviewSize.height;
|
|
301
|
+
const stageW = (_item$width = item.width) !== null && _item$width !== void 0 ? _item$width : cellW;
|
|
302
|
+
const stageH = (_item$height = item.height) !== null && _item$height !== void 0 ? _item$height : cellH;
|
|
303
|
+
const contentW = entry.shapeDef ? entry.shapeDef.defaultSize.width : isStage ? stageW : placementLike ? previewW : decorationPreviewSize;
|
|
304
|
+
const contentH = entry.shapeDef ? entry.shapeDef.defaultSize.height : isStage ? stageH : placementLike ? previewH : decorationPreviewSize;
|
|
305
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
306
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-cell`,
|
|
307
|
+
style: {
|
|
308
|
+
width: cellW,
|
|
309
|
+
height: cellH
|
|
310
|
+
}
|
|
311
|
+
}, renderPreviewItem ? /* @__PURE__ */ react.default.createElement("div", {
|
|
312
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-content`,
|
|
313
|
+
style: getToolbarPreviewScaledStyle(cellW, cellH, contentW, contentH)
|
|
314
|
+
}, renderPreviewItem(item)) : /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-fallback` }, entry.label));
|
|
315
|
+
};
|
|
316
|
+
const paletteViewAllModal = viewAllModal ? /* @__PURE__ */ react.default.createElement(require_FloorMapToolbarViewAllModal.default, {
|
|
317
|
+
open: true,
|
|
318
|
+
categoryLabel: viewAllModal.categoryLabel,
|
|
319
|
+
entries: viewAllModal.entries,
|
|
320
|
+
onClose: () => setViewAllModal(null),
|
|
321
|
+
onConfirm: (items) => {
|
|
322
|
+
onBulkAddPaletteToCanvas === null || onBulkAddPaletteToCanvas === void 0 || onBulkAddPaletteToCanvas(items);
|
|
323
|
+
},
|
|
324
|
+
renderEntryPreview: (entry) => renderPaletteEntryPreview(entry, true)
|
|
325
|
+
}) : null;
|
|
326
|
+
/** 内置图形:每种预设单独一张 palette 卡,图标与名称直接展开 */
|
|
327
|
+
const renderBuiltinShapePaletteCard = (kind, shapeDef) => {
|
|
328
|
+
const shapeLabel = _pisell_utils.locales.getText(shapeDef.labelKey);
|
|
329
|
+
const previewW = shapeDef.defaultSize.width;
|
|
330
|
+
const previewH = shapeDef.defaultSize.height;
|
|
331
|
+
const { cellW, cellH } = getPalettePreviewCellSize({
|
|
332
|
+
isStage: false,
|
|
333
|
+
placementLike: true,
|
|
334
|
+
decorationPreviewSize
|
|
335
|
+
});
|
|
336
|
+
const item = buildScenePreviewMergedItem(kind, void 0, {
|
|
337
|
+
width: previewW,
|
|
338
|
+
height: previewH
|
|
339
|
+
}, shapeDef.key);
|
|
340
|
+
const paletteDragPayload = {
|
|
341
|
+
elementKind: kind.value,
|
|
342
|
+
builtinShapeKey: shapeDef.key
|
|
343
|
+
};
|
|
344
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
345
|
+
key: `${kind.value}-${shapeDef.key}`,
|
|
346
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-card-wrap`
|
|
347
|
+
}, /* @__PURE__ */ react.default.createElement("button", {
|
|
348
|
+
type: "button",
|
|
349
|
+
draggable: true,
|
|
350
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-card`,
|
|
351
|
+
onClick: () => {
|
|
352
|
+
if (consumeToolbarClickIfTouchDrag === null || consumeToolbarClickIfTouchDrag === void 0 ? void 0 : consumeToolbarClickIfTouchDrag()) return;
|
|
353
|
+
handleSelectBuiltinShape(kind, shapeDef.key);
|
|
354
|
+
},
|
|
355
|
+
onPointerDown: (e) => onPaletteCardPointerDown === null || onPaletteCardPointerDown === void 0 ? void 0 : onPaletteCardPointerDown(paletteDragPayload, e),
|
|
356
|
+
onDragStart: (e) => {
|
|
357
|
+
e.dataTransfer.setData(require_floorMapDropUtils.FLOOR_MAP_PALETTE_DRAG_MIME, JSON.stringify(paletteDragPayload));
|
|
358
|
+
e.dataTransfer.effectAllowed = "copy";
|
|
359
|
+
},
|
|
360
|
+
title: _pisell_utils.locales.getText(`${I18N_TB}.palette-card-title`).replace(/\{name\}/g, shapeLabel)
|
|
361
|
+
}, /* @__PURE__ */ react.default.createElement("div", {
|
|
362
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-cell`,
|
|
363
|
+
style: {
|
|
364
|
+
width: cellW,
|
|
365
|
+
height: cellH
|
|
366
|
+
}
|
|
367
|
+
}, renderPreviewItem ? /* @__PURE__ */ react.default.createElement("div", {
|
|
368
|
+
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-content`,
|
|
369
|
+
style: getToolbarPreviewScaledStyle(cellW, cellH, previewW, previewH)
|
|
370
|
+
}, renderPreviewItem(item)) : /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-fallback` }, shapeLabel)), /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-card-label` }, shapeLabel)));
|
|
146
371
|
};
|
|
147
|
-
const cancelPlaceMode = () => onPlaceModeChange(null);
|
|
148
372
|
const renderKindCard = (k) => {
|
|
149
|
-
var _placeMode$builtinSha, _FLOOR_MAP_BUILTIN_SH2, _FLOOR_MAP_BUILTIN_SH3,
|
|
373
|
+
var _placeMode$builtinSha, _FLOOR_MAP_BUILTIN_SH2, _FLOOR_MAP_BUILTIN_SH3, _item$width2, _item$height2, _k$allowedDataSourceK, _FLOOR_MAP_BUILTIN_SH4;
|
|
150
374
|
const policy = require_floorMapElementKindUtils.resolveDataBindingPolicy(k);
|
|
151
375
|
const isStage = k.value === require_types.FLOOR_MAP_STAGE_ELEMENT_KIND;
|
|
152
376
|
const isImageKind = k.value === require_types.FLOOR_MAP_IMAGE_ELEMENT_KIND;
|
|
@@ -166,18 +390,20 @@ function FloorMapToolbar(props) {
|
|
|
166
390
|
const item = buildScenePreviewMergedItem(k, activeDs, size, activeBuiltinShapeKey);
|
|
167
391
|
const isActive = (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" && placeMode.elementKind === k.value;
|
|
168
392
|
/**
|
|
169
|
-
* 预览缩略图尺寸:配合 sidebar 124px
|
|
170
|
-
* stage
|
|
171
|
-
* placeScale / stageScale 都基于 cellW/cellH 推导,改尺寸时缩放因子自动适配。
|
|
393
|
+
* 预览缩略图尺寸:配合 sidebar 124px 抽屉;相对历史尺寸为一半。
|
|
394
|
+
* stage 46×20、placement-like 40×27、装饰类 decorationPreviewSize×0.5(默认 24)。
|
|
172
395
|
*/
|
|
173
|
-
const cellW
|
|
174
|
-
|
|
396
|
+
const { cellW, cellH } = getPalettePreviewCellSize({
|
|
397
|
+
isStage,
|
|
398
|
+
placementLike,
|
|
399
|
+
decorationPreviewSize
|
|
400
|
+
});
|
|
175
401
|
const previewW = isImageKind ? IMAGE_PREVIEW_SIZE.width : isBuiltinShapeKind ? BUILTIN_SHAPE_PREVIEW_SIZE.width : placementPreviewSize.width;
|
|
176
402
|
const previewH = isImageKind ? IMAGE_PREVIEW_SIZE.height : isBuiltinShapeKind ? BUILTIN_SHAPE_PREVIEW_SIZE.height : placementPreviewSize.height;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
403
|
+
const stageW = (_item$width2 = item.width) !== null && _item$width2 !== void 0 ? _item$width2 : cellW;
|
|
404
|
+
const stageH = (_item$height2 = item.height) !== null && _item$height2 !== void 0 ? _item$height2 : cellH;
|
|
179
405
|
const allKeys = Object.keys(dataSources);
|
|
180
|
-
|
|
406
|
+
!((_k$allowedDataSourceK = k.allowedDataSourceKeys) === null || _k$allowedDataSourceK === void 0) && _k$allowedDataSourceK.length && k.allowedDataSourceKeys.filter((x) => allKeys.includes(x));
|
|
181
407
|
const paletteDragPayload = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ elementKind: k.value }, (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" && placeMode.elementKind === k.value ? require_objectSpread2._objectSpread2({ dataSourceKey: placeMode.dataSourceKey }, placeMode.recordIds && placeMode.recordIds.length > 0 ? { recordIds: placeMode.recordIds } : placeMode.recordId ? { recordId: placeMode.recordId } : {}) : {}), isBuiltinShapeKind ? { builtinShapeKey: activeBuiltinShapeKey !== null && activeBuiltinShapeKey !== void 0 ? activeBuiltinShapeKey : (_FLOOR_MAP_BUILTIN_SH4 = require_floorMapBuiltinShapes.FLOOR_MAP_BUILTIN_SHAPES[0]) === null || _FLOOR_MAP_BUILTIN_SH4 === void 0 ? void 0 : _FLOOR_MAP_BUILTIN_SH4.key } : {});
|
|
182
408
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
183
409
|
key: k.value,
|
|
@@ -204,104 +430,8 @@ function FloorMapToolbar(props) {
|
|
|
204
430
|
}
|
|
205
431
|
}, renderPreviewItem ? /* @__PURE__ */ react.default.createElement("div", {
|
|
206
432
|
className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-content`,
|
|
207
|
-
style: placementLike ?
|
|
208
|
-
|
|
209
|
-
height: previewH,
|
|
210
|
-
transform: `scale(${placeScale})`,
|
|
211
|
-
transformOrigin: "top left"
|
|
212
|
-
} : isStage ? {
|
|
213
|
-
width: item.width,
|
|
214
|
-
height: item.height,
|
|
215
|
-
transform: `scale(${stageScale})`,
|
|
216
|
-
transformOrigin: "top left"
|
|
217
|
-
} : void 0
|
|
218
|
-
}, renderPreviewItem(item)) : /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-fallback` }, k.label)), /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-card-label` }, k.label)), isActive && policy !== "none" && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, allowedKeys.length >= 1 && /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick` }, /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick-label` }, _pisell_utils.locales.getText(`${I18N_TB}.data-binding-optional`)), /* @__PURE__ */ react.default.createElement(antd.Select, {
|
|
219
|
-
placeholder: _pisell_utils.locales.getText(I18N_EP_DS),
|
|
220
|
-
allowClear: true,
|
|
221
|
-
value: placeMode.type === "scene" ? placeMode.dataSourceKey : void 0,
|
|
222
|
-
options: allowedKeys.map((key) => {
|
|
223
|
-
var _dataSourceLabels$key;
|
|
224
|
-
return {
|
|
225
|
-
value: key,
|
|
226
|
-
label: (_dataSourceLabels$key = dataSourceLabels[key]) !== null && _dataSourceLabels$key !== void 0 ? _dataSourceLabels$key : key
|
|
227
|
-
};
|
|
228
|
-
}),
|
|
229
|
-
onChange: (v) => {
|
|
230
|
-
if ((placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene") handleDsChange(placeMode, v);
|
|
231
|
-
},
|
|
232
|
-
size: "large",
|
|
233
|
-
style: { width: "100%" },
|
|
234
|
-
popupMatchSelectWidth: false
|
|
235
|
-
}), (() => {
|
|
236
|
-
const mode = (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" ? placeMode : null;
|
|
237
|
-
const key = mode === null || mode === void 0 ? void 0 : mode.dataSourceKey;
|
|
238
|
-
if (!key) return /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick-hint` }, _pisell_utils.locales.getText(`${I18N_TB}.hint-after-select-ds`));
|
|
239
|
-
const unplaced = getUnplacedRecordsForKey(key, dataSources, sceneElements);
|
|
240
|
-
if (unplaced.length === 0) return /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick-hint` }, _pisell_utils.locales.getText(`${I18N_TB}.hint-no-unplaced-rows`));
|
|
241
|
-
const recordValue = (mode === null || mode === void 0 ? void 0 : mode.recordIds) && mode.recordIds.length > 0 ? mode.recordIds : (mode === null || mode === void 0 ? void 0 : mode.recordId) ? [mode.recordId] : void 0;
|
|
242
|
-
return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(antd.Select, {
|
|
243
|
-
mode: "multiple",
|
|
244
|
-
placeholder: _pisell_utils.locales.getText(`${I18N_TB}.ph-select-records`),
|
|
245
|
-
allowClear: true,
|
|
246
|
-
maxTagCount: "responsive",
|
|
247
|
-
value: recordValue,
|
|
248
|
-
options: unplaced.map((r) => ({
|
|
249
|
-
value: r.id,
|
|
250
|
-
label: require_floorMapDataRecordLabel.formatDataRecordOptionLabel(r)
|
|
251
|
-
})),
|
|
252
|
-
onChange: (v) => {
|
|
253
|
-
if (mode) handleRecordsChange(mode, v);
|
|
254
|
-
},
|
|
255
|
-
size: "large",
|
|
256
|
-
style: {
|
|
257
|
-
width: "100%",
|
|
258
|
-
marginTop: 4
|
|
259
|
-
},
|
|
260
|
-
popupMatchSelectWidth: false
|
|
261
|
-
}), /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick-hint` }, _pisell_utils.locales.getText(`${I18N_TB}.hint-multi-drop`)));
|
|
262
|
-
})()), allowedKeys.length === 0 && /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-hint` }, _pisell_utils.locales.getText(`${I18N_TB}.no-data-sources`)), phoneLayout && onRequestPlaceAtCanvasCenter ? /* @__PURE__ */ react.default.createElement("button", {
|
|
263
|
-
type: "button",
|
|
264
|
-
className: (0, classnames.default)(`pisell-floor-map-layout-toolbar-btn`, "primary"),
|
|
265
|
-
onClick: onRequestPlaceAtCanvasCenter
|
|
266
|
-
}, _pisell_utils.locales.getText(`${I18N_TB}.add-to-canvas`)) : null, /* @__PURE__ */ react.default.createElement("button", {
|
|
267
|
-
type: "button",
|
|
268
|
-
className: `pisell-floor-map-layout-toolbar-btn cancel-inline`,
|
|
269
|
-
onClick: cancelPlaceMode
|
|
270
|
-
}, _pisell_utils.locales.getText(`${I18N_TB}.cancel-place`))), isActive && policy === "none" && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, isBuiltinShapeKind && /* @__PURE__ */ react.default.createElement(
|
|
271
|
-
"div",
|
|
272
|
-
/**
|
|
273
|
-
* 内置图形 kind:在「点击 / 拖拽落点」之前,先在这里选好要落的图形
|
|
274
|
-
* (厕所 / 分隔 / 柱子 / 沙发 / 大门 等)。落点的初始 builtinShapeKey
|
|
275
|
-
* 即取自当前 Select 值;落点后仍可在右侧编辑面板再切换。
|
|
276
|
-
*
|
|
277
|
-
* 与资源类 kind 的「dataSource + records」预选 UX 同款,避免必须先落
|
|
278
|
-
* 一个默认图形再到编辑面板里改。
|
|
279
|
-
*/
|
|
280
|
-
{ className: `pisell-floor-map-layout-toolbar-record-pick` },
|
|
281
|
-
/* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-record-pick-label` }, _pisell_utils.locales.getText("pisell-floor-map-layout.builtin-shape.palette-pick-label")),
|
|
282
|
-
/* @__PURE__ */ react.default.createElement(antd.Select, {
|
|
283
|
-
placeholder: _pisell_utils.locales.getText("pisell-floor-map-layout.edit-panel.ph-builtin-shape"),
|
|
284
|
-
value: (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" ? (_placeMode$builtinSha2 = placeMode.builtinShapeKey) !== null && _placeMode$builtinSha2 !== void 0 ? _placeMode$builtinSha2 : (_FLOOR_MAP_BUILTIN_SH5 = require_floorMapBuiltinShapes.FLOOR_MAP_BUILTIN_SHAPES[0]) === null || _FLOOR_MAP_BUILTIN_SH5 === void 0 ? void 0 : _FLOOR_MAP_BUILTIN_SH5.key : void 0,
|
|
285
|
-
options: require_floorMapBuiltinShapes.FLOOR_MAP_BUILTIN_SHAPES.map((s) => ({
|
|
286
|
-
value: s.key,
|
|
287
|
-
label: _pisell_utils.locales.getText(s.labelKey)
|
|
288
|
-
})),
|
|
289
|
-
onChange: (v) => {
|
|
290
|
-
if ((placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene") handleBuiltinShapeKeyChange(placeMode, v);
|
|
291
|
-
},
|
|
292
|
-
size: "large",
|
|
293
|
-
style: { width: "100%" },
|
|
294
|
-
popupMatchSelectWidth: false
|
|
295
|
-
})
|
|
296
|
-
), phoneLayout && onRequestPlaceAtCanvasCenter ? /* @__PURE__ */ react.default.createElement("button", {
|
|
297
|
-
type: "button",
|
|
298
|
-
className: (0, classnames.default)(`pisell-floor-map-layout-toolbar-btn`, "primary"),
|
|
299
|
-
onClick: onRequestPlaceAtCanvasCenter
|
|
300
|
-
}, _pisell_utils.locales.getText(`${I18N_TB}.add-to-canvas`)) : null, /* @__PURE__ */ react.default.createElement("button", {
|
|
301
|
-
type: "button",
|
|
302
|
-
className: `pisell-floor-map-layout-toolbar-btn cancel-inline`,
|
|
303
|
-
onClick: cancelPlaceMode
|
|
304
|
-
}, _pisell_utils.locales.getText(`${I18N_TB}.cancel-place`))));
|
|
433
|
+
style: getToolbarPreviewScaledStyle(cellW, cellH, isStage ? stageW : placementLike ? previewW : decorationPreviewSize, isStage ? stageH : placementLike ? previewH : decorationPreviewSize)
|
|
434
|
+
}, renderPreviewItem(item)) : /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-fallback` }, k.label)), /* @__PURE__ */ react.default.createElement("span", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-preview-card-label` }, k.label)));
|
|
305
435
|
};
|
|
306
436
|
const collapseBtn = /* @__PURE__ */ react.default.createElement("button", {
|
|
307
437
|
type: "button",
|
|
@@ -315,14 +445,27 @@ function FloorMapToolbar(props) {
|
|
|
315
445
|
* 桌面:宽度跟随 sidebar(100%)伸缩;手机:antd Drawer 承载内容 + 边缘折叠柄。
|
|
316
446
|
*/
|
|
317
447
|
const toolbarInner = /* @__PURE__ */ react.default.createElement("div", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-inner` }, /* @__PURE__ */ react.default.createElement("div", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-body` }, canCreate && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, categories.map((cat) => {
|
|
318
|
-
var
|
|
319
|
-
const
|
|
320
|
-
if (!
|
|
448
|
+
var _paletteEntriesByCate;
|
|
449
|
+
const entries = (_paletteEntriesByCate = paletteEntriesByCategory.get(cat.id)) !== null && _paletteEntriesByCate !== void 0 ? _paletteEntriesByCate : [];
|
|
450
|
+
if (!entries.length) return null;
|
|
451
|
+
const visibleEntries = require_floorMapToolbarPalette.getPaletteSidebarVisibleEntries(entries, paletteSidebarVisibleLimit);
|
|
452
|
+
const showViewAll = require_floorMapToolbarPalette.shouldShowPaletteViewAll(entries.length, paletteSidebarVisibleLimit);
|
|
321
453
|
return /* @__PURE__ */ react.default.createElement("section", {
|
|
322
454
|
key: cat.id,
|
|
323
455
|
className: `pisell-floor-map-layout-toolbar-section`
|
|
324
|
-
}, /* @__PURE__ */ react.default.createElement("h3", { className: `pisell-floor-map-layout-toolbar-section-title` }, cat.label), /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-preview-list` }, /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-preview-group` },
|
|
325
|
-
|
|
456
|
+
}, /* @__PURE__ */ react.default.createElement("h3", { className: `pisell-floor-map-layout-toolbar-section-title` }, cat.label), /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-preview-list` }, /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-preview-group` }, visibleEntries.map((entry) => entry.builtinShapeKey && entry.shapeDef ? renderBuiltinShapePaletteCard(entry.kind, entry.shapeDef) : renderKindCard(entry.kind)), showViewAll ? /* @__PURE__ */ react.default.createElement("button", {
|
|
457
|
+
type: "button",
|
|
458
|
+
className: `pisell-floor-map-layout-toolbar-view-all`,
|
|
459
|
+
onClick: () => setViewAllModal({
|
|
460
|
+
categoryLabel: cat.label,
|
|
461
|
+
entries
|
|
462
|
+
})
|
|
463
|
+
}, _pisell_utils.locales.getText(`${I18N_TB}.view-all`)) : null)));
|
|
464
|
+
})), phoneLayout && onRequestPlaceAtCanvasCenter && (placeMode === null || placeMode === void 0 ? void 0 : placeMode.type) === "scene" ? /* @__PURE__ */ react.default.createElement("div", { className: `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-section` }, /* @__PURE__ */ react.default.createElement("button", {
|
|
465
|
+
type: "button",
|
|
466
|
+
className: (0, classnames.default)(`${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-btn`, "primary"),
|
|
467
|
+
onClick: onRequestPlaceAtCanvasCenter
|
|
468
|
+
}, _pisell_utils.locales.getText(`${I18N_TB}.add-to-canvas`))) : null), onSave && config.canvasUi.canEdit && /* @__PURE__ */ react.default.createElement("div", { className: `pisell-floor-map-layout-toolbar-footer` }, layoutDirty ? /* @__PURE__ */ react.default.createElement("span", {
|
|
326
469
|
className: `pisell-floor-map-layout-toolbar-dirty-hint`,
|
|
327
470
|
role: "status"
|
|
328
471
|
}, _pisell_utils.locales.getText(`${I18N_TB}.layout-dirty-hint`)) : null, saveError && /* @__PURE__ */ react.default.createElement("span", { className: `pisell-floor-map-layout-toolbar-error` }, typeof saveError === "string" ? saveError : saveError === null || saveError === void 0 ? void 0 : saveError.message), /* @__PURE__ */ react.default.createElement("button", {
|
|
@@ -336,7 +479,7 @@ function FloorMapToolbar(props) {
|
|
|
336
479
|
* 必须包在 `${PREFIX}-toolbar` 根下,否则 Less 里 `.pisell-floor-map-layout-toolbar &-collapse-handle`
|
|
337
480
|
* 等选择器无法命中,展开态右侧折叠柄会失去定位与样式。
|
|
338
481
|
*/
|
|
339
|
-
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar`, className) }, /* @__PURE__ */ react.default.createElement(antd.Drawer, {
|
|
482
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar`, className) }, paletteViewAllModal, resourcePickerModal, /* @__PURE__ */ react.default.createElement(antd.Drawer, {
|
|
340
483
|
placement: "left",
|
|
341
484
|
open: !collapsed,
|
|
342
485
|
onClose: () => setCollapsed(true),
|
|
@@ -363,7 +506,7 @@ function FloorMapToolbar(props) {
|
|
|
363
506
|
"aria-label": _pisell_utils.locales.getText(`${I18N_TB}.expand`),
|
|
364
507
|
title: _pisell_utils.locales.getText(`${I18N_TB}.expand`)
|
|
365
508
|
}, /* @__PURE__ */ react.default.createElement(_ant_design_icons.RightOutlined, null)) : null);
|
|
366
|
-
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar`, `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-sidebar`, collapsed && `pisell-floor-map-layout-toolbar-sidebar--collapsed`, className) }, collapseBtn, toolbarInner);
|
|
509
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar`, `${require_floorMapLayoutConstants.FLOOR_MAP_LAYOUT_CLASS_PREFIX}-toolbar-sidebar`, collapsed && `pisell-floor-map-layout-toolbar-sidebar--collapsed`, className) }, paletteViewAllModal, resourcePickerModal, collapseBtn, toolbarInner);
|
|
367
510
|
}
|
|
368
511
|
//#endregion
|
|
369
512
|
exports.default = FloorMapToolbar;
|