@pisell/materials 1.8.54 → 1.8.56

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