pds-dev-kit-web-test 0.2.34 → 0.2.36

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 }: DynamicLayoutProps): JSX.Element;
3
+ declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents, customGridRows }: 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;
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, customGridRows = _a.customGridRows;
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; });
@@ -36,7 +36,8 @@ function DynamicLayout(_a) {
36
36
  navigationHandler: navigationHandler,
37
37
  sectionActionHandler: sectionActionHandler,
38
38
  editingSectionId: editingSectionId,
39
- programmedSectionComponents: programmedSectionComponents
39
+ programmedSectionComponents: programmedSectionComponents,
40
+ customGridRows: customGridRows
40
41
  } }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
41
42
  (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); })))] })));
42
43
  }
@@ -53,13 +53,9 @@ var ComponentBlockMatcher_1 = __importDefault(require("./components/ComponentBlo
53
53
  var util_1 = require("./util");
54
54
  var parseSectionPadding_1 = __importDefault(require("./util/layoutPropParsers/parseSectionPadding"));
55
55
  var Responsive = (0, publ_echo_1.WidthProvider)(publ_echo_1.ResponsiveGridEditor);
56
- var GRID_CELL_MIN = 24;
57
- var DESKTOP_GRID_COLS = 24;
58
- var MOBILE_GRID_COLS = 8;
59
- var GLE_MIN_WIDTH_DESKTOP_PX = "".concat(GRID_CELL_MIN * DESKTOP_GRID_COLS, "px");
60
- var GLE_MIN_WIDTH_MOBILE_PX = "".concat(GRID_CELL_MIN * MOBILE_GRID_COLS, "px");
56
+ var GRID_CELL_MIN = 8;
61
57
  function CustomSection(props) {
62
- var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, editingSectionId = _a.editingSectionId, mode = _a.mode, sectionActionHandler = _a.sectionActionHandler;
58
+ var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, editingSectionId = _a.editingSectionId, mode = _a.mode, sectionActionHandler = _a.sectionActionHandler, customGridRows = _a.customGridRows;
63
59
  var componentBlocks = props.componentBlocks, jsonProperties = props.jsonProperties;
64
60
  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;
65
61
  var _c = (0, react_1.useState)(null), selectedCB = _c[0], setSelectedCB = _c[1];
@@ -68,6 +64,19 @@ function CustomSection(props) {
68
64
  var _e = (0, react_1.useState)(16), baseFontSize = _e[0], setBaseFontSize = _e[1];
69
65
  var isMobile = device === 'MOBILE';
70
66
  var isEditMode = mode === 'EDIT';
67
+ var gridData = (0, react_1.useMemo)(function () {
68
+ var _a, _b;
69
+ var desktopCols = (_a = customGridRows === null || customGridRows === void 0 ? void 0 : customGridRows.lg) !== null && _a !== void 0 ? _a : 24;
70
+ var mobileCols = (_b = customGridRows === null || customGridRows === void 0 ? void 0 : customGridRows.sm) !== null && _b !== void 0 ? _b : 8;
71
+ var gleMinWidthDesktop = "".concat(GRID_CELL_MIN * desktopCols, "px");
72
+ var gleMinWidthMobile = "".concat(GRID_CELL_MIN * mobileCols, "px");
73
+ return {
74
+ desktopCols: desktopCols,
75
+ mobileCols: mobileCols,
76
+ gleMinWidthDesktop: gleMinWidthDesktop,
77
+ gleMinWidthMobile: gleMinWidthMobile
78
+ };
79
+ }, [customGridRows]);
71
80
  var _f = (0, react_1.useState)(function () {
72
81
  var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
73
82
  return {
@@ -170,13 +179,15 @@ function CustomSection(props) {
170
179
  // NOTE: local환경에서 CB_CONTENT_PROP_SECTION이 없는 경우가 있음.
171
180
  !!(CB_CONTENT_PROP_SECTION === null || CB_CONTENT_PROP_SECTION === void 0 ? void 0 : CB_CONTENT_PROP_SECTION.CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE);
172
181
  if (device === 'MOBILE') {
173
- var cellWidth_1 = width / MOBILE_GRID_COLS;
174
- setRowHeight(cellWidth_1 * 0.56);
182
+ var cellWidth_1 = width / gridData.mobileCols;
183
+ // setRowHeight(cellWidth * 0.56);
184
+ setRowHeight(cellWidth_1);
175
185
  baseFontSize !== 16 && setBaseFontSize(16);
176
186
  return;
177
187
  }
178
- var cellWidth = width / DESKTOP_GRID_COLS;
179
- setRowHeight(cellWidth * 0.56);
188
+ var cellWidth = width / gridData.desktopCols;
189
+ // setRowHeight(cellWidth * 0.56);
190
+ setRowHeight(cellWidth);
180
191
  responsiveFontMode ? setBaseFontSize(cellWidth / 2.35) : setBaseFontSize(16);
181
192
  };
182
193
  var padding = (0, parseSectionPadding_1.default)(CB_LAYOUT_PROP_PADDING, device);
@@ -187,9 +198,9 @@ function CustomSection(props) {
187
198
  paddingBottom: padding.bottom,
188
199
  paddingRight: padding.right,
189
200
  paddingLeft: padding.left
190
- } }, { children: (0, jsx_runtime_1.jsx)(Responsive, __assign({ allowOverlap: true, layouts: { lg: layouts.lg, sm: layouts.sm }, resizeHandles: ['nw', 'e', 'n', 'ne', 's', 'se', 'sw', 'w'], breakpoints: breakpoints, breakpoint: breakpoint, cols: { lg: 24, sm: 8 }, rowHeight: rowHeight, margin: [10, 10], style: {
201
+ } }, { children: (0, jsx_runtime_1.jsx)(Responsive, __assign({ allowOverlap: true, layouts: { lg: layouts.lg, sm: layouts.sm }, resizeHandles: ['nw', 'e', 'n', 'ne', 's', 'se', 'sw', 'w'], breakpoints: breakpoints, breakpoint: breakpoint, cols: { lg: gridData.desktopCols, sm: gridData.mobileCols }, rowHeight: rowHeight, margin: [0, 0], containerPadding: [0, 0], style: {
191
202
  width: customSectionStyles.width,
192
- minWidth: isMobile ? GLE_MIN_WIDTH_MOBILE_PX : GLE_MIN_WIDTH_DESKTOP_PX,
203
+ minWidth: isMobile ? gridData.gleMinWidthMobile : gridData.gleMinWidthDesktop,
193
204
  fontSize: "".concat(baseFontSize, "px")
194
205
  }, onLayoutChange: onLayoutChange, onDragStop: onDragStop, onResizeStop: onResizeStop, onWidthChange: onWidthChange, minNbRow: rows, isDraggable: isEditMode, isResizable: isEditMode }, { children: (componentBlocks === null || componentBlocks === void 0 ? void 0 : componentBlocks.length) ? (componentBlocks.map(function (each) { return ((0, jsx_runtime_1.jsx)("div", __assign({ className: selectedCB === each.id ? 'react-grid-item-selected' : '' }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
195
206
  width: '100%',
@@ -224,6 +224,10 @@ export type DynamicLayoutProps = {
224
224
  sectionActionHandler?: (action: TypeOfSectionAction) => void;
225
225
  programmedSectionComponents?: IProgrammedSectionComponents;
226
226
  width?: number;
227
+ customGridRows?: {
228
+ lg: number;
229
+ sm: number;
230
+ };
227
231
  };
228
232
  export type NavHandlerAction = {
229
233
  openNewTab: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # pds-dev-kit-web-test Release Notes
2
- ## [v0.2.34]
3
- ## 기준 pds-dev-kit-web 버전 @2.2.3
2
+ ## [v0.2.36]
3
+ ## 기준 pds-dev-kit-web 버전 @2.2.4
4
4
  ### sub
5
5
  * DynamicLayout - custom section
6
- * device판단하고 각 device에서 CB_EFFECT_PROP_ENTANIM_SPEC_TYPE이 NONE인지를 체크하여, 서로 영향을 받지 않고 NONE일 때만 hasEffect가 false일 수 있도록 조건을 변경
6
+ * gutter0으로 조정
7
+ * gridItem 관련 조정
8
+ * min cell width 8px
9
+ * height-width 1:1 ratio