pds-dev-kit-web-test 2.7.104 → 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 }, 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,12 +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 }: {
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
+ selectedRows: number[];
14
+ pinnedGBs: string[];
15
+ onToggleGBPinned: (gbId: string) => void;
13
16
  parentGroupArea?: {
14
17
  rowStart: number;
15
18
  colStart: number;
@@ -78,30 +78,37 @@ 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;
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(); });
85
- var bounding = (0, renderHelpers_1.getBoundingArea)(layoutItems, childrenIds);
86
- if (!bounding) {
85
+ var bounding_1 = (0, renderHelpers_1.getBoundingArea)(layoutItems, childrenIds);
86
+ if (!bounding_1) {
87
87
  return (0, jsx_runtime_1.jsx)("div", { children: "GROUP: NO BOUNDING AREA" });
88
88
  }
89
89
  var gridArea_1 = getGridAreaFromGroup({
90
- x: bounding.x,
91
- y: bounding.y,
92
- cols: bounding.w,
93
- rows: bounding.h
90
+ x: bounding_1.x,
91
+ y: bounding_1.y,
92
+ cols: bounding_1.w,
93
+ rows: bounding_1.h
94
94
  });
95
95
  var relativeGridArea_1 = parentGroupArea
96
96
  ? calculateRelativeGridArea(gridArea_1, parentGroupArea)
97
97
  : gridArea_1;
98
- return ((0, jsx_runtime_1.jsx)(S_GroupItem, __assign({ cols: bounding.w, sectionRow: bounding.h, rowHeight: rowHeight, selectedRows: [], style: {
98
+ // 그룹의 시작 행을 기준으로 상대적인 selectedRows 계산
99
+ var relativeSelectedRows_1 = selectedRows
100
+ .map(function (row) { return row - gridArea_1.rowStart + 1; })
101
+ .filter(function (row) { return row >= 0 && row <= bounding_1.h; });
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: {
99
105
  gridArea: gridAreaObjToString(relativeGridArea_1),
100
106
  display: 'grid',
101
107
  zIndex: device === 'DESKTOP'
102
108
  ? block.zOrderDesktopInternal
103
- : block.zOrderMobileInternal
104
- } }, { children: 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 }, child.blockId)); }) })));
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)); })] })));
105
112
  }
106
113
  // default: TYPE === 'COMPONENT_BLOCK'
107
114
  var cbIndex = cbs.findIndex(function (c) { return c.blockId === block.blockId; });
@@ -125,18 +132,19 @@ function RenderPedigreeRecursively(_a) {
125
132
  // data-og-grid-area={originalGridAreaString}
126
133
  // data-rel-grid-area={gridAreaObjToString(relativeGridArea)}
127
134
  // >
128
- (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(FlexGridItem_1.default, { cb: cb, index: cbIndex, device: device, rowHeight: 50, zIndex: device === 'DESKTOP'
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'
129
136
  ? block.zOrderDesktopInternal
130
137
  : block.zOrderMobileInternal, style: {
131
138
  pointerEvents: 'none',
132
139
  gridArea: gridAreaObjToString(relativeGridArea),
133
140
  boxShadow: '0 0 0 2px red'
134
141
  // opacity: isEditing ? 1 : 0.3
135
- }, showPinned: isEditing, isParentGroupPinned: isPinned }) }, cb.id)
142
+ }, showPinned: parentGroupArea ? false : true, isParentGroupPinned: isPinned }) }, cb.id)
136
143
  // </S_GridItem>
137
144
  );
138
145
  }
139
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"])));
140
148
  function clamp(num, min, max) {
141
149
  return Math.max(Math.min(num, max), min);
142
150
  }
@@ -190,7 +198,21 @@ function calculateRelativeGridArea(componentArea, parentArea) {
190
198
  colEnd: componentArea.colEnd - parentArea.colStart + 1
191
199
  };
192
200
  }
193
- var S_GroupItem = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __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) {
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) {
194
216
  // // 전체 행 개수만큼 배열을 생성하여 각 행의 CSS 값을 정의합니다.
195
217
  return Array.from({ length: props.sectionRow })
196
218
  .map(function (_, index) {
@@ -202,4 +224,4 @@ var S_GroupItem = styled_components_1.default.div(templateObject_1 || (templateO
202
224
  )
203
225
  .join(' ');
204
226
  });
205
- var templateObject_1;
227
+ var templateObject_1, templateObject_2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "2.7.104",
3
+ "version": "2.7.108",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",