@pisell/materials 1.0.1062 → 1.0.1064
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/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +22 -22
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +26 -26
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +43 -31
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +60 -16
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +8 -0
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.js +22 -12
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.less +7 -5
- package/es/components/pisellFloorMapLayout/components/MapLayer.js +5 -2
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.js +29 -10
- package/es/components/pisellFloorMapLayout/components/ViewControls.less +36 -12
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +2 -0
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +3 -1
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.js +2 -2
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +166 -43
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +1 -1
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +90 -13
- package/es/components/pisellFloorMapLayout/index.d.ts +2 -0
- package/es/components/pisellFloorMapLayout/index.js +2 -0
- package/es/components/pisellFloorMapLayout/locales.d.ts +6 -0
- package/es/components/pisellFloorMapLayout/locales.js +9 -3
- package/es/components/pisellFloorMapLayout/types.d.ts +9 -2
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +1 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +10 -1
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +11 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +86 -0
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +3 -2
- package/es/components/pisellRecordBoard/PisellRecordBoard.js +6 -3
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +21 -10
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/es/components/pisellRecordBoard/shellFrame/index.d.ts +2 -0
- package/es/components/pisellRecordBoard/shellFrame/index.js +9 -3
- package/es/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/es/components/pisellRecordBoard/types.d.ts +6 -0
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +4 -1
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +18 -1
- package/es/components/pisellReservationScheduleBand/types.d.ts +4 -0
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.js +187 -29
- package/es/components/pisellTimeNavigator/PisellTimeNavigator.less +11 -0
- package/es/components/pisellTimeNavigator/components/CursorLayer.d.ts +7 -1
- package/es/components/pisellTimeNavigator/components/CursorLayer.js +27 -7
- package/es/components/pisellTimeNavigator/components/GestureLayer.d.ts +3 -1
- package/es/components/pisellTimeNavigator/components/GestureLayer.js +14 -5
- package/es/components/pisellTimeNavigator/components/ScaleLayer.d.ts +6 -1
- package/es/components/pisellTimeNavigator/components/ScaleLayer.js +28 -6
- package/es/components/pisellTimeNavigator/types.d.ts +11 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +39 -36
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.js +56 -12
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.less +8 -0
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.js +19 -10
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.less +7 -5
- package/lib/components/pisellFloorMapLayout/components/MapLayer.js +3 -1
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.js +28 -6
- package/lib/components/pisellFloorMapLayout/components/ViewControls.less +36 -12
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +2 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.js +3 -1
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.js +143 -29
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +1 -1
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.js +86 -13
- package/lib/components/pisellFloorMapLayout/index.d.ts +2 -0
- package/lib/components/pisellFloorMapLayout/index.js +6 -0
- package/lib/components/pisellFloorMapLayout/locales.d.ts +6 -0
- package/lib/components/pisellFloorMapLayout/locales.js +9 -3
- package/lib/components/pisellFloorMapLayout/types.d.ts +9 -2
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.d.ts +1 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapDropUtils.js +7 -1
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +11 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.js +69 -0
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.js +2 -1
- package/lib/components/pisellRecordBoard/PisellRecordBoard.js +5 -1
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +1 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +13 -5
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +23 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.d.ts +2 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.js +11 -4
- package/lib/components/pisellRecordBoard/shellFrame/shellFrameFloorMap.less +25 -0
- package/lib/components/pisellRecordBoard/types.d.ts +6 -0
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.js +2 -1
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +18 -1
- package/lib/components/pisellReservationScheduleBand/types.d.ts +4 -0
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.js +176 -8
- package/lib/components/pisellTimeNavigator/PisellTimeNavigator.less +11 -0
- package/lib/components/pisellTimeNavigator/components/CursorLayer.d.ts +7 -1
- package/lib/components/pisellTimeNavigator/components/CursorLayer.js +24 -3
- package/lib/components/pisellTimeNavigator/components/GestureLayer.d.ts +3 -1
- package/lib/components/pisellTimeNavigator/components/GestureLayer.js +16 -5
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.d.ts +6 -1
- package/lib/components/pisellTimeNavigator/components/ScaleLayer.js +24 -3
- package/lib/components/pisellTimeNavigator/types.d.ts +11 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +8 -0
- package/lowcode/floor-map-image-element/meta.ts +113 -0
- package/lowcode/floor-map-layout-provider/meta.ts +1 -1
- package/lowcode/pisell-floor-map-layout/meta.ts +37 -1
- package/lowcode/render-figma-style-round-table-card/meta.ts +1 -1
- package/lowcode/render-figma-style-table-card/meta.ts +1 -1
- package/package.json +3 -3
|
@@ -22,6 +22,8 @@ export function ViewControlsWithZoom(props) {
|
|
|
22
22
|
api: api,
|
|
23
23
|
config: props.config,
|
|
24
24
|
scale: props.scale,
|
|
25
|
-
isFullscreen: props.isFullscreen
|
|
25
|
+
isFullscreen: props.isFullscreen,
|
|
26
|
+
mapGridVisible: props.mapGridVisible,
|
|
27
|
+
onToggleMapGrid: props.onToggleMapGrid
|
|
26
28
|
});
|
|
27
29
|
}
|
|
@@ -4,8 +4,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
/**
|
|
8
|
-
* 将 `FloorMapLayoutContext` 与 Layout props 合并:各字段 props ?? ctx,props 显式值优先。
|
|
7
|
+
/**
|
|
8
|
+
* 将 `FloorMapLayoutContext` 与 Layout props 合并:各字段 props ?? ctx,props 显式值优先。
|
|
9
9
|
*/
|
|
10
10
|
export function mergeFloorMapLayoutPropsFromContext(props, ctx) {
|
|
11
11
|
var _props$floorMapConfig, _props$dataSources, _props$onSave, _props$onDataSourceRe, _props$dataSourceLabe, _props$dataSourceForm, _props$dataSourceReco, _props$loading, _props$saveError, _props$onElementRende, _props$toolbarShowSav, _props$floorMapFullsc, _props$showDataSource;
|
|
@@ -2,15 +2,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
var _excluded = ["x", "y", "zIndex", "width", "height"];
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
13
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
15
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
16
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -28,14 +28,39 @@ import { createTranslationText } from "../../translation/utils";
|
|
|
28
28
|
import { mergeCanvasItems } from "../utils/floorMapConfigMerge";
|
|
29
29
|
import { STAGE_DECO_DEFAULT } from "../utils/floorMapStageDefaults";
|
|
30
30
|
import { floorMapViewConfigsEqual, normalizeFloorMapViewConfigFromProp } from "../utils/floorMapViewConfigDiff";
|
|
31
|
-
import { getElementKindConfig, resolveDataBindingPolicy } from "../utils/floorMapElementKindUtils";
|
|
31
|
+
import { getElementKindConfig, resolveDataBindingPolicy, isFloorMapImageElementKind } from "../utils/floorMapElementKindUtils";
|
|
32
32
|
import { DEFAULT_CELL_SIZE } from "../utils/layoutMeasurements";
|
|
33
33
|
import { initFloorMapLayoutLocales } from "../utils/floorMapCanvasDisplay";
|
|
34
|
-
import {
|
|
34
|
+
import { FLOOR_MAP_STAGE_ELEMENT_KIND } from "../types";
|
|
35
35
|
var IMAGE_PLACE_DEFAULT = {
|
|
36
36
|
width: 400,
|
|
37
37
|
height: 240
|
|
38
38
|
};
|
|
39
|
+
var GRID_VIS_STORAGE_PREFIX = 'pisell-floor-map-layout.grid-visible';
|
|
40
|
+
function getGridVisStorageKey(canvasId) {
|
|
41
|
+
return "".concat(GRID_VIS_STORAGE_PREFIX, ":").concat(canvasId);
|
|
42
|
+
}
|
|
43
|
+
function readStoredGridVisible(canvasId) {
|
|
44
|
+
try {
|
|
45
|
+
var raw = localStorage.getItem(getGridVisStorageKey(canvasId));
|
|
46
|
+
if (raw == null) return null;
|
|
47
|
+
if (raw === '1') return true;
|
|
48
|
+
if (raw === '0') return false;
|
|
49
|
+
return null;
|
|
50
|
+
} catch (_unused) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function writeStoredGridVisible(canvasId, visible) {
|
|
55
|
+
try {
|
|
56
|
+
localStorage.setItem(getGridVisStorageKey(canvasId), visible ? '1' : '0');
|
|
57
|
+
} catch (_unused2) {
|
|
58
|
+
// ignore localStorage failure (private mode / quota / sandbox)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 批量落位时每条相对上一条的偏移(内容坐标) */
|
|
63
|
+
var BATCH_PLACE_OFFSET = 16;
|
|
39
64
|
function newInstanceId() {
|
|
40
65
|
return "elm_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 9));
|
|
41
66
|
}
|
|
@@ -86,13 +111,36 @@ export function useFloorMapEditState(params) {
|
|
|
86
111
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
87
112
|
savingRecord = _useState12[0],
|
|
88
113
|
setSavingRecord = _useState12[1];
|
|
114
|
+
/**
|
|
115
|
+
* 本地“已提交保存”的基线快照:
|
|
116
|
+
* - 点击「完成编辑/保存」后立即置为当前 draft,避免等待上游 props 回写期间仍显示“未持久化”提示;
|
|
117
|
+
* - 用户后续再改动 draft 时,dirty 会再次为 true。
|
|
118
|
+
*/
|
|
119
|
+
var _useState13 = useState(null),
|
|
120
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
121
|
+
savedBaselineConfig = _useState14[0],
|
|
122
|
+
setSavedBaselineConfig = _useState14[1];
|
|
89
123
|
var config = isFloorMapView ? draftConfig !== null && draftConfig !== void 0 ? draftConfig : floorMapConfigProp : null;
|
|
90
124
|
var configRef = useRef(config);
|
|
91
125
|
configRef.current = config;
|
|
92
126
|
useEffect(function () {
|
|
93
127
|
if (!floorMapConfigProp) return;
|
|
94
|
-
var
|
|
128
|
+
var baseConfig = normalizeFloorMapViewConfigFromProp(floorMapConfigProp);
|
|
129
|
+
var nextConfig = _objectSpread(_objectSpread({}, baseConfig), {}, {
|
|
130
|
+
canvases: baseConfig.canvases.map(function (canvas) {
|
|
131
|
+
var _canvas$mapLayer;
|
|
132
|
+
var stored = readStoredGridVisible(canvas.id);
|
|
133
|
+
if (stored == null) return canvas;
|
|
134
|
+
return _objectSpread(_objectSpread({}, canvas), {}, {
|
|
135
|
+
mapLayer: _objectSpread(_objectSpread({}, (_canvas$mapLayer = canvas.mapLayer) !== null && _canvas$mapLayer !== void 0 ? _canvas$mapLayer : {}), {}, {
|
|
136
|
+
showGrid: stored
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
})
|
|
140
|
+
});
|
|
95
141
|
setDraftConfig(nextConfig);
|
|
142
|
+
/** 上游配置已刷新,以服务端/父级为准,清空本地临时保存基线 */
|
|
143
|
+
setSavedBaselineConfig(null);
|
|
96
144
|
var enabled = nextConfig.canvases.filter(function (c) {
|
|
97
145
|
return c.enabled;
|
|
98
146
|
}).sort(function (a, b) {
|
|
@@ -109,9 +157,9 @@ export function useFloorMapEditState(params) {
|
|
|
109
157
|
/** 当前草稿与上游持久化 `floorMapConfig`(经同等规范化)是否不一致 */
|
|
110
158
|
var isLayoutDirty = useMemo(function () {
|
|
111
159
|
if (!isFloorMapView || !draftConfig || !floorMapConfigProp) return false;
|
|
112
|
-
var baseline = normalizeFloorMapViewConfigFromProp(floorMapConfigProp);
|
|
160
|
+
var baseline = savedBaselineConfig !== null && savedBaselineConfig !== void 0 ? savedBaselineConfig : normalizeFloorMapViewConfigFromProp(floorMapConfigProp);
|
|
113
161
|
return !floorMapViewConfigsEqual(draftConfig, baseline);
|
|
114
|
-
}, [isFloorMapView, draftConfig, floorMapConfigProp]);
|
|
162
|
+
}, [isFloorMapView, draftConfig, floorMapConfigProp, savedBaselineConfig]);
|
|
115
163
|
var handleAddCanvas = useCallback(function () {
|
|
116
164
|
initFloorMapLayoutLocales(engineLocale);
|
|
117
165
|
var label = locales.getText('pisell-floor-map-layout.canvas-tabs.default-new-canvas-name');
|
|
@@ -242,7 +290,7 @@ export function useFloorMapEditState(params) {
|
|
|
242
290
|
var placeOverlayClass = "".concat(layoutPrefix, "-place-overlay");
|
|
243
291
|
|
|
244
292
|
/**
|
|
245
|
-
*
|
|
293
|
+
* 在内容坐标系下按「新建图元」模式落 sceneElement(支持 recordIds 批量;点击与拖拽共用)
|
|
246
294
|
* @returns 是否已成功写入草稿(校验失败时为 false)
|
|
247
295
|
*/
|
|
248
296
|
var applyScenePlacementAtCoords = useCallback(function (contentX, contentY, scene) {
|
|
@@ -258,6 +306,29 @@ export function useFloorMapEditState(params) {
|
|
|
258
306
|
return allKeys.includes(k);
|
|
259
307
|
}) : allKeys;
|
|
260
308
|
var pickKey = (_ref = (_scene$dataSourceKey = scene.dataSourceKey) !== null && _scene$dataSourceKey !== void 0 ? _scene$dataSourceKey : allowedKeys[0]) !== null && _ref !== void 0 ? _ref : allKeys[0];
|
|
309
|
+
var recordIdsToPlace = scene.recordIds && scene.recordIds.length > 0 ? scene.recordIds : scene.recordId ? [scene.recordId] : [];
|
|
310
|
+
var isStage = scene.elementKind === FLOOR_MAP_STAGE_ELEMENT_KIND;
|
|
311
|
+
var isImage = isFloorMapImageElementKind(scene.elementKind);
|
|
312
|
+
var w = isImage ? IMAGE_PLACE_DEFAULT.width : isStage ? STAGE_DECO_DEFAULT.width : defaultPlacementWidth;
|
|
313
|
+
var h = isImage ? IMAGE_PLACE_DEFAULT.height : isStage ? STAGE_DECO_DEFAULT.height : defaultPlacementHeight;
|
|
314
|
+
var useDecoSize = policy === 'none' && scene.elementKind !== FLOOR_MAP_STAGE_ELEMENT_KIND && !isImage;
|
|
315
|
+
var buildOneElement = function buildOneElement(dataBinding, x, y, name) {
|
|
316
|
+
return _objectSpread({
|
|
317
|
+
instanceId: newInstanceId(),
|
|
318
|
+
canvasId: currentCanvasId,
|
|
319
|
+
x: x,
|
|
320
|
+
y: y,
|
|
321
|
+
name: name,
|
|
322
|
+
zIndex: isImage ? -5 : 0,
|
|
323
|
+
width: useDecoSize ? defaultDecoSize : w,
|
|
324
|
+
height: useDecoSize ? defaultDecoSize : h,
|
|
325
|
+
elementKind: scene.elementKind,
|
|
326
|
+
shape: isStage || isImage ? 'rect' : kindConfig === null || kindConfig === void 0 ? void 0 : kindConfig.defaultShape,
|
|
327
|
+
dataBinding: dataBinding
|
|
328
|
+
}, isImage ? {
|
|
329
|
+
imageUrl: ''
|
|
330
|
+
} : {});
|
|
331
|
+
};
|
|
261
332
|
var dataBinding;
|
|
262
333
|
if (policy !== 'none' && pickKey) {
|
|
263
334
|
var _dataSources$pickKey;
|
|
@@ -267,14 +338,15 @@ export function useFloorMapEditState(params) {
|
|
|
267
338
|
dataSourceKey: pickKey,
|
|
268
339
|
recordId: "new_".concat(Date.now())
|
|
269
340
|
};
|
|
270
|
-
} else if (
|
|
341
|
+
} else if (recordIdsToPlace.length === 0) {
|
|
271
342
|
if (policy === 'required') {
|
|
272
343
|
message.warning('请先在侧栏选择数据源与数据行,再落位');
|
|
273
344
|
return false;
|
|
274
345
|
}
|
|
275
|
-
} else {
|
|
346
|
+
} else if (recordIdsToPlace.length === 1) {
|
|
347
|
+
var rid = recordIdsToPlace[0];
|
|
276
348
|
var record = dsList.find(function (r) {
|
|
277
|
-
return r.id ===
|
|
349
|
+
return r.id === rid;
|
|
278
350
|
});
|
|
279
351
|
if (!record) {
|
|
280
352
|
message.error('所选记录不存在,请重新选择数据行');
|
|
@@ -282,52 +354,80 @@ export function useFloorMapEditState(params) {
|
|
|
282
354
|
}
|
|
283
355
|
var cand = {
|
|
284
356
|
dataSourceKey: pickKey,
|
|
285
|
-
recordId:
|
|
357
|
+
recordId: rid
|
|
286
358
|
};
|
|
287
359
|
if (duplicateBinding(config.sceneElements, cand)) {
|
|
288
360
|
message.warning('该数据记录已在平面图中绑定,请勿重复添加');
|
|
289
361
|
return false;
|
|
290
362
|
}
|
|
291
363
|
dataBinding = cand;
|
|
364
|
+
} else {
|
|
365
|
+
var newEls = [];
|
|
366
|
+
var skippedDup = 0;
|
|
367
|
+
var skippedMissing = 0;
|
|
368
|
+
var placeIndex = 0;
|
|
369
|
+
var seenInBatch = new Set();
|
|
370
|
+
recordIdsToPlace.forEach(function (rid) {
|
|
371
|
+
var _row$name;
|
|
372
|
+
var record = dsList.find(function (r) {
|
|
373
|
+
return r.id === rid;
|
|
374
|
+
});
|
|
375
|
+
if (!record) {
|
|
376
|
+
skippedMissing += 1;
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
var cand = {
|
|
380
|
+
dataSourceKey: pickKey,
|
|
381
|
+
recordId: rid
|
|
382
|
+
};
|
|
383
|
+
if (seenInBatch.has(rid) || duplicateBinding(config.sceneElements, cand)) {
|
|
384
|
+
skippedDup += 1;
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
seenInBatch.add(rid);
|
|
388
|
+
var row = record;
|
|
389
|
+
var placementName = String((_row$name = row === null || row === void 0 ? void 0 : row.name) !== null && _row$name !== void 0 ? _row$name : rid);
|
|
390
|
+
newEls.push(buildOneElement(cand, contentX + placeIndex * BATCH_PLACE_OFFSET, contentY + placeIndex * BATCH_PLACE_OFFSET, placementName));
|
|
391
|
+
placeIndex += 1;
|
|
392
|
+
});
|
|
393
|
+
if (skippedDup > 0) {
|
|
394
|
+
message.warning("\u5DF2\u8DF3\u8FC7 ".concat(skippedDup, " \u6761\u5DF2\u5728\u5E73\u9762\u56FE\u4E2D\u7ED1\u5B9A\u7684\u8BB0\u5F55"));
|
|
395
|
+
}
|
|
396
|
+
if (skippedMissing > 0) {
|
|
397
|
+
message.warning("\u6709 ".concat(skippedMissing, " \u6761\u8BB0\u5F55\u4E0D\u5B58\u5728\uFF0C\u5DF2\u8DF3\u8FC7"));
|
|
398
|
+
}
|
|
399
|
+
if (newEls.length === 0) {
|
|
400
|
+
message.warning('没有可落位的记录');
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
setDraftConfig(function (prev) {
|
|
404
|
+
var _prev$sceneElements4;
|
|
405
|
+
return prev ? _objectSpread(_objectSpread({}, prev), {}, {
|
|
406
|
+
sceneElements: [].concat(_toConsumableArray((_prev$sceneElements4 = prev.sceneElements) !== null && _prev$sceneElements4 !== void 0 ? _prev$sceneElements4 : []), newEls)
|
|
407
|
+
}) : prev;
|
|
408
|
+
});
|
|
409
|
+
return true;
|
|
292
410
|
}
|
|
293
411
|
}
|
|
294
|
-
var isStage = scene.elementKind === FLOOR_MAP_STAGE_ELEMENT_KIND;
|
|
295
|
-
var isImage = scene.elementKind === FLOOR_MAP_IMAGE_ELEMENT_KIND;
|
|
296
|
-
var w = isImage ? IMAGE_PLACE_DEFAULT.width : isStage ? STAGE_DECO_DEFAULT.width : defaultPlacementWidth;
|
|
297
|
-
var h = isImage ? IMAGE_PLACE_DEFAULT.height : isStage ? STAGE_DECO_DEFAULT.height : defaultPlacementHeight;
|
|
298
|
-
var useDecoSize = policy === 'none' && scene.elementKind !== FLOOR_MAP_STAGE_ELEMENT_KIND && !isImage;
|
|
299
412
|
var placementName = function (_kindConfig$defaultPr, _kindConfig$defaultPr2) {
|
|
300
413
|
if (isStage) return STAGE_DECO_DEFAULT.name;
|
|
301
414
|
if (isImage) return '底图';
|
|
302
415
|
var db = dataBinding;
|
|
303
|
-
|
|
304
|
-
|
|
416
|
+
var rid = recordIdsToPlace[0];
|
|
417
|
+
if (db && rid) {
|
|
418
|
+
var _dataSources$db$dataS, _row$name2;
|
|
305
419
|
var row = dataSources === null || dataSources === void 0 || (_dataSources$db$dataS = dataSources[db.dataSourceKey]) === null || _dataSources$db$dataS === void 0 ? void 0 : _dataSources$db$dataS.find(function (r) {
|
|
306
|
-
return r.id ===
|
|
420
|
+
return r.id === rid;
|
|
307
421
|
});
|
|
308
|
-
return String((_row$
|
|
422
|
+
return String((_row$name2 = row === null || row === void 0 ? void 0 : row.name) !== null && _row$name2 !== void 0 ? _row$name2 : rid);
|
|
309
423
|
}
|
|
310
424
|
return (_kindConfig$defaultPr = kindConfig === null || kindConfig === void 0 || (_kindConfig$defaultPr2 = kindConfig.defaultPresentation) === null || _kindConfig$defaultPr2 === void 0 ? void 0 : _kindConfig$defaultPr2.title) !== null && _kindConfig$defaultPr !== void 0 ? _kindConfig$defaultPr : '';
|
|
311
425
|
}();
|
|
312
|
-
var newEl =
|
|
313
|
-
instanceId: newInstanceId(),
|
|
314
|
-
canvasId: currentCanvasId,
|
|
315
|
-
x: contentX,
|
|
316
|
-
y: contentY,
|
|
317
|
-
name: placementName,
|
|
318
|
-
zIndex: isImage ? -5 : 0,
|
|
319
|
-
width: useDecoSize ? defaultDecoSize : w,
|
|
320
|
-
height: useDecoSize ? defaultDecoSize : h,
|
|
321
|
-
elementKind: scene.elementKind,
|
|
322
|
-
shape: isStage || isImage ? 'rect' : kindConfig === null || kindConfig === void 0 ? void 0 : kindConfig.defaultShape,
|
|
323
|
-
dataBinding: dataBinding
|
|
324
|
-
}, isImage ? {
|
|
325
|
-
imageUrl: ''
|
|
326
|
-
} : {});
|
|
426
|
+
var newEl = buildOneElement(dataBinding, contentX, contentY, placementName);
|
|
327
427
|
setDraftConfig(function (prev) {
|
|
328
|
-
var _prev$
|
|
428
|
+
var _prev$sceneElements5;
|
|
329
429
|
return prev ? _objectSpread(_objectSpread({}, prev), {}, {
|
|
330
|
-
sceneElements: [].concat(_toConsumableArray((_prev$
|
|
430
|
+
sceneElements: [].concat(_toConsumableArray((_prev$sceneElements5 = prev.sceneElements) !== null && _prev$sceneElements5 !== void 0 ? _prev$sceneElements5 : []), [newEl])
|
|
331
431
|
}) : prev;
|
|
332
432
|
});
|
|
333
433
|
return true;
|
|
@@ -357,10 +457,32 @@ export function useFloorMapEditState(params) {
|
|
|
357
457
|
setSaving(true);
|
|
358
458
|
try {
|
|
359
459
|
onSave(draftConfig);
|
|
460
|
+
/** 先本地确认“已提交保存”,让提示即时消失;后续以 props 回写为准 */
|
|
461
|
+
setSavedBaselineConfig(draftConfig);
|
|
360
462
|
} finally {
|
|
361
463
|
setSaving(false);
|
|
362
464
|
}
|
|
363
465
|
}, [draftConfig, onSave]);
|
|
466
|
+
|
|
467
|
+
/** 切换当前画布草稿中的 mapLayer.showGrid(随布局保存持久化) */
|
|
468
|
+
var toggleDraftCanvasShowGrid = useCallback(function () {
|
|
469
|
+
setDraftConfig(function (prev) {
|
|
470
|
+
if (!prev || !currentCanvasId) return prev;
|
|
471
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
472
|
+
canvases: prev.canvases.map(function (c) {
|
|
473
|
+
var _c$mapLayer;
|
|
474
|
+
if (c.id !== currentCanvasId) return c;
|
|
475
|
+
var nextShow = !Boolean((_c$mapLayer = c.mapLayer) === null || _c$mapLayer === void 0 ? void 0 : _c$mapLayer.showGrid);
|
|
476
|
+
writeStoredGridVisible(currentCanvasId, nextShow);
|
|
477
|
+
return _objectSpread(_objectSpread({}, c), {}, {
|
|
478
|
+
mapLayer: _objectSpread(_objectSpread({}, c.mapLayer), {}, {
|
|
479
|
+
showGrid: nextShow
|
|
480
|
+
})
|
|
481
|
+
});
|
|
482
|
+
})
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
}, [currentCanvasId]);
|
|
364
486
|
var handleEditPanelUpdate = useCallback(function (patch) {
|
|
365
487
|
if (!selectedId) return;
|
|
366
488
|
var bindingPatch = patch.dataBinding;
|
|
@@ -384,10 +506,10 @@ export function useFloorMapEditState(params) {
|
|
|
384
506
|
var handleEditPanelDelete = useCallback(function () {
|
|
385
507
|
if (!selectedId) return;
|
|
386
508
|
setDraftConfig(function (prev) {
|
|
387
|
-
var _prev$
|
|
509
|
+
var _prev$sceneElements6;
|
|
388
510
|
if (!prev) return prev;
|
|
389
511
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
390
|
-
sceneElements: ((_prev$
|
|
512
|
+
sceneElements: ((_prev$sceneElements6 = prev.sceneElements) !== null && _prev$sceneElements6 !== void 0 ? _prev$sceneElements6 : []).filter(function (e) {
|
|
391
513
|
return e.instanceId !== selectedId;
|
|
392
514
|
})
|
|
393
515
|
});
|
|
@@ -433,6 +555,7 @@ export function useFloorMapEditState(params) {
|
|
|
433
555
|
placeSceneElementFromPaletteDrop: placeSceneElementFromPaletteDrop,
|
|
434
556
|
editPanelParams: editPanelParams,
|
|
435
557
|
placeOverlayClass: placeOverlayClass,
|
|
436
|
-
isLayoutDirty: isLayoutDirty
|
|
558
|
+
isLayoutDirty: isLayoutDirty,
|
|
559
|
+
toggleDraftCanvasShowGrid: toggleDraftCanvasShowGrid
|
|
437
560
|
};
|
|
438
561
|
}
|
|
@@ -56,7 +56,7 @@ export declare function useFloorMapTransformMetrics<T extends FloorMapItemBase>(
|
|
|
56
56
|
setScale: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
57
57
|
isFullscreen: boolean;
|
|
58
58
|
toggleFullscreen: () => void;
|
|
59
|
-
fitBounds: () =>
|
|
59
|
+
fitBounds: () => boolean;
|
|
60
60
|
lastTransformRef: MutableRefObject<{
|
|
61
61
|
x: number;
|
|
62
62
|
y: number;
|
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
/**
|
|
14
14
|
* 视口 / 地图区尺寸、内容区宽高与偏移、缩放与全屏、fitBounds、拖拽图元后恢复 transform
|
|
15
15
|
*/
|
|
16
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import { getContentSize, getPixelBoundingBox } from "../utils/layoutMeasurements";
|
|
18
18
|
|
|
19
19
|
/** 平面图包围盒单侧默认外扩(像素);过大会导致首屏大量空白 */
|
|
@@ -89,7 +89,9 @@ export function useFloorMapTransformMetrics(params) {
|
|
|
89
89
|
return ro.disconnect();
|
|
90
90
|
};
|
|
91
91
|
}, []);
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
/** 默认开启:有空图元时首屏 fit 全图;仅 `autoFitOnMount: false` 关闭 */
|
|
94
|
+
var autoFitOnMount = zoom.autoFitOnMount !== false;
|
|
93
95
|
var zoomConfig = useMemo(function () {
|
|
94
96
|
var _zoom$defaultScale, _zoom$min, _zoom$max, _zoom$step;
|
|
95
97
|
return {
|
|
@@ -222,27 +224,66 @@ export function useFloorMapTransformMetrics(params) {
|
|
|
222
224
|
(_el$requestFullscreen = el.requestFullscreen) === null || _el$requestFullscreen === void 0 || _el$requestFullscreen.call(el);
|
|
223
225
|
}
|
|
224
226
|
}, []);
|
|
227
|
+
|
|
228
|
+
/** @returns 是否已调用 setTransform(用于首屏 autoFit:避免空跑仍标记 done) */
|
|
225
229
|
var fitBounds = useCallback(function () {
|
|
226
|
-
var _zoom$
|
|
230
|
+
var _zoom$max3;
|
|
227
231
|
var ctx = transformRef.current;
|
|
228
232
|
var container = containerRef.current;
|
|
229
|
-
if (!ctx || !container) return;
|
|
233
|
+
if (!ctx || !container) return false;
|
|
230
234
|
var wrapper = container.querySelector('.react-transform-wrapper');
|
|
231
|
-
if (!wrapper) return;
|
|
235
|
+
if (!wrapper) return false;
|
|
232
236
|
var wrapperRect = wrapper.getBoundingClientRect();
|
|
233
|
-
|
|
237
|
+
if (wrapperRect.width <= 0 || wrapperRect.height <= 0) return false;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* 平面图像素模式:按「图元轴对齐包围盒」缩放并居中,不按整块 content(含编辑态撑满视口的空白)适配。
|
|
241
|
+
* 画布 DOM 尺寸与网格空白不变,仅改变视口 transform;视口边可贴边(edgePx=0)。
|
|
242
|
+
*/
|
|
243
|
+
var pixelBox = isFloorMapView && effectiveItemUnit === 'pixel' && items.length > 0 ? getPixelBoundingBox(items, cellSize) : null;
|
|
244
|
+
if (pixelBox) {
|
|
245
|
+
var _zoom$max2;
|
|
246
|
+
var bw = Math.max(1, pixelBox.maxRight - pixelBox.minLeft);
|
|
247
|
+
var bh = Math.max(1, pixelBox.maxBottom - pixelBox.minTop);
|
|
248
|
+
var edgePx = 0;
|
|
249
|
+
var availW = Math.max(1, wrapperRect.width - 2 * edgePx);
|
|
250
|
+
var availH = Math.max(1, wrapperRect.height - 2 * edgePx);
|
|
251
|
+
var _raw = Math.min(availW / bw, availH / bh);
|
|
252
|
+
var _nextScale = Math.min(_raw, (_zoom$max2 = zoom.max) !== null && _zoom$max2 !== void 0 ? _zoom$max2 : 2);
|
|
253
|
+
var ap = alignPadSingle !== null && alignPadSingle !== void 0 ? alignPadSingle : padSingle;
|
|
254
|
+
var bboxCx = ap + bw / 2;
|
|
255
|
+
var bboxCy = ap + bh / 2;
|
|
256
|
+
var _x = wrapperRect.width / 2 - bboxCx * _nextScale;
|
|
257
|
+
var _y = wrapperRect.height / 2 - bboxCy * _nextScale;
|
|
258
|
+
ctx.setTransform(_x, _y, _nextScale);
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
if (contentWidth <= 0 || contentHeight <= 0) return false;
|
|
262
|
+
/** 非平面图或无图元:仍按整块 content 适配 */
|
|
263
|
+
var raw = Math.min(wrapperRect.width / contentWidth, wrapperRect.height / contentHeight);
|
|
264
|
+
var nextScale = Math.min(raw, (_zoom$max3 = zoom.max) !== null && _zoom$max3 !== void 0 ? _zoom$max3 : 2);
|
|
234
265
|
var padA = alignPadSingle !== null && alignPadSingle !== void 0 ? alignPadSingle : 0;
|
|
235
266
|
var x = VIEWPORT_TOP_LEFT_MARGIN - padA * nextScale;
|
|
236
267
|
var y = VIEWPORT_TOP_LEFT_MARGIN - padA * nextScale;
|
|
237
268
|
ctx.setTransform(x, y, nextScale);
|
|
238
|
-
|
|
269
|
+
return true;
|
|
270
|
+
}, [contentWidth, contentHeight, zoom.max, transformRef, alignPadSingle, isFloorMapView, effectiveItemUnit, items, cellSize, padSingle]);
|
|
239
271
|
|
|
240
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* autoFitOnMount:每个画布在「有图元且 content 尺寸已按包围盒算好」后执行一次 fitBounds。
|
|
274
|
+
* 避免首帧 items 仍为空时用占位尺寸 fit 完并标记 done,导致异步图元加载后不再适配。
|
|
275
|
+
*/
|
|
241
276
|
var autoFitOnceRef = useRef({
|
|
242
277
|
frame: '',
|
|
243
278
|
done: false
|
|
244
279
|
});
|
|
245
|
-
|
|
280
|
+
var prevItemsCountForAutoFitRef = useRef(null);
|
|
281
|
+
/**
|
|
282
|
+
* 首屏 auto fit:时序上易出现「Transform 未挂载 / wrapper 尺寸为 0 / 内容区尚未提交」,
|
|
283
|
+
* 用 layoutEffect + 双 rAF 贴近浏览器布局完成时刻;仅 fitBounds 真正 setTransform 后才记 done;
|
|
284
|
+
* viewportSize 纳入依赖以便父级 flex 迟到的尺寸更新后重试(超次不伪造 done)。
|
|
285
|
+
*/
|
|
286
|
+
useLayoutEffect(function () {
|
|
246
287
|
if (!isFloorMapView || !autoFitOnMount || frameResetKey === undefined) return;
|
|
247
288
|
var frame = String(frameResetKey);
|
|
248
289
|
if (autoFitOnceRef.current.frame !== frame) {
|
|
@@ -250,28 +291,64 @@ export function useFloorMapTransformMetrics(params) {
|
|
|
250
291
|
frame: frame,
|
|
251
292
|
done: false
|
|
252
293
|
};
|
|
294
|
+
prevItemsCountForAutoFitRef.current = null;
|
|
295
|
+
}
|
|
296
|
+
var itemCount = items.length;
|
|
297
|
+
var prevN = prevItemsCountForAutoFitRef.current;
|
|
298
|
+
if (prevN !== null && prevN === 0 && itemCount > 0) {
|
|
299
|
+
autoFitOnceRef.current.done = false;
|
|
253
300
|
}
|
|
301
|
+
prevItemsCountForAutoFitRef.current = itemCount;
|
|
254
302
|
if (autoFitOnceRef.current.done) return;
|
|
303
|
+
if (effectiveItemUnit === 'pixel' && itemCount === 0) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
255
306
|
if (contentWidth <= 0 || contentHeight <= 0) return;
|
|
256
307
|
var cancelled = false;
|
|
257
308
|
var raf = 0;
|
|
309
|
+
var attempts = 0;
|
|
310
|
+
var MAX_AUTO_FIT_ATTEMPTS = 160;
|
|
258
311
|
var tick = function tick() {
|
|
259
312
|
if (cancelled) return;
|
|
313
|
+
if (attempts >= MAX_AUTO_FIT_ATTEMPTS) return;
|
|
260
314
|
var ctx = transformRef.current;
|
|
261
315
|
var container = containerRef.current;
|
|
262
|
-
|
|
316
|
+
var wrapper = container === null || container === void 0 ? void 0 : container.querySelector('.react-transform-wrapper');
|
|
317
|
+
if (!ctx || !wrapper) {
|
|
318
|
+
attempts += 1;
|
|
319
|
+
raf = requestAnimationFrame(tick);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
var rect = wrapper.getBoundingClientRect();
|
|
323
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
324
|
+
attempts += 1;
|
|
263
325
|
raf = requestAnimationFrame(tick);
|
|
264
326
|
return;
|
|
265
327
|
}
|
|
266
|
-
|
|
267
|
-
|
|
328
|
+
|
|
329
|
+
/** 再等两帧:react-zoom-pan-pinch 与 TransformComponent 常在本帧之后才把可测布局写稳 */
|
|
330
|
+
raf = requestAnimationFrame(function () {
|
|
331
|
+
if (cancelled) return;
|
|
332
|
+
raf = requestAnimationFrame(function () {
|
|
333
|
+
if (cancelled) return;
|
|
334
|
+
var ok = fitBounds();
|
|
335
|
+
if (ok) {
|
|
336
|
+
autoFitOnceRef.current.done = true;
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
attempts += 1;
|
|
340
|
+
if (attempts < MAX_AUTO_FIT_ATTEMPTS) {
|
|
341
|
+
raf = requestAnimationFrame(tick);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
});
|
|
268
345
|
};
|
|
269
346
|
raf = requestAnimationFrame(tick);
|
|
270
347
|
return function () {
|
|
271
348
|
cancelled = true;
|
|
272
349
|
cancelAnimationFrame(raf);
|
|
273
350
|
};
|
|
274
|
-
}, [isFloorMapView, autoFitOnMount, frameResetKey, contentWidth, contentHeight, fitBounds, transformRef]);
|
|
351
|
+
}, [isFloorMapView, autoFitOnMount, frameResetKey, effectiveItemUnit, items.length, contentWidth, contentHeight, viewportSize.width, viewportSize.height, mapAreaSize.width, mapAreaSize.height, fitBounds, transformRef]);
|
|
275
352
|
var lastTransformRef = useRef({
|
|
276
353
|
x: 0,
|
|
277
354
|
y: 0,
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export { PisellFloorMapLayout } from './PisellFloorMapLayout';
|
|
6
6
|
export type { PisellFloorMapLayoutProps, PisellFloorMapLayoutRef, FloorMapItemBase, FloorMapItemUnit, FloorMapLayerConfig, FloorMapZoomConfig, FloorMapPanConfig, FloorMapControlsConfig, FloorMapItemShape, FloorMapBackgroundType, FloorMapPanBoundary, FloorMapLayoutMode, FloorMapGridLayoutConfig, FloorMapCanvas, FloorMapCanvasNameI18n, FloorMapElement, FloorMapData, FloorMapViewConfig, FloorMapCanvasUiConfig, FloorMapSceneElement, FloorMapSceneElementDataBinding, FloorMapPlaceMode, FloorMapElementKindCategory, FloorMapElementDataBindingPolicy, FloorMapElementDefaultPresentation, FloorMapEdge, FloorMapElementKindConfig, FloorMapElementType, FloorMapTextSlot, FloorMapDataSources, FloorMapRenderOptions, FloorMapEditPanelParams, DataSourceFormColumn, FloorMapMergedItem, FloorMapRecordFormRenderContext, FloorMapDataSourceRecordFormContent, FloorMapFullscreenMode, FloorMapLayoutContextValue, } from './types';
|
|
7
7
|
export { FLOOR_MAP_STAGE_ELEMENT_KIND, FLOOR_MAP_IMAGE_ELEMENT_KIND, } from './types';
|
|
8
|
+
export { renderFloorMapFallbackPlaceholder } from './utils/floorMapFallbackRender';
|
|
9
|
+
export { isFloorMapImageElementKind } from './utils/floorMapElementKindUtils';
|
|
8
10
|
export { FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT, } from './context/FloorMapLayoutContext';
|
|
9
11
|
export type { FloorMapLayoutProviderProps } from './context/FloorMapLayoutContext';
|
|
10
12
|
export { mergeFloorMapLayoutPropsFromContext } from './context/mergeFloorMapLayoutContext';
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { PisellFloorMapLayout } from "./PisellFloorMapLayout";
|
|
6
6
|
export { FLOOR_MAP_STAGE_ELEMENT_KIND, FLOOR_MAP_IMAGE_ELEMENT_KIND } from "./types";
|
|
7
|
+
export { renderFloorMapFallbackPlaceholder } from "./utils/floorMapFallbackRender";
|
|
8
|
+
export { isFloorMapImageElementKind } from "./utils/floorMapElementKindUtils";
|
|
7
9
|
export { FloorMapLayoutProvider, useFloorMapLayoutContext, EMPTY_FLOOR_MAP_LAYOUT_CONTEXT } from "./context/FloorMapLayoutContext";
|
|
8
10
|
export { mergeFloorMapLayoutPropsFromContext } from "./context/mergeFloorMapLayoutContext";
|
|
9
11
|
export { FloorMapImageElement } from "./components/FloorMapImageElement";
|
|
@@ -46,6 +46,8 @@ declare const _default: {
|
|
|
46
46
|
'pisell-floor-map-layout.edit-panel.extra-image-url': string;
|
|
47
47
|
'pisell-floor-map-layout.edit-panel.ph-https': string;
|
|
48
48
|
'pisell-floor-map-layout.edit-panel.label-canvas': string;
|
|
49
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': string;
|
|
50
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': string;
|
|
49
51
|
'pisell-floor-map-layout.edit-panel.apply': string;
|
|
50
52
|
'pisell-floor-map-layout.edit-panel.data-binding': string;
|
|
51
53
|
'pisell-floor-map-layout.edit-panel.data-binding-note': string;
|
|
@@ -106,6 +108,8 @@ declare const _default: {
|
|
|
106
108
|
'pisell-floor-map-layout.edit-panel.extra-image-url': string;
|
|
107
109
|
'pisell-floor-map-layout.edit-panel.ph-https': string;
|
|
108
110
|
'pisell-floor-map-layout.edit-panel.label-canvas': string;
|
|
111
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': string;
|
|
112
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': string;
|
|
109
113
|
'pisell-floor-map-layout.edit-panel.apply': string;
|
|
110
114
|
'pisell-floor-map-layout.edit-panel.data-binding': string;
|
|
111
115
|
'pisell-floor-map-layout.edit-panel.data-binding-note': string;
|
|
@@ -166,6 +170,8 @@ declare const _default: {
|
|
|
166
170
|
'pisell-floor-map-layout.edit-panel.extra-image-url': string;
|
|
167
171
|
'pisell-floor-map-layout.edit-panel.ph-https': string;
|
|
168
172
|
'pisell-floor-map-layout.edit-panel.label-canvas': string;
|
|
173
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': string;
|
|
174
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': string;
|
|
169
175
|
'pisell-floor-map-layout.edit-panel.apply': string;
|
|
170
176
|
'pisell-floor-map-layout.edit-panel.data-binding': string;
|
|
171
177
|
'pisell-floor-map-layout.edit-panel.data-binding-note': string;
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
'pisell-floor-map-layout.edit-panel.element-props': 'Element',
|
|
30
30
|
'pisell-floor-map-layout.edit-panel.close-aria': 'Close',
|
|
31
31
|
'pisell-floor-map-layout.edit-panel.hint-apply': 'Position or size changed — click Apply to update the canvas.',
|
|
32
|
-
'pisell-floor-map-layout.edit-panel.hint-save': 'Layout draft is not saved — click
|
|
32
|
+
'pisell-floor-map-layout.edit-panel.hint-save': 'Layout draft is not saved — click Done editing to save.',
|
|
33
33
|
'pisell-floor-map-layout.edit-panel.section-layout': 'Position · Layer · Size',
|
|
34
34
|
'pisell-floor-map-layout.edit-panel.lock-on': 'Locked: drag/resize disabled on canvas; click to unlock',
|
|
35
35
|
'pisell-floor-map-layout.edit-panel.lock-off': 'Lock to disable drag and resize on canvas',
|
|
@@ -46,6 +46,8 @@ export default {
|
|
|
46
46
|
'pisell-floor-map-layout.edit-panel.extra-image-url': 'Use a network image URL; lower layer to place under tables.',
|
|
47
47
|
'pisell-floor-map-layout.edit-panel.ph-https': 'https://...',
|
|
48
48
|
'pisell-floor-map-layout.edit-panel.label-canvas': 'Canvas',
|
|
49
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': 'Element type',
|
|
50
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': 'Data binding was cleared because it does not apply to the new type.',
|
|
49
51
|
'pisell-floor-map-layout.edit-panel.apply': 'Apply',
|
|
50
52
|
'pisell-floor-map-layout.edit-panel.data-binding': 'Data binding',
|
|
51
53
|
'pisell-floor-map-layout.edit-panel.data-binding-note': 'Changing data source or row writes to the layout draft; click Save at the top to persist.',
|
|
@@ -89,7 +91,7 @@ export default {
|
|
|
89
91
|
'pisell-floor-map-layout.edit-panel.element-props': '图元属性',
|
|
90
92
|
'pisell-floor-map-layout.edit-panel.close-aria': '关闭',
|
|
91
93
|
'pisell-floor-map-layout.edit-panel.hint-apply': '位置、尺寸等已修改,请点击「应用」同步到画布。',
|
|
92
|
-
'pisell-floor-map-layout.edit-panel.hint-save': '
|
|
94
|
+
'pisell-floor-map-layout.edit-panel.hint-save': '布局草稿未持久化,请点击「完成编辑」保存。',
|
|
93
95
|
'pisell-floor-map-layout.edit-panel.section-layout': '位置 · 层级 · 尺寸',
|
|
94
96
|
'pisell-floor-map-layout.edit-panel.lock-on': '已锁定:画布不可拖拽/缩放;点击解锁',
|
|
95
97
|
'pisell-floor-map-layout.edit-panel.lock-off': '锁定后画布不可拖拽与改尺寸',
|
|
@@ -106,6 +108,8 @@ export default {
|
|
|
106
108
|
'pisell-floor-map-layout.edit-panel.extra-image-url': '可填网络图片地址;将层级调低可铺在桌位下方作底图。',
|
|
107
109
|
'pisell-floor-map-layout.edit-panel.ph-https': 'https://...',
|
|
108
110
|
'pisell-floor-map-layout.edit-panel.label-canvas': '所属画布',
|
|
111
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': '图元类型',
|
|
112
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': '新类型与原先绑定不兼容,已清除数据绑定。',
|
|
109
113
|
'pisell-floor-map-layout.edit-panel.apply': '应用',
|
|
110
114
|
'pisell-floor-map-layout.edit-panel.data-binding': '数据绑定',
|
|
111
115
|
'pisell-floor-map-layout.edit-panel.data-binding-note': '修改数据源或绑定行会立即写入布局草稿;持久化请点击顶部「保存」。',
|
|
@@ -149,7 +153,7 @@ export default {
|
|
|
149
153
|
'pisell-floor-map-layout.edit-panel.element-props': '圖元屬性',
|
|
150
154
|
'pisell-floor-map-layout.edit-panel.close-aria': '關閉',
|
|
151
155
|
'pisell-floor-map-layout.edit-panel.hint-apply': '位置、尺寸等已修改,請點擊「套用」同步到畫布。',
|
|
152
|
-
'pisell-floor-map-layout.edit-panel.hint-save': '
|
|
156
|
+
'pisell-floor-map-layout.edit-panel.hint-save': '佈局草稿未持久化,請點擊「完成編輯」儲存。',
|
|
153
157
|
'pisell-floor-map-layout.edit-panel.section-layout': '位置 · 層級 · 尺寸',
|
|
154
158
|
'pisell-floor-map-layout.edit-panel.lock-on': '已鎖定:畫布不可拖曳/縮放;點擊解鎖',
|
|
155
159
|
'pisell-floor-map-layout.edit-panel.lock-off': '鎖定後畫布不可拖曳與改尺寸',
|
|
@@ -166,6 +170,8 @@ export default {
|
|
|
166
170
|
'pisell-floor-map-layout.edit-panel.extra-image-url': '可填網絡圖片地址;將層級調低可鋪在桌位下方作底圖。',
|
|
167
171
|
'pisell-floor-map-layout.edit-panel.ph-https': 'https://...',
|
|
168
172
|
'pisell-floor-map-layout.edit-panel.label-canvas': '所屬畫布',
|
|
173
|
+
'pisell-floor-map-layout.edit-panel.label-element-kind': '圖元類型',
|
|
174
|
+
'pisell-floor-map-layout.edit-panel.hint-kind-binding-cleared': '新類型與原先綁定不相容,已清除數據綁定。',
|
|
169
175
|
'pisell-floor-map-layout.edit-panel.apply': '套用',
|
|
170
176
|
'pisell-floor-map-layout.edit-panel.data-binding': '數據綁定',
|
|
171
177
|
'pisell-floor-map-layout.edit-panel.data-binding-note': '修改數據源或綁定行會立即寫入佈局草稿;持久化請點擊頂部「儲存」。',
|