publ-echo-test 0.0.345 → 0.0.347

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.
@@ -1,13 +1,13 @@
1
1
  import { LayoutItem } from "./types";
2
2
  type PlaceholderProps = {
3
3
  margin: [number, number];
4
- width: number;
5
4
  rowHeight: number;
6
5
  colWidth: number;
7
6
  backgroundWidth: string | undefined;
8
7
  backgroundHeight: string | undefined;
9
8
  activeDrag: LayoutItem;
10
9
  selectedBlockId: string | null;
10
+ totalCols: number;
11
11
  };
12
- export declare function GridBackgroundPlaceholder({ margin, width, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function GridBackgroundPlaceholder({ margin, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, totalCols, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -1,41 +1,36 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- import styled from "styled-components"; // 1. styled-components import
7
- // --- 2. Styled Components 정의 ---
8
- // 기본 그리드 패턴용 rect
9
- var GridPatternRect = styled.rect(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n fill: #f0f0f0;\n stroke: #ddd;\n stroke-width: 1px;\n"], ["\n fill: #f0f0f0;\n stroke: #ddd;\n stroke-width: 1px;\n"])));
10
- // 활성화된 셀(개별)용 rect
11
- var ActiveCellRect = styled.rect(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n fill: rgba(0, 255, 0, 0.2);\n stroke: rgba(0, 255, 8, 0.5);\n stroke-width: 1px;\n"], ["\n fill: rgba(0, 255, 0, 0.2);\n stroke: rgba(0, 255, 8, 0.5);\n stroke-width: 1px;\n"])));
12
- // "↕ 가변" 텍스트용 text
13
- var IndicatorText = styled.text(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n fill: rgba(0, 255, 8, 0.5);\n font-size: 12px;\n font-weight: 600;\n /* y \uC88C\uD45C \uAE30\uC900 \uC138\uB85C \uC911\uC559 \uC815\uB82C */\n dominant-baseline: central;\n /* x \uC88C\uD45C \uAE30\uC900 \uC67C\uCABD \uC815\uB82C */\n text-anchor: start;\n"], ["\n fill: rgba(0, 255, 8, 0.5);\n font-size: 12px;\n font-weight: 600;\n /* y \uC88C\uD45C \uAE30\uC900 \uC138\uB85C \uC911\uC559 \uC815\uB82C */\n dominant-baseline: central;\n /* x \uC88C\uD45C \uAE30\uC900 \uC67C\uCABD \uC815\uB82C */\n text-anchor: start;\n"])));
14
2
  export function GridBackgroundPlaceholder(_a) {
15
- var margin = _a.margin, width = _a.width, rowHeight = _a.rowHeight, colWidth = _a.colWidth, backgroundWidth = _a.backgroundWidth, backgroundHeight = _a.backgroundHeight, activeDrag = _a.activeDrag, selectedBlockId = _a.selectedBlockId;
16
- // 활성화된 인덱스
3
+ var margin = _a.margin,
4
+ // width, // 🚨 제거
5
+ rowHeight = _a.rowHeight, colWidth = _a.colWidth, backgroundWidth = _a.backgroundWidth, backgroundHeight = _a.backgroundHeight, activeDrag = _a.activeDrag, selectedBlockId = _a.selectedBlockId, totalCols = _a.totalCols;
6
+ // 활성화된 행(row) 인덱스 배열
17
7
  var activeRows = Array.from({ length: activeDrag.h }, function (_, i) { return activeDrag.y + i; });
18
- // 모든 인덱스 (0부터 23까지)
19
- var activeCols = Array.from({ length: 24 }, function (_, i) { return 0 + i; });
20
- // 텍스트 여백
8
+ // 🚨 activeCols도 totalCols prop으로 받아서 사용
9
+ // const activeCols = Array.from({ length: 24 }, (_, i) => 0 + i);
10
+ var activeCols = Array.from({ length: totalCols }, function (_, i) { return 0 + i; });
21
11
  var textPadding = 10;
12
+ // 💡 SVG 캔버스 내부에서 그리드가 차지하는 '실제' 너비를 계산
13
+ // (총 열 수 * (각 열의 너비 + 가로 마진)) - 마지막 열의 추가 마진
14
+ // 패턴은 colWidth + margin[0] 단위로 반복되므로, 마지막 열에서는 margin[0]이 필요 없습니다.
15
+ // 또는, 마지막 요소에는 margin[0]이 없다고 가정하고 계산합니다.
16
+ var gridContentWidth = totalCols * (colWidth + margin[0]) - margin[0];
22
17
  return (_jsx("div", { className: "grid-placeholder", style: {
23
18
  marginTop: margin[1] + "px",
24
19
  marginBottom: margin[1] + "px",
25
20
  marginLeft: margin[0] + "px",
26
21
  marginRight: margin[0] + "px",
27
- }, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: backgroundWidth, height: backgroundHeight, overflow: "visible" // 3. 텍스트가 잘리지 않도록 overflow="visible" 추가
28
- , children: [_jsx("defs", { children: _jsx("pattern", { id: "grid-pattern", height: rowHeight + margin[1], width: colWidth + margin[0], patternUnits: "userSpaceOnUse", children: _jsx(GridPatternRect, { x: 0.5, y: 0.5, height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: width, height: "100%", fill: "url(#grid-pattern)" }), activeDrag &&
22
+ }, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg",
23
+ // 💡 backgroundWidth는 string("100%")으로 사용하되,
24
+ // 내부 요소 배치에는 gridContentWidth를 사용합니다.
25
+ width: backgroundWidth, height: backgroundHeight, overflow: "visible", children: [_jsx("defs", { children: _jsx("pattern", { id: "grid-pattern", height: rowHeight + margin[1], width: colWidth + margin[0], patternUnits: "userSpaceOnUse", children: _jsx("rect", { x: 0.5, y: 0.5, className: "grid-pattern-rect", height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: gridContentWidth, height: "100%", fill: "url(#grid-pattern)" }), activeDrag &&
29
26
  activeRows.map(function (row) {
30
- // 이 행의 y 좌표 계산
31
27
  var y_top = row * (rowHeight + margin[1]) + 0.5;
32
- // 텍스트를 위한 행의 세로 중앙 y 좌표
33
28
  var y_center = y_top + rowHeight / 2;
34
- // 5. <g> 태그로 각 행의 요소들을 그룹화
35
29
  return (_jsxs("g", { children: [activeCols.map(function (col) {
36
30
  var x = col * (colWidth + margin[0]) + 0.5;
37
- return (_jsx(ActiveCellRect, { x: x, y: y_top, width: colWidth, height: rowHeight }, "".concat(row, "-").concat(col)));
38
- }), _jsx(IndicatorText, { x: width + textPadding, y: y_center, children: "\u2195 \uAC00\uBCC0" })] }, row));
31
+ return (_jsx("rect", { x: x, y: y_top, width: colWidth, height: rowHeight, className: "grid-active-cell-placeholder" }, "active-".concat(row, "-").concat(col)));
32
+ }), _jsx("text", {
33
+ // 💡 텍스트 x 위치도 gridContentWidth를 기준으로 계산
34
+ x: gridContentWidth + textPadding, y: y_center, className: "grid-indicator-text", children: "\u2195 \uAC00\uBCC0" })] }, "active-row-".concat(row)));
39
35
  })] }) }));
40
36
  }
41
- var templateObject_1, templateObject_2, templateObject_3;
@@ -67,7 +67,6 @@ var ReactGridLayout = function (_a) {
67
67
  var selectedBlock = blockStructure && selectedBlockId
68
68
  ? findBlockByBlockId(blockStructure, selectedBlockId)
69
69
  : null;
70
- console.log("selectedBlockId:", selectedBlock);
71
70
  var editingGroupAllChildren = blockStructure && editingGroupBlock
72
71
  ? findAllChildrenCbIds(blockStructure, editingGroupBlock).map(function (i) {
73
72
  return i.toString();
@@ -747,6 +746,8 @@ var ReactGridLayout = function (_a) {
747
746
  var currentGroupBlocks = blockStructure
748
747
  ? findGroupBlocks(blockStructure, editingGroupBlock)
749
748
  : [];
750
- return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, "data-grid-row-height": rowHeight, "data-grid-cols": cols, "data-section-id": sectionId, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDrag && (_jsx(GridBackgroundPlaceholder, { backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin, width: width, rowHeight: rowHeight, colWidth: colWidth, activeDrag: activeDrag, selectedBlockId: selectedBlockId }))] }));
749
+ return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, "data-grid-row-height": rowHeight, "data-grid-cols": cols, "data-section-id": sectionId, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDrag && (_jsx(GridBackgroundPlaceholder, { backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin,
750
+ // width={width}
751
+ rowHeight: rowHeight, colWidth: colWidth, activeDrag: activeDrag, selectedBlockId: selectedBlockId, totalCols: cols }))] }));
751
752
  };
752
753
  export default ReactGridLayout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.345",
3
+ "version": "0.0.347",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",