pds-dev-kit-web-test 0.3.32 → 0.3.34

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.
@@ -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
- if ((0, useGroupDrag_2.getGroupCB)(layouts[layoutByDevice])) {
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);
@@ -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[];
@@ -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
- return { setGroupCB: setGroupCB, breakGroupCB: breakGroupCB, makeAllInOneGroup: makeAllInOneGroup, escapeFromGroup: escapeFromGroup };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "i18next-intervalplural-postprocessor": "^3.0.0",
23
23
  "lottie-react": "^2.3.1",
24
24
  "nuka-carousel": "^4.8.4",
25
- "publ-echo": "^0.0.34",
25
+ "publ-echo": "^0.0.38",
26
26
  "react-hook-form": "^7.28.1",
27
27
  "react-i18next": "^11.12.0",
28
28
  "react-router-dom": "^5.2.0",
package/release-note.md CHANGED
@@ -1,9 +1,6 @@
1
1
  # pds-dev-kit-web-test Release Notes
2
- ## [v0.3.32]
2
+ ## [v0.3.34]
3
3
  ## 기준 pds-dev-kit-web 버전 @2.2.41
4
4
  ### sub
5
5
  * DynamicLayout
6
- * 깜빡깜빡거리며 구석에 생기는(x:0,y:0으로 움직이는) 이슈 픽스
7
- * 제자리 DROP / 제자리 RESIZE → action 발행 안함
8
- * shift후 스스로 클릭 → action 발행 안함
9
- * bulk그룹에서 제외 클릭 시 group 사이즈 조정
6
+ * group화/해제 1px의 움직임이 더해져 움찔거리는 이슈 픽스