publ-echo-test 0.0.343 → 0.0.345

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.
@@ -0,0 +1,13 @@
1
+ import { LayoutItem } from "./types";
2
+ type PlaceholderProps = {
3
+ margin: [number, number];
4
+ width: number;
5
+ rowHeight: number;
6
+ colWidth: number;
7
+ backgroundWidth: string | undefined;
8
+ backgroundHeight: string | undefined;
9
+ activeDrag: LayoutItem;
10
+ selectedBlockId: string | null;
11
+ };
12
+ export declare function GridBackgroundPlaceholder({ margin, width, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,41 @@
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
+ 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
+ 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
+ // 활성화된 행 인덱스
17
+ 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
+ // 텍스트 여백
21
+ var textPadding = 10;
22
+ return (_jsx("div", { className: "grid-placeholder", style: {
23
+ marginTop: margin[1] + "px",
24
+ marginBottom: margin[1] + "px",
25
+ marginLeft: margin[0] + "px",
26
+ 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 &&
29
+ activeRows.map(function (row) {
30
+ // 이 행의 y 좌표 계산
31
+ var y_top = row * (rowHeight + margin[1]) + 0.5;
32
+ // 텍스트를 위한 행의 세로 중앙 y 좌표
33
+ var y_center = y_top + rowHeight / 2;
34
+ // 5. <g> 태그로 각 행의 요소들을 그룹화
35
+ return (_jsxs("g", { children: [activeCols.map(function (col) {
36
+ 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));
39
+ })] }) }));
40
+ }
41
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -41,10 +41,11 @@ import isEqual from "../../external-lib/lodash.isEqual";
41
41
  import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from "./group";
42
42
  import GroupItem from "../GridItem/GroupItem";
43
43
  import OutsideClickHandler from "../GridItem/OutsideClickHandler";
44
+ import { GridBackgroundPlaceholder } from "./Placeholder";
44
45
  var layoutClassName = "react-grid-layout";
45
46
  var ReactGridLayout = function (_a) {
46
47
  var children = _a.children, props = __rest(_a, ["children"]);
47
- var sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? "" : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? "" : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? "" : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? "vertical" : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
48
+ var selectedBlockId = props.selectedBlockId, sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? "" : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? "" : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? "" : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? "vertical" : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
48
49
  i: "__dropping-elem__",
49
50
  h: 1,
50
51
  w: 1,
@@ -60,12 +61,13 @@ var ReactGridLayout = function (_a) {
60
61
  var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
61
62
  var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
62
63
  var editorMode = props.isDraggable && props.isResizable ? "EDIT" : "VIEW";
63
- var selectedBlock = blockStructure
64
- ? findBlockByBlockId(blockStructure, editingGroupBlock)
65
- : null;
66
64
  var editableBlockIds = blockStructure
67
65
  ? findDirectChildrenCbIds(blockStructure, editingGroupBlock)
68
66
  : [];
67
+ var selectedBlock = blockStructure && selectedBlockId
68
+ ? findBlockByBlockId(blockStructure, selectedBlockId)
69
+ : null;
70
+ console.log("selectedBlockId:", selectedBlock);
69
71
  var editingGroupAllChildren = blockStructure && editingGroupBlock
70
72
  ? findAllChildrenCbIds(blockStructure, editingGroupBlock).map(function (i) {
71
73
  return i.toString();
@@ -745,11 +747,6 @@ var ReactGridLayout = function (_a) {
745
747
  var currentGroupBlocks = blockStructure
746
748
  ? findGroupBlocks(blockStructure, editingGroupBlock)
747
749
  : [];
748
- 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 || selectedBlock) && (_jsx("div", { className: "grid-placeholder", style: {
749
- marginTop: margin[1] + "px",
750
- marginBottom: margin[1] + "px",
751
- marginLeft: margin[0] + "px",
752
- marginRight: margin[0] + "px",
753
- }, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: getBackgroundWidth(), height: getBackgroundHeight(), 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: width, height: "100%", fill: "url(#grid-pattern)" })] }) }))] }));
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 }))] }));
754
751
  };
755
752
  export default ReactGridLayout;
@@ -1,4 +1,4 @@
1
- import { ResponsiveGridLayoutProps } from './types';
2
- import { PropsWithChildren } from '../types';
1
+ import { ResponsiveGridLayoutProps } from "./types";
2
+ import { PropsWithChildren } from "../types";
3
3
  export declare const ResponsiveGridLayout: ({ children, ...props }: PropsWithChildren<ResponsiveGridLayoutProps>) => React.ReactElement;
4
4
  export default ResponsiveGridLayout;
@@ -21,11 +21,11 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import { useLayoutEffect, useRef, useState } from 'react';
25
- import { cloneLayout, noop, synchronizeLayoutWithChildren, } from './utils/renderHelpers';
26
- import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from './utils/responsiveUtils';
27
- import isEqual from '../../external-lib/lodash.isEqual';
28
- import ReactGridLayout from './ReactGridLayout';
24
+ import { useLayoutEffect, useRef, useState } from "react";
25
+ import { cloneLayout, noop, synchronizeLayoutWithChildren, } from "./utils/renderHelpers";
26
+ import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from "./utils/responsiveUtils";
27
+ import isEqual from "../../external-lib/lodash.isEqual";
28
+ import ReactGridLayout from "./ReactGridLayout";
29
29
  /**
30
30
  * Get a value of margin or containerPadding.
31
31
  *
@@ -44,7 +44,7 @@ export var ResponsiveGridLayout = function (_a) {
44
44
  var breakpoint = getBreakpointFromWidth(breakpoints, width);
45
45
  var colNo = getColsFromBreakpoint(breakpoint, cols);
46
46
  var compactType = props.compactType;
47
- var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType || 'vertical', false);
47
+ var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType || "vertical", false);
48
48
  return {
49
49
  layout: initialLayout,
50
50
  layouts: layouts,
@@ -95,8 +95,8 @@ export var ResponsiveGridLayout = function (_a) {
95
95
  breakpoints[newBreakpoint] > breakpoints[lastBreakpoint];
96
96
  var isNewLayout = layouts[newBreakpoint] == null;
97
97
  var overlap = !!props.allowOverlap && (!isNewLayout || newBreakpointIsBiggerOrEqual); // allow resize overlap only if we are going into a larger screen
98
- var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType || 'vertical', overlap);
99
- layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType || 'vertical', overlap);
98
+ var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType || "vertical", overlap);
99
+ layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType || "vertical", overlap);
100
100
  newLayouts[newBreakpoint] = layout;
101
101
  setState({
102
102
  breakpoint: newBreakpoint,
@@ -36,6 +36,7 @@ export type UpdatedItem = {
36
36
  y: number;
37
37
  };
38
38
  export type ReactGridLayoutProps = {
39
+ selectedBlockId: string | null;
39
40
  sectionId: string;
40
41
  children: ReactElement<any> | ReactElement[];
41
42
  className?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.343",
3
+ "version": "0.0.345",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",