pds-dev-kit-web-test 0.3.27 → 0.3.28
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/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +13 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js +16 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/utils.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useIntersectionObserver.js +5 -0
- package/package.json +1 -1
- package/release-note.md +2 -3
|
@@ -42,6 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
45
|
+
/* eslint-disable no-console */
|
|
45
46
|
/* eslint-disable react/destructuring-assignment */
|
|
46
47
|
var publ_echo_1 = require("publ-echo");
|
|
47
48
|
var ReactGridLayout_1 = __importDefault(require("publ-echo/dist/lib/GridLayoutEditor/ReactGridLayout"));
|
|
@@ -90,6 +91,7 @@ function CustomSection(props) {
|
|
|
90
91
|
(0, react_1.useEffect)(function () {
|
|
91
92
|
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
|
|
92
93
|
setLayouts(function (prev) {
|
|
94
|
+
console.log('custom section EFFECT: componentBlocks setLayouts');
|
|
93
95
|
var groupInLG = (0, useGroupDrag_2.getGroupCB)(prev.lg);
|
|
94
96
|
var groupInSM = (0, useGroupDrag_2.getGroupCB)(prev.sm);
|
|
95
97
|
var groupedCBIdsInLG = (groupInLG === null || groupInLG === void 0 ? void 0 : groupInLG.childrenIds) || [];
|
|
@@ -142,7 +144,9 @@ function CustomSection(props) {
|
|
|
142
144
|
setSelectedCB('group');
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
|
-
|
|
147
|
+
if ((0, useGroupDrag_2.getGroupCB)(layouts[layoutByDevice])) {
|
|
148
|
+
breakGroupCB();
|
|
149
|
+
}
|
|
146
150
|
setSelectedCB(id);
|
|
147
151
|
sectionActionHandler &&
|
|
148
152
|
sectionActionHandler({
|
|
@@ -198,6 +202,9 @@ function CustomSection(props) {
|
|
|
198
202
|
var numberId = Number((_a = props.item) === null || _a === void 0 ? void 0 : _a.i);
|
|
199
203
|
var isIdNumber = !Number.isNaN(numberId);
|
|
200
204
|
if (isIdNumber) {
|
|
205
|
+
if ((0, useGroupDrag_2.getGroupCB)(layouts[layoutByDevice])) {
|
|
206
|
+
breakGroupCB();
|
|
207
|
+
}
|
|
201
208
|
setSelectedCB(numberId);
|
|
202
209
|
}
|
|
203
210
|
if (sectionActionHandler && isIdNumber) {
|
|
@@ -256,13 +263,17 @@ function CustomSection(props) {
|
|
|
256
263
|
};
|
|
257
264
|
var padding = (0, parseSectionPadding_1.default)(CB_LAYOUT_PROP_PADDING, device);
|
|
258
265
|
var breakpoints = device === 'DESKTOP' ? { lg: 100, sm: 0 } : { lg: 1200, sm: 480 };
|
|
266
|
+
var innerRef = (0, react_1.useRef)(null);
|
|
267
|
+
(0, react_1.useEffect)(function () {
|
|
268
|
+
console.log('Echo inner ref: ', { innerRef: innerRef });
|
|
269
|
+
}, []);
|
|
259
270
|
return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsxs)(S_gleStyles, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ style: { position: 'absolute', top: 0, left: 0, backgroundColor: 'red', zIndex: 9999 } }, { children: (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", onClick: makeAllInOneGroup }, { children: "select ALL" })) })), (0, jsx_runtime_1.jsx)(S_SectionWrapper, __assign({ ref: gleRef, "x-dlayout-section-type": "NO_NAME", onClick: onClickSection }, { children: (0, jsx_runtime_1.jsx)(components_1.CustomSection, __assign({}, props, { isMobile: isMobile, overrideStyles: {
|
|
260
271
|
minHeight: customSectionStyles.minHeight,
|
|
261
272
|
paddingTop: padding.top,
|
|
262
273
|
paddingBottom: padding.bottom,
|
|
263
274
|
paddingRight: padding.right,
|
|
264
275
|
paddingLeft: padding.left
|
|
265
|
-
} }, { children: (0, jsx_runtime_1.jsx)(Responsive, __assign({ allowOverlap: true, layouts: layouts, resizeHandles: ['nw', 'e', 'n', 'ne', 's', 'se', 'sw', 'w'], breakpoints: breakpoints, breakpoint: breakpoint, cols: { lg: 24, sm: 8 }, rowHeight: rowHeight, margin: [10, 10], style: {
|
|
276
|
+
} }, { children: (0, jsx_runtime_1.jsx)(Responsive, __assign({ innerRef: innerRef, allowOverlap: true, layouts: layouts, resizeHandles: ['nw', 'e', 'n', 'ne', 's', 'se', 'sw', 'w'], breakpoints: breakpoints, breakpoint: breakpoint, cols: { lg: 24, sm: 8 }, rowHeight: rowHeight, margin: [10, 10], style: {
|
|
266
277
|
width: customSectionStyles.width,
|
|
267
278
|
maxWidth: customSectionStyles.maxWidth,
|
|
268
279
|
minWidth: isMobile ? GLE_MIN_WIDTH_MOBILE_PX : GLE_MIN_WIDTH_DESKTOP_PX,
|
|
@@ -64,7 +64,7 @@ function Button(props) {
|
|
|
64
64
|
? CB_EFFECT_PROP_ENTANIM.CB_EFFECT_PROP_ENTANIM_SPEC_TYPE === 'NONE'
|
|
65
65
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
|
66
66
|
var hasEffect = !isNoneEffectType;
|
|
67
|
-
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
|
67
|
+
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0.3 } : {};
|
|
68
68
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle, style: {
|
|
69
69
|
paddingLeft: paddingLeft,
|
|
70
70
|
paddingRight: paddingRight,
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js
CHANGED
|
@@ -18,11 +18,25 @@ function useGroupDrag(_a) {
|
|
|
18
18
|
var layoutByDevice = device === 'DESKTOP' ? 'lg' : 'sm';
|
|
19
19
|
function makeAllInOneGroup() {
|
|
20
20
|
setLayouts(function (prev) {
|
|
21
|
-
var _a;
|
|
21
|
+
var _a, _b;
|
|
22
|
+
var _c;
|
|
22
23
|
// TODO: 임시용 카피
|
|
23
24
|
var currentLayoutCopy = JSON.parse(JSON.stringify(prev[layoutByDevice]));
|
|
25
|
+
var groupIdx = currentLayoutCopy.findIndex(function (item) { return item.i === 'group'; });
|
|
26
|
+
// NOTE: 그룹이 없는 경우
|
|
27
|
+
if (groupIdx < 0) {
|
|
28
|
+
var group_1 = (0, utils_1.getGroupForMultiple)(currentLayoutCopy);
|
|
29
|
+
return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = [group_1], _a));
|
|
30
|
+
}
|
|
31
|
+
// NOTE: 그룹이 이미 있는경우
|
|
32
|
+
var groupItem = currentLayoutCopy.splice(groupIdx, 1)[0];
|
|
33
|
+
if (!groupItem.groupLayouts) {
|
|
34
|
+
return prev;
|
|
35
|
+
}
|
|
36
|
+
var groupItems = (_c = groupItem.groupLayouts.map(function (each) { return (__assign(__assign({}, each), { x: groupItem.x + each.x, y: groupItem.y + each.y })); })) !== null && _c !== void 0 ? _c : [];
|
|
37
|
+
currentLayoutCopy.push.apply(currentLayoutCopy, groupItems);
|
|
24
38
|
var group = (0, utils_1.getGroupForMultiple)(currentLayoutCopy);
|
|
25
|
-
return __assign(__assign({}, prev), (
|
|
39
|
+
return __assign(__assign({}, prev), (_b = {}, _b[layoutByDevice] = [group], _b));
|
|
26
40
|
});
|
|
27
41
|
sectionActionHandler &&
|
|
28
42
|
sectionActionHandler({
|
|
@@ -4,7 +4,7 @@ export interface LayoutItemWithGroupType extends LayoutItem {
|
|
|
4
4
|
childrenIds: string[];
|
|
5
5
|
}
|
|
6
6
|
export declare function getGroupData(elem1: LayoutItemWithGroupType, elem2: LayoutItemWithGroupType): LayoutItemWithGroupType;
|
|
7
|
-
export declare function getGroupForMultiple(elems:
|
|
7
|
+
export declare function getGroupForMultiple(elems: LayoutItem[]): LayoutItemWithGroupType;
|
|
8
8
|
export declare function splitComponentBlocksByGroup(componentBlocks: ComponentBlock[], groupIds: string[]): {
|
|
9
9
|
inGroup: ComponentBlock[];
|
|
10
10
|
notInGroup: ComponentBlock[];
|
|
@@ -15,12 +15,17 @@ function useIntersectionObserver(elementRef, _a) {
|
|
|
15
15
|
var node = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current; // DOM Ref
|
|
16
16
|
var hasIOSupport = !!window.IntersectionObserver;
|
|
17
17
|
if (!hasIOSupport || frozen || !node) {
|
|
18
|
+
console.error('no node!', node);
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
var observerParams = { threshold: threshold, root: root, rootMargin: rootMargin };
|
|
21
22
|
var observer = new IntersectionObserver(updateEntry, observerParams);
|
|
22
23
|
observer.observe(node);
|
|
24
|
+
console.log('observer-connected', node);
|
|
25
|
+
var rect = node.getBoundingClientRect();
|
|
26
|
+
console.log('rect:', { x: rect.x, y: rect.y, top: rect.top, bottom: rect.bottom });
|
|
23
27
|
return function () {
|
|
28
|
+
console.log('observer-disconnected');
|
|
24
29
|
observer.disconnect();
|
|
25
30
|
};
|
|
26
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/package.json
CHANGED