pds-dev-kit-web-test 0.3.47 → 0.3.49
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/sectionActionTypes.d.ts +0 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +14 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js +8 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/utils.d.ts +1 -0
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -106,6 +106,7 @@ var CommentList = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
106
106
|
var _a;
|
|
107
107
|
var filteredLayout = (0, useGroupDrag_2.filterItemsById)(parsedLayouts[layoutByDevice], cbIds);
|
|
108
108
|
var newGroupLayout = (0, utils_1.getGroupForMultiple)(parsedLayouts[layoutByDevice].filter(function (each) { return cbIds.includes(each.i); }));
|
|
109
|
+
newGroupLayout.keepInLastIndex = true;
|
|
109
110
|
filteredLayout.push(newGroupLayout);
|
|
110
111
|
return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = filteredLayout, _a));
|
|
111
112
|
});
|
|
@@ -121,8 +122,13 @@ var CommentList = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
121
122
|
var groupedCBIds = (_b = group === null || group === void 0 ? void 0 : group.childrenIds) !== null && _b !== void 0 ? _b : [];
|
|
122
123
|
var filteredLayout = (0, useGroupDrag_2.filterItemsById)(parsedLayouts[layoutByDevice], groupedCBIds);
|
|
123
124
|
if (group === null || group === void 0 ? void 0 : group.groupLayouts) {
|
|
124
|
-
var
|
|
125
|
-
|
|
125
|
+
var groupCbs = parsedLayouts[layoutByDevice].filter(function (each) {
|
|
126
|
+
return groupedCBIds.includes(each.i);
|
|
127
|
+
});
|
|
128
|
+
if (groupCbs.length > 0) {
|
|
129
|
+
var newGroupLayout = (0, utils_1.getGroupForMultiple)(groupCbs);
|
|
130
|
+
filteredLayout.push(newGroupLayout);
|
|
131
|
+
}
|
|
126
132
|
}
|
|
127
133
|
return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = filteredLayout, _a));
|
|
128
134
|
});
|
|
@@ -410,14 +416,17 @@ var CommentList = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
410
416
|
});
|
|
411
417
|
function keepSimilarOrderToPreventRerender(arr) {
|
|
412
418
|
var _a;
|
|
413
|
-
var arrCopy = __spreadArray([], arr, true);
|
|
419
|
+
var arrCopy = __spreadArray([], arr, true).sort(function (a, b) { return Number(a.i) - Number(b.i); });
|
|
414
420
|
var groupIdx = arrCopy.findIndex(function (each) { return each.i === 'group'; });
|
|
415
421
|
if (groupIdx >= 0) {
|
|
416
422
|
var group = arrCopy.splice(groupIdx, 1)[0];
|
|
417
423
|
(_a = group.groupLayouts) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return Number(a.i) - Number(b.i); });
|
|
418
|
-
|
|
424
|
+
if (group.keepInLastIndex) {
|
|
425
|
+
return __spreadArray(__spreadArray([null], arrCopy, true), [group], false);
|
|
426
|
+
}
|
|
427
|
+
return __spreadArray([group], arrCopy, true);
|
|
419
428
|
}
|
|
420
|
-
return __spreadArray([], arrCopy
|
|
429
|
+
return __spreadArray([null], arrCopy, true);
|
|
421
430
|
}
|
|
422
431
|
function isLayoutPlacementSame(current, prev) {
|
|
423
432
|
if (!prev) {
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js
CHANGED
|
@@ -45,6 +45,14 @@ function useGroupDrag(_a) {
|
|
|
45
45
|
// NOTE: 그룹이 없는 경우
|
|
46
46
|
if (groupIdx < 0) {
|
|
47
47
|
var group_1 = (0, utils_1.getGroupForMultiple)(currentLayoutCopy);
|
|
48
|
+
sectionActionHandler &&
|
|
49
|
+
sectionActionHandler({
|
|
50
|
+
type: '@CUSTOMSECTION/GROUP_CREATED',
|
|
51
|
+
payload: {
|
|
52
|
+
message: 'group generated',
|
|
53
|
+
data: group_1
|
|
54
|
+
}
|
|
55
|
+
});
|
|
48
56
|
return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = [group_1], _a));
|
|
49
57
|
}
|
|
50
58
|
// NOTE: 그룹이 이미 있는경우
|
|
@@ -2,6 +2,7 @@ import type { ComponentBlock } from '../../types';
|
|
|
2
2
|
import type { LayoutItem } from 'publ-echo/dist/lib';
|
|
3
3
|
export interface LayoutItemWithGroupType extends LayoutItem {
|
|
4
4
|
childrenIds: string[];
|
|
5
|
+
keepInLastIndex?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function getGroupData(elem1: LayoutItemWithGroupType, elem2: LayoutItemWithGroupType): LayoutItemWithGroupType;
|
|
7
8
|
export declare function recalculatedGroup(group: LayoutItemWithGroupType): LayoutItemWithGroupType;
|
package/package.json
CHANGED
package/release-note.md
CHANGED