pds-dev-kit-web-test 2.7.105 → 2.7.108
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.
@@ -219,6 +219,14 @@ var GridAutoRowEditor = (0, react_1.forwardRef)(function CustomSection(props, re
|
|
219
219
|
var currentDepthCbs = (_b = props.componentBlocks) === null || _b === void 0 ? void 0 : _b.filter(function (cb) {
|
220
220
|
return editableCBIds.includes(cb.id);
|
221
221
|
});
|
222
|
+
var onToggleGBPinned = function (gbId) {
|
223
|
+
setPinnedGBs(function (prev) {
|
224
|
+
if (prev.includes(gbId)) {
|
225
|
+
return prev.filter(function (id) { return id !== gbId; });
|
226
|
+
}
|
227
|
+
return __spreadArray(__spreadArray([], prev, true), [gbId], false);
|
228
|
+
});
|
229
|
+
};
|
222
230
|
return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(dynamicLayoutContext_1.dynamicLayoutContext.Provider, __assign({ value: {
|
223
231
|
device: device,
|
224
232
|
mode: mode,
|
@@ -265,7 +273,7 @@ var GridAutoRowEditor = (0, react_1.forwardRef)(function CustomSection(props, re
|
|
265
273
|
backgroundColor: '#e8e1e189',
|
266
274
|
border: '1px solid #6b666688'
|
267
275
|
}, "data-row": rIdx + 1, "data-col": cIdx + 1 }, "bg-grid-item-".concat(rIdx + 1, "-").concat(cIdx + 1))); }) }), "bg-grid-row-".concat(rIdx + 1)));
|
268
|
-
}), pedigree.children.map(function (child) { return ((0, jsx_runtime_1.jsx)(groupUtils_1.default, { block: child, rowHeight: rowHeight, layoutItems: layouts[device === 'DESKTOP' ? 'lg' : 'sm'], cbs: props.componentBlocks, device: device, selectedRows: selectedRows }, child.blockId)); })] })) })) })) }) })) }));
|
276
|
+
}), pedigree.children.map(function (child) { return ((0, jsx_runtime_1.jsx)(groupUtils_1.default, { block: child, rowHeight: rowHeight, layoutItems: layouts[device === 'DESKTOP' ? 'lg' : 'sm'], cbs: props.componentBlocks, device: device, selectedRows: selectedRows, pinnedGBs: pinnedGBs, onToggleGBPinned: onToggleGBPinned }, child.blockId)); })] })) })) })) }) })) }));
|
269
277
|
});
|
270
278
|
function GroupBlockRender(_a) {
|
271
279
|
var block = _a.block, layouts = _a.layouts, pedigree = _a.pedigree, isEditing = _a.isEditing, isPinned = _a.isPinned, componentBlocks = _a.componentBlocks, onTogglePinned = _a.onTogglePinned, onDoubleClick = _a.onDoubleClick, onDoubleClickOutside = _a.onDoubleClickOutside;
|
@@ -4,13 +4,15 @@ import type { Device } from '../sections/CustomSection/util/types';
|
|
4
4
|
import type { LayoutItem } from 'publ-echo/dist/lib';
|
5
5
|
import type { Block } from 'publ-echo/dist/lib/GridLayoutEditor/group';
|
6
6
|
export declare function findAllChildrenCbIds(block: Block, targetGroupId: string): number[];
|
7
|
-
export default function RenderPedigreeRecursively({ block, layoutItems, cbs, parentGroupArea, rowHeight, device, selectedRows }: {
|
7
|
+
export default function RenderPedigreeRecursively({ block, layoutItems, cbs, parentGroupArea, rowHeight, device, selectedRows, pinnedGBs, onToggleGBPinned }: {
|
8
8
|
block: Block;
|
9
9
|
layoutItems: LayoutItem[];
|
10
10
|
cbs: ComponentBlock[];
|
11
11
|
rowHeight: number;
|
12
12
|
device: Device;
|
13
13
|
selectedRows: number[];
|
14
|
+
pinnedGBs: string[];
|
15
|
+
onToggleGBPinned: (gbId: string) => void;
|
14
16
|
parentGroupArea?: {
|
15
17
|
rowStart: number;
|
16
18
|
colStart: number;
|
@@ -78,7 +78,7 @@ function findAllChildrenCbIds(block, targetGroupId) {
|
|
78
78
|
}
|
79
79
|
exports.findAllChildrenCbIds = findAllChildrenCbIds;
|
80
80
|
function RenderPedigreeRecursively(_a) {
|
81
|
-
var block = _a.block, layoutItems = _a.layoutItems, cbs = _a.cbs, parentGroupArea = _a.parentGroupArea, rowHeight = _a.rowHeight, device = _a.device, selectedRows = _a.selectedRows;
|
81
|
+
var block = _a.block, layoutItems = _a.layoutItems, cbs = _a.cbs, parentGroupArea = _a.parentGroupArea, rowHeight = _a.rowHeight, device = _a.device, selectedRows = _a.selectedRows, pinnedGBs = _a.pinnedGBs, onToggleGBPinned = _a.onToggleGBPinned;
|
82
82
|
var type = block.type;
|
83
83
|
if (type === 'GROUP_BLOCK') {
|
84
84
|
var childrenIds = findAllChildrenCbIds(block, block.blockId).map(function (i) { return i.toString(); });
|
@@ -99,13 +99,16 @@ function RenderPedigreeRecursively(_a) {
|
|
99
99
|
var relativeSelectedRows_1 = selectedRows
|
100
100
|
.map(function (row) { return row - gridArea_1.rowStart + 1; })
|
101
101
|
.filter(function (row) { return row >= 0 && row <= bounding_1.h; });
|
102
|
-
|
102
|
+
var isGBPinned = pinnedGBs.includes(block.blockId);
|
103
|
+
var defaultHeight = getMaxHeight({ cols: bounding_1.w, rows: bounding_1.h, x: bounding_1.x, y: bounding_1.y }, rowHeight);
|
104
|
+
return ((0, jsx_runtime_1.jsxs)(S_GroupItem, __assign({ cols: bounding_1.w, sectionRow: bounding_1.h, rowHeight: rowHeight, selectedRows: relativeSelectedRows_1, style: {
|
103
105
|
gridArea: gridAreaObjToString(relativeGridArea_1),
|
104
106
|
display: 'grid',
|
105
107
|
zIndex: device === 'DESKTOP'
|
106
108
|
? block.zOrderDesktopInternal
|
107
|
-
: block.zOrderMobileInternal
|
108
|
-
|
109
|
+
: block.zOrderMobileInternal,
|
110
|
+
maxHeight: isGBPinned ? defaultHeight : 'none'
|
111
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(S_Pinned, { children: isGBPinned ? ((0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: function () { return onToggleGBPinned(block.blockId); } }, { children: "H\uACE0\uC815\uB428 \uD83D\uDCCC" }))) : ((0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: function () { return onToggleGBPinned(block.blockId); } }, { children: "H\uB298\uC5B4\uB0A8 \uD83E\uDEB1" }))) }), block.children.map(function (child) { return ((0, jsx_runtime_1.jsx)(RenderPedigreeRecursively, { rowHeight: rowHeight, block: child, layoutItems: layoutItems, cbs: cbs, parentGroupArea: gridArea_1, device: device, selectedRows: relativeSelectedRows_1, pinnedGBs: pinnedGBs, onToggleGBPinned: onToggleGBPinned }, child.blockId)); })] })));
|
109
112
|
}
|
110
113
|
// default: TYPE === 'COMPONENT_BLOCK'
|
111
114
|
var cbIndex = cbs.findIndex(function (c) { return c.blockId === block.blockId; });
|
@@ -129,18 +132,19 @@ function RenderPedigreeRecursively(_a) {
|
|
129
132
|
// data-og-grid-area={originalGridAreaString}
|
130
133
|
// data-rel-grid-area={gridAreaObjToString(relativeGridArea)}
|
131
134
|
// >
|
132
|
-
(0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(FlexGridItem_1.default, { cb: cb, index: cbIndex, device: device, rowHeight:
|
135
|
+
(0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(FlexGridItem_1.default, { cb: cb, index: cbIndex, device: device, rowHeight: rowHeight, zIndex: device === 'DESKTOP'
|
133
136
|
? block.zOrderDesktopInternal
|
134
137
|
: block.zOrderMobileInternal, style: {
|
135
138
|
pointerEvents: 'none',
|
136
139
|
gridArea: gridAreaObjToString(relativeGridArea),
|
137
140
|
boxShadow: '0 0 0 2px red'
|
138
141
|
// opacity: isEditing ? 1 : 0.3
|
139
|
-
}, showPinned:
|
142
|
+
}, showPinned: parentGroupArea ? false : true, isParentGroupPinned: isPinned }) }, cb.id)
|
140
143
|
// </S_GridItem>
|
141
144
|
);
|
142
145
|
}
|
143
146
|
exports.default = RenderPedigreeRecursively;
|
147
|
+
var S_Pinned = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 9999999;\n"], ["\n pointer-events: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: 9999999;\n"])));
|
144
148
|
function clamp(num, min, max) {
|
145
149
|
return Math.max(Math.min(num, max), min);
|
146
150
|
}
|
@@ -194,7 +198,21 @@ function calculateRelativeGridArea(componentArea, parentArea) {
|
|
194
198
|
colEnd: componentArea.colEnd - parentArea.colStart + 1
|
195
199
|
};
|
196
200
|
}
|
197
|
-
|
201
|
+
function getMaxHeight(props, rowHeight) {
|
202
|
+
var gap = 10;
|
203
|
+
var rows = props.rows;
|
204
|
+
var height = rows * rowHeight + (rows - 1) * gap;
|
205
|
+
return height;
|
206
|
+
// if (device === 'DESKTOP') {
|
207
|
+
// const { rows } = props;
|
208
|
+
// const height = rows * rowHeight + (rows - 1) * gap;
|
209
|
+
// return height;
|
210
|
+
// }
|
211
|
+
// const rowsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'];
|
212
|
+
// const height = rowsMobile * rowHeight + (rowsMobile - 1) * gap;
|
213
|
+
// return height;
|
214
|
+
}
|
215
|
+
var S_GroupItem = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: 0 0 0 3px blue;\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: ", ";\n position: relative; /* \uBC30\uC5F4\uC744 \uACF5\uBC31\uC73C\uB85C \uAD6C\uBD84\uB41C \uBB38\uC790\uC5F4\uB85C \uD569\uCE69\uB2C8\uB2E4. */\n"], ["\n box-shadow: 0 0 0 3px blue;\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: ", ";\n position: relative; /* \uBC30\uC5F4\uC744 \uACF5\uBC31\uC73C\uB85C \uAD6C\uBD84\uB41C \uBB38\uC790\uC5F4\uB85C \uD569\uCE69\uB2C8\uB2E4. */\n"])), function (props) { return props.cols; }, function (props) {
|
198
216
|
// // 전체 행 개수만큼 배열을 생성하여 각 행의 CSS 값을 정의합니다.
|
199
217
|
return Array.from({ length: props.sectionRow })
|
200
218
|
.map(function (_, index) {
|
@@ -206,4 +224,4 @@ var S_GroupItem = styled_components_1.default.div(templateObject_1 || (templateO
|
|
206
224
|
)
|
207
225
|
.join(' ');
|
208
226
|
});
|
209
|
-
var templateObject_1;
|
227
|
+
var templateObject_1, templateObject_2;
|