pds-dev-kit-web-test 2.3.10 → 2.3.12
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 +1 -8
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +9 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/NewCustomSection.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.d.ts +3 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.js +7 -4
- package/package.json +2 -2
@@ -61,14 +61,7 @@ type ActionHandlerPayload = {
|
|
61
61
|
id: string;
|
62
62
|
};
|
63
63
|
'@CUSTOMSECTION/AUTO_RESIZED_TO_FIT_CONTENT': {
|
64
|
-
|
65
|
-
cb: {
|
66
|
-
i: number;
|
67
|
-
h: number;
|
68
|
-
x: number;
|
69
|
-
y: number;
|
70
|
-
w: number;
|
71
|
-
};
|
64
|
+
item: LayoutItem;
|
72
65
|
};
|
73
66
|
};
|
74
67
|
type ActionMap<M extends {
|
@@ -320,6 +320,13 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
320
320
|
});
|
321
321
|
}
|
322
322
|
};
|
323
|
+
var onFitToContent = function (item) {
|
324
|
+
sectionActionHandler &&
|
325
|
+
sectionActionHandler({
|
326
|
+
type: '@CUSTOMSECTION/AUTO_RESIZED_TO_FIT_CONTENT',
|
327
|
+
payload: { item: item }
|
328
|
+
});
|
329
|
+
};
|
323
330
|
var onResizeStop = function (props) {
|
324
331
|
var prev = props.prev, item = props.item;
|
325
332
|
if (!isEditMode || !item) {
|
@@ -418,7 +425,6 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
418
425
|
}
|
419
426
|
makeCollisionOfBulk();
|
420
427
|
};
|
421
|
-
console.log(layouts[layoutByDevice][3]);
|
422
428
|
return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(exports.S_gleStyles, { children: (0, jsx_runtime_1.jsx)(S_SectionWrapper, __assign({ ref: gleRef, "x-dlayout-section-type": "NO_NAME", onClick: onClickSection }, { children: (0, jsx_runtime_1.jsx)(customSectionContext_1.CustomSectionContext.Provider, __assign({ value: { rowHeight: rowHeight, setLayouts: setLayouts, sectionActionHandler: sectionActionHandler } }, { children: (0, jsx_runtime_1.jsx)(components_1.CustomSection, __assign({}, props, { isMobile: isMobile, overrideStyles: {
|
423
429
|
minHeight: customSectionStyles.minHeight,
|
424
430
|
paddingTop: padding.top,
|
@@ -430,7 +436,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
430
436
|
maxWidth: customSectionStyles.maxWidth,
|
431
437
|
minWidth: isMobile ? exports.GLE_MIN_WIDTH_MOBILE_PX : exports.GLE_MIN_WIDTH_DESKTOP_PX,
|
432
438
|
fontSize: "".concat(baseFontSize, "px")
|
433
|
-
}, onLayoutChange: onLayoutChange, onDragStop: onDragStop, onResizeStop: onResizeStop, onWidthChange: onWidthChange, minNbRow: rows, isDraggable: isEditMode, isResizable: isEditMode }, { children: keepSimilarOrderToPreventRerender(layouts[layoutByDevice]).map(function (each, index) {
|
439
|
+
}, onLayoutChange: onLayoutChange, onDragStop: onDragStop, onResizeStop: onResizeStop, onWidthChange: onWidthChange, onFitToContent: onFitToContent, minNbRow: rows, isDraggable: isEditMode, isResizable: isEditMode }, { children: keepSimilarOrderToPreventRerender(layouts[layoutByDevice]).map(function (each, index) {
|
434
440
|
var _a;
|
435
441
|
if (each === null) {
|
436
442
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
@@ -444,7 +450,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
444
450
|
e.stopPropagation();
|
445
451
|
e.preventDefault();
|
446
452
|
onContextMenuCB('group', e);
|
447
|
-
} }, { children: (0, jsx_runtime_1.jsx)(WidthProvidedRGL, __assign({ cols: each.w, allowOverlap: true, layout: each.groupLayouts, rowHeight: rowHeight, containerPadding: [0, 0], margin: [exports.GUTTER, exports.GUTTER], isDraggable: false, isResizable: false, style: {
|
453
|
+
} }, { children: (0, jsx_runtime_1.jsx)(WidthProvidedRGL, __assign({ onFitToContent: onFitToContent, cols: each.w, allowOverlap: true, layout: each.groupLayouts, rowHeight: rowHeight, containerPadding: [0, 0], margin: [exports.GUTTER, exports.GUTTER], isDraggable: false, isResizable: false, style: {
|
448
454
|
width: '100%'
|
449
455
|
} }, { children: (_a = each.groupLayouts) === null || _a === void 0 ? void 0 : _a.map(function (layoutItem, index, array) {
|
450
456
|
var matchedCB = componentBlocks === null || componentBlocks === void 0 ? void 0 : componentBlocks.find(function (cb) { return cb.id.toString() === layoutItem.i; });
|
@@ -48,7 +48,7 @@ function NewCustomSection() {
|
|
48
48
|
// const placeholder = document.querySelector('.react-grid-placeholder')
|
49
49
|
// placeholder.height = 100;
|
50
50
|
}
|
51
|
-
return ((0, jsx_runtime_1.jsx)(CustomSection_1.S_gleStyles, __assign({ style: { backgroundColor: 'white' } }, { children: (0, jsx_runtime_1.jsx)(ReactGridLayout_1.default, __assign({ layout: layout,
|
51
|
+
return ((0, jsx_runtime_1.jsx)(CustomSection_1.S_gleStyles, __assign({ style: { backgroundColor: 'white' } }, { children: (0, jsx_runtime_1.jsx)(ReactGridLayout_1.default, __assign({ layout: layout, onFitToContent: function () { return ({}); },
|
52
52
|
// onLayoutChange={onLayoutChange}
|
53
53
|
allowOverlap: true, margin: [50, 50], cols: 12, rowHeight: 30, width: 1200, resizeHandles: ['n', 'e', 'w', 'sw', 'se', 's', 'nw', 'ne'] }, { children: layout.map(function (item, index) { return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(MeasuredCB, { text: item.text, onSizeChange: function (size) { return onSizeChange(size, index); } }) }, item.i)); }) })) })));
|
54
54
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type
|
1
|
+
import { type ComponentBlock } from '../types';
|
2
2
|
export declare function parsePlacement(components: ComponentBlock[]): {
|
3
3
|
sm: {
|
4
4
|
i: string;
|
@@ -7,6 +7,7 @@ export declare function parsePlacement(components: ComponentBlock[]): {
|
|
7
7
|
w: number;
|
8
8
|
h: number;
|
9
9
|
z: number;
|
10
|
+
fitToContent: boolean;
|
10
11
|
}[];
|
11
12
|
lg: {
|
12
13
|
i: string;
|
@@ -15,6 +16,7 @@ export declare function parsePlacement(components: ComponentBlock[]): {
|
|
15
16
|
w: number;
|
16
17
|
h: number;
|
17
18
|
z: number;
|
19
|
+
fitToContent: boolean;
|
18
20
|
}[];
|
19
21
|
};
|
20
22
|
export default parsePlacement;
|
@@ -10,10 +10,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.parsePlacement = void 0;
|
13
|
+
var types_1 = require("../types");
|
13
14
|
function parsePlacement(components) {
|
14
15
|
return components.reduce(function (acc, cur) {
|
15
16
|
var id = cur.id, jsonProperties = cur.jsonProperties;
|
16
|
-
var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
|
17
|
+
var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id, cur.componentBlockCode === types_1.CB_ALL_CODES.CB_TEXT), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
|
17
18
|
return {
|
18
19
|
sm: __spreadArray(__spreadArray([], acc.sm, true), [mobileLayout], false),
|
19
20
|
lg: __spreadArray(__spreadArray([], acc.lg, true), [desktopLayout], false)
|
@@ -21,14 +22,15 @@ function parsePlacement(components) {
|
|
21
22
|
}, { sm: [], lg: [] });
|
22
23
|
}
|
23
24
|
exports.parsePlacement = parsePlacement;
|
24
|
-
function parsePropPlacement(props, id) {
|
25
|
+
function parsePropPlacement(props, id, fitToContent) {
|
25
26
|
var desktopLayout = {
|
26
27
|
i: id.toString(),
|
27
28
|
x: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX,
|
28
29
|
y: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY,
|
29
30
|
w: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS,
|
30
31
|
h: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS,
|
31
|
-
z: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX + 500
|
32
|
+
z: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX + 500,
|
33
|
+
fitToContent: fitToContent
|
32
34
|
};
|
33
35
|
var mobileLayout = {
|
34
36
|
i: id.toString(),
|
@@ -36,7 +38,8 @@ function parsePropPlacement(props, id) {
|
|
36
38
|
y: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY:MOBILE'],
|
37
39
|
w: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE'],
|
38
40
|
h: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'],
|
39
|
-
z: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX:MOBILE'] + 500
|
41
|
+
z: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX:MOBILE'] + 500,
|
42
|
+
fitToContent: fitToContent
|
40
43
|
};
|
41
44
|
return {
|
42
45
|
mobileLayout: mobileLayout,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pds-dev-kit-web-test",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.12",
|
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.
|
25
|
+
"publ-echo": "^0.0.85",
|
26
26
|
"react-hook-form": "^7.28.1",
|
27
27
|
"react-i18next": "^11.12.0",
|
28
28
|
"react-measure": "^2.5.2",
|