pds-dev-kit-web 2.1.23 → 2.1.25
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/mock_customSection.js +3 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +13 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +18 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +12 -3
- package/dist/src/sub/DynamicLayout/types.d.ts +3 -0
- package/package.json +1 -1
- package/release-note.md +5 -4
|
@@ -75,6 +75,9 @@ exports.customSectionMock1 = {
|
|
|
75
75
|
template: undefined,
|
|
76
76
|
updatedAt: '2023-01-06T09:05:45',
|
|
77
77
|
jsonProperties: {
|
|
78
|
+
CB_CONTENT_PROP_SECTION: {
|
|
79
|
+
CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE: true
|
|
80
|
+
},
|
|
78
81
|
CB_CONTENT_PROP_VISIBILITY: {
|
|
79
82
|
CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
|
|
80
83
|
CB_CONTENT_PROP_VISIBILITY_SPEC_MOBILEWEB: true
|
|
@@ -488,7 +488,7 @@ exports.pages0803PreviewSections = [
|
|
|
488
488
|
CB_CONTENT_PROP_HOVER_SPEC_MUSE: false
|
|
489
489
|
},
|
|
490
490
|
CB_CONTENT_PROP_SECTION: {
|
|
491
|
-
CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE:
|
|
491
|
+
CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE: true
|
|
492
492
|
},
|
|
493
493
|
CB_CONTENT_PROP_VISIBILITY: {
|
|
494
494
|
CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
|
|
@@ -61,19 +61,20 @@ var GLE_MIN_WIDTH_MOBILE_PX = "".concat(GRID_CELL_MIN * MOBILE_GRID_COLS, "px");
|
|
|
61
61
|
function CustomSection(props) {
|
|
62
62
|
var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, editingSectionId = _a.editingSectionId, mode = _a.mode, sectionActionHandler = _a.sectionActionHandler;
|
|
63
63
|
var componentBlocks = props.componentBlocks, jsonProperties = props.jsonProperties;
|
|
64
|
-
var _b = jsonProperties, CB_PLACEMENT_PROP_SECTION = _b.CB_PLACEMENT_PROP_SECTION, CB_LAYOUT_PROP_PADDING = _b.CB_LAYOUT_PROP_PADDING;
|
|
64
|
+
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
65
|
var _c = (0, react_1.useState)(null), selectedCB = _c[0], setSelectedCB = _c[1];
|
|
66
66
|
var gleRef = (0, react_1.useRef)(null);
|
|
67
67
|
var _d = (0, react_1.useState)(50), rowHeight = _d[0], setRowHeight = _d[1];
|
|
68
|
+
var _e = (0, react_1.useState)(16), baseFontSize = _e[0], setBaseFontSize = _e[1];
|
|
68
69
|
var isMobile = device === 'MOBILE';
|
|
69
70
|
var isEditMode = mode === 'EDIT';
|
|
70
|
-
var
|
|
71
|
+
var _f = (0, react_1.useState)(function () {
|
|
71
72
|
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
|
|
72
73
|
return {
|
|
73
74
|
lg: lg,
|
|
74
75
|
sm: sm
|
|
75
76
|
};
|
|
76
|
-
}), layouts =
|
|
77
|
+
}), layouts = _f[0], setLayouts = _f[1];
|
|
77
78
|
(0, react_1.useEffect)(function () {
|
|
78
79
|
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
|
|
79
80
|
setLayouts({ lg: lg, sm: sm });
|
|
@@ -83,10 +84,10 @@ function CustomSection(props) {
|
|
|
83
84
|
setSelectedCB(null);
|
|
84
85
|
}
|
|
85
86
|
}, [editingSectionId]);
|
|
86
|
-
var
|
|
87
|
+
var _g = (0, util_1.parseCustomSectionPlacement)({
|
|
87
88
|
isMobile: isMobile,
|
|
88
89
|
customSectionProps: CB_PLACEMENT_PROP_SECTION
|
|
89
|
-
}), rows =
|
|
90
|
+
}), rows = _g.rows, width = _g.width, minHeight = _g.minHeight, isFullWidth = _g.isFullWidth;
|
|
90
91
|
var customSectionStyles = {
|
|
91
92
|
minHeight: "".concat(minHeight, "vh"),
|
|
92
93
|
width: isFullWidth ? '100%' : "".concat(width, "px")
|
|
@@ -165,13 +166,18 @@ function CustomSection(props) {
|
|
|
165
166
|
});
|
|
166
167
|
};
|
|
167
168
|
var onWidthChange = function (width) {
|
|
169
|
+
var responsiveFontMode =
|
|
170
|
+
// NOTE: local환경에서 CB_CONTENT_PROP_SECTION이 없는 경우가 있음.
|
|
171
|
+
!!(CB_CONTENT_PROP_SECTION === null || CB_CONTENT_PROP_SECTION === void 0 ? void 0 : CB_CONTENT_PROP_SECTION.CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE);
|
|
168
172
|
if (device === 'MOBILE') {
|
|
169
173
|
var cellWidth_1 = width / MOBILE_GRID_COLS;
|
|
170
174
|
setRowHeight(cellWidth_1 * 0.56);
|
|
175
|
+
baseFontSize !== 16 && setBaseFontSize(16);
|
|
171
176
|
return;
|
|
172
177
|
}
|
|
173
178
|
var cellWidth = width / DESKTOP_GRID_COLS;
|
|
174
179
|
setRowHeight(cellWidth * 0.56);
|
|
180
|
+
responsiveFontMode ? setBaseFontSize(cellWidth / 2.35) : setBaseFontSize(16);
|
|
175
181
|
};
|
|
176
182
|
var padding = (0, parseSectionPadding_1.default)(CB_LAYOUT_PROP_PADDING, device);
|
|
177
183
|
var breakpoints = device === 'DESKTOP' ? { lg: 100, sm: 0 } : { lg: 1200, sm: 480 };
|
|
@@ -183,7 +189,8 @@ function CustomSection(props) {
|
|
|
183
189
|
paddingLeft: padding.left
|
|
184
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: {
|
|
185
191
|
width: customSectionStyles.width,
|
|
186
|
-
minWidth: isMobile ? GLE_MIN_WIDTH_MOBILE_PX : GLE_MIN_WIDTH_DESKTOP_PX
|
|
192
|
+
minWidth: isMobile ? GLE_MIN_WIDTH_MOBILE_PX : GLE_MIN_WIDTH_DESKTOP_PX,
|
|
193
|
+
fontSize: "".concat(baseFontSize, "px")
|
|
187
194
|
}, 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: {
|
|
188
195
|
width: '100%',
|
|
189
196
|
height: '100%'
|
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -37,7 +48,7 @@ function Button(props) {
|
|
|
37
48
|
}), onClickCLINK = _c.onClickCLINK, CLINKCursor = _c.CLINKCursor;
|
|
38
49
|
var _d = getBTNStyles(props.CB_STYLE_PROP_BTNTEXT, device), btnTextStyle = _d.style, btnTextHoverStyle = _d.hoverStyle;
|
|
39
50
|
var _e = getBTNColorStyles(CB_STYLE_PROP_BTNCOLOR, device), btnColorStyle = _e.style, btnColorHoverStyle = _e.hoverStyle;
|
|
40
|
-
var _f = (0, util_1.parseProperties)(props, device), propsStyle = _f.style, propsHoverStyle = _f.hoverStyle,
|
|
51
|
+
var _f = (0, util_1.parseProperties)(props, device), propsStyle = _f.style, propsHoverStyle = _f.hoverStyle, _g = _f.layout, paddingLeft = _g.paddingLeft, paddingRight = _g.paddingRight, paddingTop = _g.paddingTop, paddingBottom = _g.paddingBottom, layoutStyle = __rest(_g, ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"]), effect = _f.effect;
|
|
41
52
|
var isEditModeAndHidden = propsStyle.visibility === 'hidden' && mode === 'EDIT';
|
|
42
53
|
if (mode === 'EDIT') {
|
|
43
54
|
propsStyle.visibility = 'visible';
|
|
@@ -49,7 +60,12 @@ function Button(props) {
|
|
|
49
60
|
var hasEffect = props.CB_EFFECT_PROP_ENTANIM.CB_EFFECT_PROP_ENTANIM_SPEC_TYPE !== 'NONE' &&
|
|
50
61
|
props.CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] !== 'NONE';
|
|
51
62
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
|
52
|
-
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
|
|
63
|
+
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: {
|
|
64
|
+
paddingLeft: paddingLeft,
|
|
65
|
+
paddingRight: paddingRight,
|
|
66
|
+
paddingBottom: paddingBottom,
|
|
67
|
+
paddingTop: paddingTop
|
|
68
|
+
} }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign(__assign({}, btnTextStyle), propsStyle), layoutStyle), effectCssProperties), btnColorStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor }), hoverStyle: __assign(__assign(__assign(__assign({}, btnTextHoverStyle), propsHoverStyle), btnColorHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device, onClick: onClickCLINK }, { children: props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT })) }))] }));
|
|
53
69
|
}
|
|
54
70
|
function getBTNStyles(props, device) {
|
|
55
71
|
var availableSpecCodes = [
|
|
@@ -66,14 +66,17 @@ function parseStyleTextToCSSProp(_a) {
|
|
|
66
66
|
}
|
|
67
67
|
if (cssPropertyKey === 'fontSize') {
|
|
68
68
|
if (hoverValue === null || hoverValue === undefined) {
|
|
69
|
+
var emValue_1 = getEmFontSize(device, value);
|
|
69
70
|
return {
|
|
70
|
-
style: __assign(__assign({}, acc.style), (_k = {}, _k[cssPropertyKey] =
|
|
71
|
+
style: __assign(__assign({}, acc.style), (_k = {}, _k[cssPropertyKey] = emValue_1, _k)),
|
|
71
72
|
hoverStyle: __assign({}, acc.hoverStyle)
|
|
72
73
|
};
|
|
73
74
|
}
|
|
75
|
+
var emValue = getEmFontSize(device, value);
|
|
76
|
+
var hoverEmValue = getEmFontSize(device, hoverValue);
|
|
74
77
|
return {
|
|
75
|
-
style: __assign(__assign({}, acc.style), (_l = {}, _l[cssPropertyKey] =
|
|
76
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_m = {}, _m[cssPropertyKey] =
|
|
78
|
+
style: __assign(__assign({}, acc.style), (_l = {}, _l[cssPropertyKey] = emValue, _l)),
|
|
79
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_m = {}, _m[cssPropertyKey] = hoverEmValue, _m))
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
if (cssPropertyKey === 'HORIZONTAL') {
|
|
@@ -198,3 +201,9 @@ function getVerticalPositionValue(value) {
|
|
|
198
201
|
return '';
|
|
199
202
|
}
|
|
200
203
|
}
|
|
204
|
+
function getEmFontSize(device, size) {
|
|
205
|
+
if (device === 'DESKTOP') {
|
|
206
|
+
return "".concat((size / 16).toFixed(3), "em");
|
|
207
|
+
}
|
|
208
|
+
return "".concat((size / 16).toFixed(3), "em");
|
|
209
|
+
}
|
|
@@ -295,6 +295,9 @@ export type IMembershipDisplay = {
|
|
|
295
295
|
connectedMemberships: IConnectedMembership[];
|
|
296
296
|
};
|
|
297
297
|
export type ISectionJsonProperties = {
|
|
298
|
+
CB_CONTENT_PROP_SECTION: {
|
|
299
|
+
CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE: boolean;
|
|
300
|
+
};
|
|
298
301
|
CB_CONTENT_PROP_VISIBILITY: CB_CONTENT_PROP_VISIBILITY_SPECS;
|
|
299
302
|
CB_EFFECT_PROP_ENTANIM: CB_EFFECT_PROP_ENTANIM_SPECS;
|
|
300
303
|
CB_LAYOUT_PROP_PADDING?: CB_LAYOUT_PROP_PADDING_SPECS;
|
package/package.json
CHANGED
package/release-note.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# PDS-DEV-KIT-WEB Release Notes
|
|
2
|
-
## [v2.1.
|
|
3
|
-
##
|
|
2
|
+
## [v2.1.25]
|
|
3
|
+
## urgent|https://design.storybook.publ.biz/
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
*
|
|
5
|
+
### sub
|
|
6
|
+
* DynamicLayout - custom section
|
|
7
|
+
* mobile 기준폰트 14px에서 16px로 변경
|