pds-dev-kit-web-test 0.3.32 → 0.3.33
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/DynamicLayout.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/DynamicLayout.js +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +16 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js +25 -1
- package/dist/src/sub/DynamicLayout/types.d.ts +1 -0
- package/package.json +1 -1
- package/release-note.md +2 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DynamicLayoutProps } from './types';
|
|
3
|
-
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents, activeBulkSelectMode }: DynamicLayoutProps): JSX.Element;
|
|
3
|
+
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents, activeBulkSelectMode, activeCollisionSelectMode }: DynamicLayoutProps): JSX.Element;
|
|
4
4
|
export default DynamicLayout;
|
|
@@ -25,7 +25,7 @@ var EditModeSectionMatcher_1 = require("./components/EditModeSectionMatcher");
|
|
|
25
25
|
var SectionMatcher_1 = require("./components/SectionMatcher");
|
|
26
26
|
var dynamicLayoutContext_1 = require("./dynamicLayoutContext");
|
|
27
27
|
function DynamicLayout(_a) {
|
|
28
|
-
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents, activeBulkSelectMode = _a.activeBulkSelectMode;
|
|
28
|
+
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents, activeBulkSelectMode = _a.activeBulkSelectMode, activeCollisionSelectMode = _a.activeCollisionSelectMode;
|
|
29
29
|
var filteredSortedSection = __spreadArray([], sections, true).filter(function (section) { return section.display; })
|
|
30
30
|
.sort(function (a, b) { return a.order - b.order; });
|
|
31
31
|
var iframeSection = filteredSortedSection.find(function (section) { return section.manifest.schema === 'EXP_IFRAME' && section.display; });
|
|
@@ -37,7 +37,8 @@ function DynamicLayout(_a) {
|
|
|
37
37
|
sectionActionHandler: sectionActionHandler,
|
|
38
38
|
editingSectionId: editingSectionId,
|
|
39
39
|
programmedSectionComponents: programmedSectionComponents,
|
|
40
|
-
activeBulkSelectMode: activeBulkSelectMode
|
|
40
|
+
activeBulkSelectMode: activeBulkSelectMode,
|
|
41
|
+
activeCollisionSelectMode: activeCollisionSelectMode
|
|
41
42
|
} }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
|
|
42
43
|
(iframeSection ? ((0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, iframeSection), iframeSection.id)) : (filteredSortedSection.map(function (section) { return (0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, section), section.id); })))] })));
|
|
43
44
|
}
|
|
@@ -75,7 +75,7 @@ var MOBILE_GRID_COLS = 8;
|
|
|
75
75
|
var GLE_MIN_WIDTH_DESKTOP_PX = "".concat(GRID_CELL_MIN * DESKTOP_GRID_COLS, "px");
|
|
76
76
|
var GLE_MIN_WIDTH_MOBILE_PX = "".concat(GRID_CELL_MIN * MOBILE_GRID_COLS, "px");
|
|
77
77
|
function CustomSection(props) {
|
|
78
|
-
var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, editingSectionId = _a.editingSectionId, mode = _a.mode, sectionActionHandler = _a.sectionActionHandler, activeBulkSelectMode = _a.activeBulkSelectMode;
|
|
78
|
+
var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, editingSectionId = _a.editingSectionId, mode = _a.mode, sectionActionHandler = _a.sectionActionHandler, activeBulkSelectMode = _a.activeBulkSelectMode, activeCollisionSelectMode = _a.activeCollisionSelectMode;
|
|
79
79
|
var componentBlocks = props.componentBlocks, jsonProperties = props.jsonProperties;
|
|
80
80
|
var _b = jsonProperties, CB_PLACEMENT_PROP_SECTION = _b.CB_PLACEMENT_PROP_SECTION, CB_LAYOUT_PROP_PADDING = _b.CB_LAYOUT_PROP_PADDING, CB_CONTENT_PROP_SECTION = _b.CB_CONTENT_PROP_SECTION;
|
|
81
81
|
var _c = (0, react_1.useState)(null), selectedCB = _c[0], setSelectedCB = _c[1];
|
|
@@ -96,7 +96,7 @@ function CustomSection(props) {
|
|
|
96
96
|
setLayouts: setLayouts,
|
|
97
97
|
device: device,
|
|
98
98
|
sectionActionHandler: sectionActionHandler
|
|
99
|
-
}), setGroupCB = _g.setGroupCB, breakGroupCB = _g.breakGroupCB, makeAllInOneGroup = _g.makeAllInOneGroup, escapeFromGroup = _g.escapeFromGroup;
|
|
99
|
+
}), setGroupCB = _g.setGroupCB, breakGroupCB = _g.breakGroupCB, makeAllInOneGroup = _g.makeAllInOneGroup, escapeFromGroup = _g.escapeFromGroup, makeCollisionGroup = _g.makeCollisionGroup;
|
|
100
100
|
(0, react_1.useLayoutEffect)(function () {
|
|
101
101
|
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
|
|
102
102
|
setLayouts(function (prev) {
|
|
@@ -151,7 +151,20 @@ function CustomSection(props) {
|
|
|
151
151
|
setSelectedCB('group');
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
var hasAlreadyGroup = (0, useGroupDrag_2.getGroupCB)(layouts[layoutByDevice]);
|
|
155
|
+
if (activeCollisionSelectMode && !hasAlreadyGroup) {
|
|
156
|
+
makeCollisionGroup(id);
|
|
157
|
+
sectionActionHandler &&
|
|
158
|
+
sectionActionHandler({
|
|
159
|
+
type: '@CUSTOMSECTION/CB_CLICKED',
|
|
160
|
+
payload: {
|
|
161
|
+
id: 'group'
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
setSelectedCB('group');
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (hasAlreadyGroup) {
|
|
155
168
|
breakGroupCB();
|
|
156
169
|
}
|
|
157
170
|
setSelectedCB(id);
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare function useGroupDrag({ device, setLayouts, sectionActionHandler }: Prop
|
|
|
14
14
|
breakGroupCB: () => void;
|
|
15
15
|
makeAllInOneGroup: () => void;
|
|
16
16
|
escapeFromGroup: (id: string) => void;
|
|
17
|
+
makeCollisionGroup: (id: number) => void;
|
|
17
18
|
};
|
|
18
19
|
export declare function getGroupCB(layout: Layout): LayoutItemWithGroupType | null;
|
|
19
20
|
export declare const filterItemsById: (layout: Layout, idsToRemove: string[]) => LayoutItem[];
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js
CHANGED
|
@@ -10,8 +10,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
23
|
exports.filterItemsById = exports.getGroupCB = void 0;
|
|
24
|
+
var renderHelpers_1 = require("publ-echo/dist/lib/GridLayoutEditor/utils/renderHelpers");
|
|
15
25
|
var utils_1 = require("./utils");
|
|
16
26
|
function useGroupDrag(_a) {
|
|
17
27
|
var device = _a.device, setLayouts = _a.setLayouts, sectionActionHandler = _a.sectionActionHandler;
|
|
@@ -124,7 +134,21 @@ function useGroupDrag(_a) {
|
|
|
124
134
|
}
|
|
125
135
|
});
|
|
126
136
|
}
|
|
127
|
-
|
|
137
|
+
function makeCollisionGroup(id) {
|
|
138
|
+
setLayouts(function (prev) {
|
|
139
|
+
var _a;
|
|
140
|
+
var currentLayoutCopy = JSON.parse(JSON.stringify(prev[layoutByDevice]));
|
|
141
|
+
var layout = (0, renderHelpers_1.getLayoutItem)(currentLayoutCopy, id.toString());
|
|
142
|
+
if (!layout) {
|
|
143
|
+
return prev;
|
|
144
|
+
}
|
|
145
|
+
var collisions = (0, renderHelpers_1.getAllCollisions)(currentLayoutCopy, layout);
|
|
146
|
+
var group = (0, utils_1.getGroupForMultiple)(__spreadArray([layout], collisions, true));
|
|
147
|
+
var filtered = currentLayoutCopy.filter(function (layout) { return !group.childrenIds.includes(layout.i); });
|
|
148
|
+
return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = __spreadArray([group], filtered, true), _a));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return { setGroupCB: setGroupCB, breakGroupCB: breakGroupCB, makeAllInOneGroup: makeAllInOneGroup, escapeFromGroup: escapeFromGroup, makeCollisionGroup: makeCollisionGroup };
|
|
128
152
|
}
|
|
129
153
|
function getGroupCB(layout) {
|
|
130
154
|
var groupIdx = layout.findIndex(function (item) { return item.i === 'group'; });
|
|
@@ -225,6 +225,7 @@ export type DynamicLayoutProps = {
|
|
|
225
225
|
programmedSectionComponents?: IProgrammedSectionComponents;
|
|
226
226
|
width?: number;
|
|
227
227
|
activeBulkSelectMode?: boolean;
|
|
228
|
+
activeCollisionSelectMode?: boolean;
|
|
228
229
|
};
|
|
229
230
|
export type NavHandlerAction = {
|
|
230
231
|
openNewTab: boolean;
|
package/package.json
CHANGED
package/release-note.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# pds-dev-kit-web-test Release Notes
|
|
2
|
-
## [v0.3.
|
|
2
|
+
## [v0.3.33]
|
|
3
3
|
## 기준 pds-dev-kit-web 버전 @2.2.41
|
|
4
4
|
### sub
|
|
5
5
|
* DynamicLayout
|
|
6
|
-
|
|
7
|
-
* 제자리 DROP / 제자리 RESIZE → action 발행 안함
|
|
8
|
-
* shift후 스스로 클릭 → action 발행 안함
|
|
9
|
-
* bulk그룹에서 제외 클릭 시 group 사이즈 조정
|
|
6
|
+
* grid상에서 겹치는 요소를 한꺼번에 그룹화하는 - collision-group - 기능추가
|