pds-dev-kit-web-test 2.5.445 → 2.5.448
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/CompositionEditor/CompositionEditor.d.ts +2 -1
- package/dist/src/sub/DynamicLayout/CompositionEditor/CompositionEditor.js +2 -2
- package/dist/src/sub/DynamicLayout/DynamicLayout.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/DynamicLayout.js +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.d.ts +6 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.js +10 -5
- package/dist/src/sub/DynamicLayout/types.d.ts +11 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TypeOfCompositionAction } from '../compositionActionTypes';
|
|
3
|
-
import type { CustomSectionShortcutKeysType, IComposition } from '../types';
|
|
3
|
+
import type { CustomSectionShortcutKeysType, IComposition, PlaceRestrictionType } from '../types';
|
|
4
4
|
import type { Layout } from 'publ-echo-test/dist/lib/GridLayoutEditor/types';
|
|
5
5
|
export type LayoutsType = {
|
|
6
6
|
sm: Layout;
|
|
@@ -10,6 +10,7 @@ export type CompositionEditorCanvasProps = {
|
|
|
10
10
|
device: 'DESKTOP' | 'MOBILE';
|
|
11
11
|
zoomScale: number;
|
|
12
12
|
shortcutKeyMode: CustomSectionShortcutKeysType | '';
|
|
13
|
+
placementRestriction?: PlaceRestrictionType;
|
|
13
14
|
compositionActionHandler: (action: TypeOfCompositionAction) => void;
|
|
14
15
|
};
|
|
15
16
|
export type CompositionEditorProps = {
|
|
@@ -73,7 +73,7 @@ var parseCompositionPlacement_1 = __importDefault(require("../sections/CustomSec
|
|
|
73
73
|
var Responsive = (0, publ_echo_test_1.WidthProvider)(publ_echo_test_1.ResponsiveGridEditor);
|
|
74
74
|
var CompositionEditor = (0, react_1.forwardRef)(function CompositionEditorCanvas(props, ref) {
|
|
75
75
|
var _a, _b, _c, _d;
|
|
76
|
-
var _e = props.editorProps, device = _e.device, shortcutKeyMode = _e.shortcutKeyMode, compositionActionHandler = _e.compositionActionHandler;
|
|
76
|
+
var _e = props.editorProps, device = _e.device, shortcutKeyMode = _e.shortcutKeyMode, placementRestriction = _e.placementRestriction, compositionActionHandler = _e.compositionActionHandler;
|
|
77
77
|
// const GLE_MIN_WIDTH_DESKTOP_PX = `${GRID_CELL_MIN * cols}px`;
|
|
78
78
|
// const GLE_MIN_WIDTH_MOBILE_PX = `${GRID_CELL_MIN * rows}px`;
|
|
79
79
|
var editingSectionId = props.compositionData.id;
|
|
@@ -100,7 +100,7 @@ var CompositionEditor = (0, react_1.forwardRef)(function CompositionEditorCanvas
|
|
|
100
100
|
var cols = isMobile ? colsMobile : colsDesktop;
|
|
101
101
|
var canvasWidth = 50 * cols;
|
|
102
102
|
var _o = (0, react_1.useState)(function () {
|
|
103
|
-
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : [], zOrders), lg = _a.lg, sm = _a.sm;
|
|
103
|
+
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : [], zOrders, placementRestriction), lg = _a.lg, sm = _a.sm;
|
|
104
104
|
return {
|
|
105
105
|
lg: lg,
|
|
106
106
|
sm: sm
|
|
@@ -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, shortcutKeyMode, dynamicLayoutRef, zoomScale, queryData }: DynamicLayoutProps): JSX.Element;
|
|
3
|
+
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents, shortcutKeyMode, dynamicLayoutRef, zoomScale, queryData, placementRestriction }: 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, shortcutKeyMode = _a.shortcutKeyMode, dynamicLayoutRef = _a.dynamicLayoutRef, zoomScale = _a.zoomScale, queryData = _a.queryData;
|
|
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, shortcutKeyMode = _a.shortcutKeyMode, dynamicLayoutRef = _a.dynamicLayoutRef, zoomScale = _a.zoomScale, queryData = _a.queryData, placementRestriction = _a.placementRestriction;
|
|
29
29
|
var filteredSortedSection = __spreadArray([], sections, true).filter(function (section) {
|
|
30
30
|
var _a;
|
|
31
31
|
if (!section.display) {
|
|
@@ -52,7 +52,8 @@ function DynamicLayout(_a) {
|
|
|
52
52
|
programmedSectionComponents: programmedSectionComponents,
|
|
53
53
|
shortcutKeyMode: shortcutKeyMode,
|
|
54
54
|
zoomScale: zoomScale,
|
|
55
|
-
queryData: queryData
|
|
55
|
+
queryData: queryData,
|
|
56
|
+
placementRestriction: placementRestriction
|
|
56
57
|
} }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { dynamicLayoutRef: dynamicLayoutRef, editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
|
|
57
58
|
(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); })))] })));
|
|
58
59
|
}
|
|
@@ -74,7 +74,7 @@ var GLE_MIN_WIDTH_DESKTOP_PX = "".concat(GRID_CELL_MIN * DESKTOP_GRID_COLS, "px"
|
|
|
74
74
|
var GLE_MIN_WIDTH_MOBILE_PX = "".concat(GRID_CELL_MIN * MOBILE_GRID_COLS, "px");
|
|
75
75
|
var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
76
76
|
var _a, _b, _c, _d;
|
|
77
|
-
var _e = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _e.device, editingSectionId = _e.editingSectionId, mode = _e.mode, shortcutKeyMode = _e.shortcutKeyMode, zoomScale = _e.zoomScale, sectionActionHandler = _e.sectionActionHandler;
|
|
77
|
+
var _e = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _e.device, editingSectionId = _e.editingSectionId, mode = _e.mode, shortcutKeyMode = _e.shortcutKeyMode, zoomScale = _e.zoomScale, placementRestriction = _e.placementRestriction, sectionActionHandler = _e.sectionActionHandler;
|
|
78
78
|
var componentBlocks = props.componentBlocks, jsonProperties = props.jsonProperties;
|
|
79
79
|
var sectionPedigree = jsonProperties === null || jsonProperties === void 0 ? void 0 : jsonProperties.pedigree;
|
|
80
80
|
var _f = (0, react_1.useState)(sectionPedigree), pedigreeState = _f[0], setPedigreeState = _f[1];
|
|
@@ -92,7 +92,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
92
92
|
var isEditMode = mode === 'EDIT';
|
|
93
93
|
var layoutByDevice = device === 'DESKTOP' ? 'lg' : 'sm';
|
|
94
94
|
var _m = (0, react_1.useState)(function () {
|
|
95
|
-
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : [], zOrders), lg = _a.lg, sm = _a.sm;
|
|
95
|
+
var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : [], zOrders, placementRestriction), lg = _a.lg, sm = _a.sm;
|
|
96
96
|
return {
|
|
97
97
|
lg: lg,
|
|
98
98
|
sm: sm
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentBlock } from '../types';
|
|
2
|
+
import type { PlaceRestrictionType } from '../../../../DynamicLayout/types';
|
|
2
3
|
import type { ZOrder } from 'publ-echo-test/dist/lib/GridLayoutEditor/group';
|
|
3
|
-
export declare function parsePlacement(components: ComponentBlock[], zOrders: ZOrder): {
|
|
4
|
+
export declare function parsePlacement(components: ComponentBlock[], zOrders: ZOrder, placementRestriction?: PlaceRestrictionType): {
|
|
4
5
|
sm: {
|
|
5
6
|
i: string;
|
|
6
7
|
x: number;
|
|
@@ -9,6 +10,8 @@ export declare function parsePlacement(components: ComponentBlock[], zOrders: ZO
|
|
|
9
10
|
h: number;
|
|
10
11
|
z: number;
|
|
11
12
|
autoResize: boolean;
|
|
13
|
+
minH: number;
|
|
14
|
+
minW: number;
|
|
12
15
|
}[];
|
|
13
16
|
lg: {
|
|
14
17
|
i: string;
|
|
@@ -18,6 +21,8 @@ export declare function parsePlacement(components: ComponentBlock[], zOrders: ZO
|
|
|
18
21
|
h: number;
|
|
19
22
|
z: number;
|
|
20
23
|
autoResize: boolean;
|
|
24
|
+
minH: number;
|
|
25
|
+
minW: number;
|
|
21
26
|
}[];
|
|
22
27
|
};
|
|
23
28
|
export default parsePlacement;
|
|
@@ -12,13 +12,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.parsePlacement = void 0;
|
|
14
14
|
var types_1 = require("../types");
|
|
15
|
-
function parsePlacement(components, zOrders) {
|
|
15
|
+
function parsePlacement(components, zOrders, placementRestriction) {
|
|
16
16
|
if (!zOrders) {
|
|
17
17
|
console.error('Z-ORDER NOT FOUND');
|
|
18
18
|
}
|
|
19
19
|
return components.reduce(function (acc, cur) {
|
|
20
20
|
var id = cur.id, jsonProperties = cur.jsonProperties, componentBlockCode = cur.componentBlockCode;
|
|
21
|
-
var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id, componentBlockCode, zOrders), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
|
|
21
|
+
var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id, componentBlockCode, zOrders, placementRestriction ? placementRestriction[componentBlockCode] : undefined), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
|
|
22
22
|
return {
|
|
23
23
|
sm: __spreadArray(__spreadArray([], acc.sm, true), [mobileLayout], false),
|
|
24
24
|
lg: __spreadArray(__spreadArray([], acc.lg, true), [desktopLayout], false)
|
|
@@ -26,7 +26,8 @@ function parsePlacement(components, zOrders) {
|
|
|
26
26
|
}, { sm: [], lg: [] });
|
|
27
27
|
}
|
|
28
28
|
exports.parsePlacement = parsePlacement;
|
|
29
|
-
function parsePropPlacement(props, id, cbCode, zOrders) {
|
|
29
|
+
function parsePropPlacement(props, id, cbCode, zOrders, cbRestriction) {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
30
31
|
var desktopLayout = {
|
|
31
32
|
i: id.toString(),
|
|
32
33
|
x: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX,
|
|
@@ -34,7 +35,9 @@ function parsePropPlacement(props, id, cbCode, zOrders) {
|
|
|
34
35
|
w: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS,
|
|
35
36
|
h: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS,
|
|
36
37
|
z: zOrders.desktop[id],
|
|
37
|
-
autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT || cbCode === types_1.CB_ALL_CODES.CB_LIST
|
|
38
|
+
autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT || cbCode === types_1.CB_ALL_CODES.CB_LIST,
|
|
39
|
+
minH: (_a = cbRestriction === null || cbRestriction === void 0 ? void 0 : cbRestriction.rowHMin) !== null && _a !== void 0 ? _a : 1,
|
|
40
|
+
minW: (_b = cbRestriction === null || cbRestriction === void 0 ? void 0 : cbRestriction.columnWMin) !== null && _b !== void 0 ? _b : 1
|
|
38
41
|
};
|
|
39
42
|
var mobileLayout = {
|
|
40
43
|
i: id.toString(),
|
|
@@ -43,7 +46,9 @@ function parsePropPlacement(props, id, cbCode, zOrders) {
|
|
|
43
46
|
w: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE'],
|
|
44
47
|
h: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'],
|
|
45
48
|
z: zOrders.mobile[id],
|
|
46
|
-
autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT || cbCode === types_1.CB_ALL_CODES.CB_LIST
|
|
49
|
+
autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT || cbCode === types_1.CB_ALL_CODES.CB_LIST,
|
|
50
|
+
minH: (_c = cbRestriction === null || cbRestriction === void 0 ? void 0 : cbRestriction.rowHMin) !== null && _c !== void 0 ? _c : 1,
|
|
51
|
+
minW: (_d = cbRestriction === null || cbRestriction === void 0 ? void 0 : cbRestriction.mobileColumnWMin) !== null && _d !== void 0 ? _d : 1
|
|
47
52
|
};
|
|
48
53
|
return {
|
|
49
54
|
mobileLayout: mobileLayout,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TypeOfSectionAction } from './sectionActionTypes';
|
|
2
|
-
import type { ComponentBlock } from './sections/CustomSection/types';
|
|
2
|
+
import type { CB_ALL_CODES, ComponentBlock } from './sections/CustomSection/types';
|
|
3
3
|
import type { CB_CONTENT_PROP_VISIBILITY_SPECS } from './sections/CustomSection/util/contentPropParsers/parseContentVisibility';
|
|
4
4
|
import type { CB_EFFECT_PROP_ENTANIM_SPECS } from './sections/CustomSection/util/effectPropParsers/parseEffectPropEntAnim';
|
|
5
5
|
import type { CB_LAYOUT_PROP_PADDING_SPECS } from './sections/CustomSection/util/layoutPropParsers/parseLayoutPropPadding';
|
|
@@ -237,7 +237,17 @@ export type DynamicLayoutProps = {
|
|
|
237
237
|
dynamicLayoutRef?: Ref<CustomSectionImperativeHandleRef>;
|
|
238
238
|
zoomScale?: number;
|
|
239
239
|
queryData?: QueryData;
|
|
240
|
+
placementRestriction?: PlaceRestrictionType;
|
|
240
241
|
};
|
|
242
|
+
export type PlaceRestrictionValue = {
|
|
243
|
+
columnWInit: number;
|
|
244
|
+
columnWMin: number;
|
|
245
|
+
mobileColumnWMax: number;
|
|
246
|
+
mobileColumnWMin: number;
|
|
247
|
+
rowHInit: number;
|
|
248
|
+
rowHMin: number;
|
|
249
|
+
};
|
|
250
|
+
export type PlaceRestrictionType = Record<CB_ALL_CODES, PlaceRestrictionValue>;
|
|
241
251
|
export type QueryData = {
|
|
242
252
|
[key: string]: Array<Record<string, unknown>>;
|
|
243
253
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pds-dev-kit-web-test",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.448",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lottie-react": "^2.3.1",
|
|
24
24
|
"nuka-carousel": "^4.8.4",
|
|
25
25
|
"publ-echo": "^0.0.119",
|
|
26
|
-
"publ-echo-test": "^0.0.
|
|
26
|
+
"publ-echo-test": "^0.0.232",
|
|
27
27
|
"react-hook-form": "^7.28.1",
|
|
28
28
|
"react-i18next": "^11.12.0",
|
|
29
29
|
"react-router-dom": "^5.2.0",
|