publ-echo-test 0.0.343 → 0.0.344
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/dist/lib/GridLayoutEditor/Placeholder.d.ts +13 -0
- package/dist/lib/GridLayoutEditor/Placeholder.js +24 -0
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +7 -10
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +2 -2
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +8 -8
- package/dist/lib/GridLayoutEditor/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function GridBackgroundPlaceholder(_a) {
|
|
3
|
+
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;
|
|
4
|
+
// 1. 활성화된 행(row) 인덱스 배열 (이건 그대로 사용)
|
|
5
|
+
var activeRows = Array.from({ length: activeDrag.h }, function (_, i) { return activeDrag.y + i; });
|
|
6
|
+
var activeCols = Array.from({ length: 24 }, function (_, i) { return 0 + i; });
|
|
7
|
+
return (_jsx("div", { className: "grid-placeholder", style: {
|
|
8
|
+
marginTop: margin[1] + "px",
|
|
9
|
+
marginBottom: margin[1] + "px",
|
|
10
|
+
marginLeft: margin[0] + "px",
|
|
11
|
+
marginRight: margin[0] + "px",
|
|
12
|
+
}, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: backgroundWidth, height: backgroundHeight, 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" // 기본 그리드 셀 스타일
|
|
13
|
+
, height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: width, height: "100%", fill: "url(#grid-pattern)" }), activeDrag &&
|
|
14
|
+
activeRows.map(function (row) {
|
|
15
|
+
return activeCols.map(function (col) {
|
|
16
|
+
// 각 셀의 정확한 x, y 위치 계산
|
|
17
|
+
var x = col * (colWidth + margin[0]) + 0.5;
|
|
18
|
+
var y = row * (rowHeight + margin[1]) + 0.5;
|
|
19
|
+
return (_jsx("rect", { x: x, y: y, width: colWidth, height: rowHeight,
|
|
20
|
+
// 이 클래스에 다른 배경색을 지정하세요.
|
|
21
|
+
className: "grid-active-cell-placeholder" }, "".concat(row, "-").concat(col)));
|
|
22
|
+
});
|
|
23
|
+
})] }) }));
|
|
24
|
+
}
|
|
@@ -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" }),
|
|
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
|
|
2
|
-
import { PropsWithChildren } from
|
|
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
|
|
25
|
-
import { cloneLayout, noop, synchronizeLayoutWithChildren, } from
|
|
26
|
-
import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from
|
|
27
|
-
import isEqual from
|
|
28
|
-
import ReactGridLayout from
|
|
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 ||
|
|
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 ||
|
|
99
|
-
layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType ||
|
|
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,
|