|
|
@@ -250,6 +250,12 @@ export default {
|
|
|
}
|
|
|
return arr;
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算列的样式
|
|
|
+ * @param {Object} col 列对象
|
|
|
+ * @returns {Object} 列的样式对象
|
|
|
+ */
|
|
|
computedColStyle(col) {
|
|
|
const grid = col.grid_list;
|
|
|
|
|
|
@@ -318,14 +324,52 @@ export default {
|
|
|
if (!gridMap.has(item.row)) {
|
|
|
gridMap.set(item.row, []);
|
|
|
}
|
|
|
- gridMap.get(item.row).push(item.height);
|
|
|
+ gridMap.get(item.row).push({ height: item.height, id: item.id });
|
|
|
});
|
|
|
+
|
|
|
gridMap.forEach((value) => {
|
|
|
if (value.length === 1) {
|
|
|
- gridTemplateRows += `${value[0]} `;
|
|
|
+ const component = this.$refs.preview?.find(
|
|
|
+ (child) => child.$el && child.$el.dataset && child.$el.dataset.id === value[0].id,
|
|
|
+ );
|
|
|
+
|
|
|
+ const hasOperation = component && component.$el.querySelector('.operation') !== null; // 判断是否有操作按钮
|
|
|
+ let height = hasOperation ? `${Number(value[0].height.replace('px', '')) + 48}px` : value[0].height;
|
|
|
+
|
|
|
+ gridTemplateRows += `${height} `;
|
|
|
} else {
|
|
|
- let isAllAuto = value.every((item) => item === 'auto'); // 是否全是 auto
|
|
|
- gridTemplateRows += isAllAuto ? 'auto ' : `max(${value.join(', ')}) `;
|
|
|
+ let isAllAuto = value.every((item) => item.height === 'auto'); // 是否全是 auto
|
|
|
+ if (!isAllAuto) {
|
|
|
+ // 判断 value 中height 最大的组件是那个,不包括 auto 的组件
|
|
|
+ let maxHeight = 0;
|
|
|
+ let maxId = '';
|
|
|
+ value.forEach((item) => {
|
|
|
+ if (item.height !== 'auto') {
|
|
|
+ const heightNum = Number(item.height.replace('px', ''));
|
|
|
+ if (heightNum > maxHeight) {
|
|
|
+ maxHeight = heightNum;
|
|
|
+ maxId = item.id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 判断最高组件是否有操作按钮
|
|
|
+ const component = this.$refs.preview?.find(
|
|
|
+ (child) => child.$el && child.$el.dataset && child.$el.dataset.id === maxId,
|
|
|
+ );
|
|
|
+ const hasOperation = component && component.$el.querySelector('.operation') !== null; // 判断是否有操作按钮
|
|
|
+ if (hasOperation) {
|
|
|
+ maxHeight += 48;
|
|
|
+ }
|
|
|
+ // 将 maxId 的 height 设置为 maxHeight
|
|
|
+ value.forEach((item) => {
|
|
|
+ if (item.id === maxId) {
|
|
|
+ item.height = `${maxHeight}px`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ gridTemplateRows += isAllAuto
|
|
|
+ ? 'auto '
|
|
|
+ : `${Math.max(...value.map((item) => Number(item.height.replace('px', ''))))}px `;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -347,7 +391,7 @@ export default {
|
|
|
const projectCover = this.project?.cover_image_file_url || '';
|
|
|
|
|
|
// 优先在空行时使用背景图或项目封面
|
|
|
- const backgroundImage = hasNoRows ? bcImgUrl || projectCover : '';
|
|
|
+ const backgroundImage = hasNoRows ? bcImgUrl || projectCover : bcImgUrl;
|
|
|
|
|
|
// 保护性读取位置/大小值,避免 undefined 导致字符串 "undefined%"
|
|
|
const widthPct = typeof pos.width === 'undefined' ? '' : pos.width;
|
|
|
@@ -391,7 +435,7 @@ export default {
|
|
|
this.menuPosition.select_node,
|
|
|
this.menuPosition.x,
|
|
|
this.menuPosition.y,
|
|
|
- this.componentId
|
|
|
+ this.componentId,
|
|
|
);
|
|
|
},
|
|
|
handleMouseDown(event) {
|
|
|
@@ -650,7 +694,7 @@ export default {
|
|
|
const searchStart = Math.max(0, cumulativeLength - selectedText.length * 3);
|
|
|
const searchEnd = Math.min(
|
|
|
fullText.length,
|
|
|
- cumulativeLength + closestFragment.text.length + selectedText.length * 3
|
|
|
+ cumulativeLength + closestFragment.text.length + selectedText.length * 3,
|
|
|
);
|
|
|
|
|
|
const searchArea = fullText.substring(searchStart, searchEnd);
|