pds-dev-kit-web-test 0.2.15 → 0.2.17
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/DynamicLayout.js +1 -0
- package/dist/src/sub/DynamicLayout/components/Section/CustomSection.d.ts +2 -1
- package/dist/src/sub/DynamicLayout/components/Section/CustomSection.js +2 -4
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.d.ts +1 -2
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.js +14 -50
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.d.ts +5 -3
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +87 -57
- package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.d.ts +1 -4
- package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.js +3 -12
- package/dist/src/sub/DynamicLayout/components/YouTubeIframe/YouTubeIframe.js +4 -2
- package/dist/src/sub/DynamicLayout/mock_customSection.js +23 -7
- package/dist/src/sub/DynamicLayout/mock_samplePage.js +1650 -762
- package/dist/src/sub/DynamicLayout/nakedMocks.json +8 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +645 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1661 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +70 -24
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +7 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +3 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/btnTypes.d.ts +50 -42
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +22 -44
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/types.d.ts +6 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/RichText/types.d.ts +24 -24
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +7 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/types.d.ts +30 -20
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/types.d.ts +24 -24
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.js +7 -13
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/hooks/useCLINK.js +3 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/colorUtil.js +6 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/replaceUndefinedValues.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +100 -13
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.d.ts +23 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.js +26 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.d.ts +9 -9
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.js +15 -28
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.js +2 -7
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.d.ts +24 -24
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.js +4 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgImage.d.ts +6 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgImage.js +18 -56
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.d.ts +26 -26
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.js +6 -12
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.d.ts +5 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.js +16 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropDivider.d.ts +9 -9
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropDivider.js +17 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropImage.d.ts +6 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropImage.js +30 -54
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.d.ts +3 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.js +9 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.d.ts +21 -21
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.js +7 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.d.ts +2 -33
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.js +27 -16
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/types.d.ts +4 -4
- package/dist/src/sub/DynamicLayout/types.d.ts +37 -37
- package/package.json +2 -2
|
@@ -15,7 +15,7 @@ exports.getTextCSSPropKey = exports.parseStyleTextToCSSProp = void 0;
|
|
|
15
15
|
function parseStyleTextToCSSProp(_a) {
|
|
16
16
|
var availableSpecCodes = _a.availableSpecCodes, props = _a.props, propKey = _a.propKey, device = _a.device;
|
|
17
17
|
return availableSpecCodes.reduce(function (acc, currentKey) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
19
19
|
var stringifiedKey = currentKey.toString();
|
|
20
20
|
var keyWithDevice = device === 'DESKTOP' ? currentKey : stringifiedKey + ":MOBILE" || currentKey;
|
|
21
21
|
var keyWithHover = keyWithDevice.toString() + ":HOVER";
|
|
@@ -25,34 +25,87 @@ function parseStyleTextToCSSProp(_a) {
|
|
|
25
25
|
if (cssPropertyKey === 'lineHeight') {
|
|
26
26
|
var numValue = typeof value === 'number' ? value / 100 : value;
|
|
27
27
|
var numHoverValue = typeof hoverValue === 'number' ? hoverValue / 100 : hoverValue;
|
|
28
|
+
if (numHoverValue === null || numHoverValue === undefined) {
|
|
29
|
+
return {
|
|
30
|
+
style: __assign(__assign({}, acc.style), (_a = {}, _a[cssPropertyKey] = numValue, _a)),
|
|
31
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
28
34
|
return {
|
|
29
|
-
style: __assign(__assign({}, acc.style), (
|
|
30
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (
|
|
35
|
+
style: __assign(__assign({}, acc.style), (_b = {}, _b[cssPropertyKey] = numValue, _b)),
|
|
36
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_c = {}, _c[cssPropertyKey] = numHoverValue, _c))
|
|
31
37
|
};
|
|
32
38
|
}
|
|
33
39
|
if (cssPropertyKey === 'fontFamily') {
|
|
40
|
+
if (hoverValue === null || hoverValue === undefined) {
|
|
41
|
+
return {
|
|
42
|
+
style: __assign(__assign({}, acc.style), (_d = {}, _d[cssPropertyKey] = getFontName(String(value)), _d)),
|
|
43
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
34
46
|
return {
|
|
35
|
-
style: __assign(__assign({}, acc.style), (
|
|
36
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (
|
|
47
|
+
style: __assign(__assign({}, acc.style), (_e = {}, _e[cssPropertyKey] = getFontName(String(value)), _e)),
|
|
48
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_f = {}, _f[cssPropertyKey] = getFontName(String(hoverValue)), _f))
|
|
37
49
|
};
|
|
38
50
|
}
|
|
39
51
|
if (cssPropertyKey === 'letterSpacing') {
|
|
40
|
-
var numValue =
|
|
41
|
-
var numHoverValue =
|
|
52
|
+
var numValue = Math.abs(+value) * (+value > 0 ? 0.01 : -0.01) + "em";
|
|
53
|
+
var numHoverValue = Math.abs(+hoverValue) * (+hoverValue > 0 ? 0.01 : -0.01) + "em";
|
|
54
|
+
if (numHoverValue === null || numHoverValue === undefined) {
|
|
55
|
+
return {
|
|
56
|
+
style: __assign(__assign({}, acc.style), (_g = {}, _g[cssPropertyKey] = numValue, _g)),
|
|
57
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
42
60
|
return {
|
|
43
|
-
style: __assign(__assign({}, acc.style), (
|
|
44
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (
|
|
61
|
+
style: __assign(__assign({}, acc.style), (_h = {}, _h[cssPropertyKey] = numValue, _h)),
|
|
62
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_j = {}, _j[cssPropertyKey] = numHoverValue, _j))
|
|
45
63
|
};
|
|
46
64
|
}
|
|
47
65
|
if (cssPropertyKey === 'fontSize') {
|
|
66
|
+
if (hoverValue === null || hoverValue === undefined) {
|
|
67
|
+
return {
|
|
68
|
+
style: __assign(__assign({}, acc.style), (_k = {}, _k[cssPropertyKey] = value + "px", _k)),
|
|
69
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
48
72
|
return {
|
|
49
|
-
style: __assign(__assign({}, acc.style), (
|
|
50
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (
|
|
73
|
+
style: __assign(__assign({}, acc.style), (_l = {}, _l[cssPropertyKey] = value + "px", _l)),
|
|
74
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_m = {}, _m[cssPropertyKey] = hoverValue + "px", _m))
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (cssPropertyKey === 'HORIZONTAL') {
|
|
78
|
+
var horizontalObj = getHorizontalPositionValue(String(value));
|
|
79
|
+
var hoverHorizontalObj = getHorizontalPositionValue(String(hoverValue));
|
|
80
|
+
if (hoverHorizontalObj === null || hoverHorizontalObj === undefined) {
|
|
81
|
+
return { style: __assign(__assign({}, acc.style), horizontalObj), hoverStyle: __assign({}, acc.hoverStyle) };
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
style: __assign(__assign({}, acc.style), horizontalObj),
|
|
85
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), hoverHorizontalObj)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (cssPropertyKey === 'alignItems') {
|
|
89
|
+
if (hoverValue === null || hoverValue === undefined) {
|
|
90
|
+
return {
|
|
91
|
+
style: __assign(__assign({}, acc.style), (_o = {}, _o[cssPropertyKey] = getVerticalPositionValue(String(value)), _o)),
|
|
92
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
style: __assign(__assign({}, acc.style), (_p = {}, _p[cssPropertyKey] = getVerticalPositionValue(String(value)), _p)),
|
|
97
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_q = {}, _q[cssPropertyKey] = getVerticalPositionValue(String(hoverValue)), _q))
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (hoverValue === null || hoverValue === undefined) {
|
|
101
|
+
return {
|
|
102
|
+
style: __assign(__assign({}, acc.style), (_r = {}, _r[cssPropertyKey] = value, _r)),
|
|
103
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
51
104
|
};
|
|
52
105
|
}
|
|
53
106
|
return {
|
|
54
|
-
style: __assign(__assign({}, acc.style), (
|
|
55
|
-
hoverStyle: __assign(__assign({}, acc.hoverStyle), (
|
|
107
|
+
style: __assign(__assign({}, acc.style), (_s = {}, _s[cssPropertyKey] = value, _s)),
|
|
108
|
+
hoverStyle: __assign(__assign({}, acc.hoverStyle), (_t = {}, _t[cssPropertyKey] = hoverValue, _t))
|
|
56
109
|
};
|
|
57
110
|
}, {
|
|
58
111
|
style: {},
|
|
@@ -92,6 +145,16 @@ function getTextCSSPropKey(key, cbName) {
|
|
|
92
145
|
case "CB_STYLE_PROP_" + cbName + "_SPEC_WEIGHT:MOBILE":
|
|
93
146
|
case "CB_STYLE_PROP_" + cbName + "_SPEC_WEIGHT:MOBILE:HOVER":
|
|
94
147
|
return 'fontWeight';
|
|
148
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_HORIZONTAL":
|
|
149
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_HORIZONTAL:HOVER":
|
|
150
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_HORIZONTAL:MOBILE":
|
|
151
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_HORIZONTAL:MOBILE:HOVER":
|
|
152
|
+
return 'HORIZONTAL';
|
|
153
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_VERTICAL":
|
|
154
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_VERTICAL:HOVER":
|
|
155
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_VERTICAL:MOBILE":
|
|
156
|
+
case "CB_STYLE_PROP_" + cbName + "_SPEC_VERTICAL:MOBILE:HOVER":
|
|
157
|
+
return 'alignItems';
|
|
95
158
|
default:
|
|
96
159
|
return '';
|
|
97
160
|
}
|
|
@@ -109,3 +172,27 @@ function getFontName(value) {
|
|
|
109
172
|
return '';
|
|
110
173
|
}
|
|
111
174
|
}
|
|
175
|
+
function getHorizontalPositionValue(value) {
|
|
176
|
+
switch (value) {
|
|
177
|
+
case 'LEFT':
|
|
178
|
+
return { justifyContent: 'flex-start', textAlign: 'left' };
|
|
179
|
+
case 'RIGHT':
|
|
180
|
+
return { justifyContent: 'flex-end', textAlign: 'right' };
|
|
181
|
+
case 'CENTER':
|
|
182
|
+
return { justifyContent: 'center', textAlign: 'center' };
|
|
183
|
+
default:
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function getVerticalPositionValue(value) {
|
|
188
|
+
switch (value) {
|
|
189
|
+
case 'TOP':
|
|
190
|
+
return 'flex-start';
|
|
191
|
+
case 'BOTTOM':
|
|
192
|
+
return 'flex-end';
|
|
193
|
+
case 'MIDDLE':
|
|
194
|
+
return 'center';
|
|
195
|
+
default:
|
|
196
|
+
return '';
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -14,7 +14,7 @@ export declare type NAMED_CB_LAYOUT_ARRANGE_PROPS = {
|
|
|
14
14
|
};
|
|
15
15
|
export default function parseLayoutPropArrange(namedProps: NAMED_CB_LAYOUT_ARRANGE_PROPS, device: Device): StyleType;
|
|
16
16
|
declare type CB_LAYOUT_PROP_ARRANGE_ENUM_VERTICAL = 'TOP' | 'MIDDLE' | 'BOTTOM';
|
|
17
|
-
declare type CB_LAYOUT_PROP_ARRANGE_ENUM_HORIZONTAL = '
|
|
17
|
+
declare type CB_LAYOUT_PROP_ARRANGE_ENUM_HORIZONTAL = 'START' | 'CENTER' | 'END';
|
|
18
18
|
export declare type CB_LAYOUT_PROP_ARRANGE_SPECS = {
|
|
19
19
|
[CB_LAYOUT_PROP_ARRANGE_BASE_KEYS.CB_LAYOUT_PROP_ARRANGE_SPEC_VERTICAL]: CB_LAYOUT_PROP_ARRANGE_ENUM_VERTICAL;
|
|
20
20
|
[CB_LAYOUT_PROP_ARRANGE_BASE_KEYS.CB_LAYOUT_PROP_ARRANGE_SPEC_HORIZONTAL]: CB_LAYOUT_PROP_ARRANGE_ENUM_HORIZONTAL;
|
|
@@ -58,7 +58,7 @@ function getCssProperties(value) {
|
|
|
58
58
|
flexDirection: 'column',
|
|
59
59
|
justifyContent: 'flex-end'
|
|
60
60
|
};
|
|
61
|
-
case '
|
|
61
|
+
case 'START':
|
|
62
62
|
return {
|
|
63
63
|
display: 'flex',
|
|
64
64
|
flexDirection: 'column',
|
|
@@ -70,7 +70,7 @@ function getCssProperties(value) {
|
|
|
70
70
|
flexDirection: 'column',
|
|
71
71
|
alignItems: 'center'
|
|
72
72
|
};
|
|
73
|
-
case '
|
|
73
|
+
case 'END':
|
|
74
74
|
return {
|
|
75
75
|
display: 'flex',
|
|
76
76
|
flexDirection: 'column',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Device } from '../types';
|
|
2
|
+
declare type Padding = {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
};
|
|
8
|
+
export declare type SectionPadding = {
|
|
9
|
+
CB_LAYOUT_PROP_PADDING_SPEC_PADDING: Padding;
|
|
10
|
+
'CB_LAYOUT_PROP_PADDING_SPEC_PADDING:MOBILE': null | Padding;
|
|
11
|
+
} | undefined | null;
|
|
12
|
+
declare function parseSectionPadding(prop: SectionPadding, device: Device): {
|
|
13
|
+
top?: undefined;
|
|
14
|
+
left?: undefined;
|
|
15
|
+
bottom?: undefined;
|
|
16
|
+
right?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
top: number;
|
|
19
|
+
left: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
right: number;
|
|
22
|
+
};
|
|
23
|
+
export default parseSectionPadding;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function parseSectionPadding(prop, device) {
|
|
4
|
+
if (!prop) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
if (device === 'MOBILE') {
|
|
8
|
+
var padding_1 = prop['CB_LAYOUT_PROP_PADDING_SPEC_PADDING:MOBILE'];
|
|
9
|
+
if (padding_1) {
|
|
10
|
+
return {
|
|
11
|
+
top: padding_1.top,
|
|
12
|
+
left: padding_1.left,
|
|
13
|
+
bottom: padding_1.bottom,
|
|
14
|
+
right: padding_1.right
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var padding = prop.CB_LAYOUT_PROP_PADDING_SPEC_PADDING;
|
|
19
|
+
return {
|
|
20
|
+
top: padding.top,
|
|
21
|
+
left: padding.left,
|
|
22
|
+
bottom: padding.bottom,
|
|
23
|
+
right: padding.right
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.default = parseSectionPadding;
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
declare type Props = {
|
|
2
2
|
isMobile: boolean;
|
|
3
|
-
customSectionProps
|
|
3
|
+
customSectionProps: {
|
|
4
4
|
CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH: boolean;
|
|
5
|
-
'CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH:MOBILE': boolean | undefined;
|
|
5
|
+
'CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH:MOBILE': boolean | null | undefined;
|
|
6
6
|
CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT: number;
|
|
7
|
-
'CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT:MOBILE': number | undefined;
|
|
7
|
+
'CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT:MOBILE': number | null | undefined;
|
|
8
8
|
CB_PLACEMENT_PROP_SECTION_SPEC_ROWS: number;
|
|
9
|
-
'CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE': number | undefined;
|
|
9
|
+
'CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE': number | null | undefined;
|
|
10
10
|
CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH: number;
|
|
11
|
-
'CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH:MOBILE': number | undefined;
|
|
11
|
+
'CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH:MOBILE': number | null | undefined;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
export declare function parseCustomSectionPlacement({ isMobile, customSectionProps }: Props): {
|
|
15
|
-
minHeight: number
|
|
16
|
-
width: number
|
|
17
|
-
rows: number
|
|
18
|
-
isFullWidth: boolean
|
|
15
|
+
minHeight: number;
|
|
16
|
+
width: number;
|
|
17
|
+
rows: number;
|
|
18
|
+
isFullWidth: boolean;
|
|
19
19
|
};
|
|
20
20
|
export default parseCustomSectionPlacement;
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.js
CHANGED
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.parseCustomSectionPlacement = void 0;
|
|
7
|
-
var isNullOrUndefined_1 = __importDefault(require("./isNullOrUndefined"));
|
|
8
4
|
function parseCustomSectionPlacement(_a) {
|
|
5
|
+
var _b, _c, _d, _e;
|
|
9
6
|
var isMobile = _a.isMobile, customSectionProps = _a.customSectionProps;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
!(0, isNullOrUndefined_1.default)(customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH:MOBILE'])
|
|
18
|
-
? customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH:MOBILE']
|
|
19
|
-
: customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH,
|
|
20
|
-
rows: isMobile &&
|
|
21
|
-
!(0, isNullOrUndefined_1.default)(customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE'])
|
|
22
|
-
? customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE']
|
|
23
|
-
: customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_ROWS,
|
|
24
|
-
isFullWidth: isMobile &&
|
|
25
|
-
!(0, isNullOrUndefined_1.default)(customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH:MOBILE'])
|
|
26
|
-
? customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH:MOBILE']
|
|
27
|
-
: customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH
|
|
28
|
-
}
|
|
29
|
-
: {
|
|
30
|
-
minHeight: 0,
|
|
31
|
-
width: 0,
|
|
32
|
-
rows: 0,
|
|
33
|
-
isFullWidth: true
|
|
7
|
+
var CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH = customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH, CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT = customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT, CB_PLACEMENT_PROP_SECTION_SPEC_ROWS = customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_ROWS, CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH = customSectionProps.CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH;
|
|
8
|
+
if (isMobile) {
|
|
9
|
+
return {
|
|
10
|
+
minHeight: (_b = customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT:MOBILE']) !== null && _b !== void 0 ? _b : CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT,
|
|
11
|
+
width: (_c = customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH:MOBILE']) !== null && _c !== void 0 ? _c : CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH,
|
|
12
|
+
rows: (_d = customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE']) !== null && _d !== void 0 ? _d : CB_PLACEMENT_PROP_SECTION_SPEC_ROWS,
|
|
13
|
+
isFullWidth: (_e = customSectionProps['CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH:MOBILE']) !== null && _e !== void 0 ? _e : CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH
|
|
34
14
|
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
minHeight: CB_PLACEMENT_PROP_SECTION_SPEC_MINHEIGHT,
|
|
18
|
+
width: CB_PLACEMENT_PROP_SECTION_SPEC_WIDTH,
|
|
19
|
+
rows: CB_PLACEMENT_PROP_SECTION_SPEC_ROWS,
|
|
20
|
+
isFullWidth: CB_PLACEMENT_PROP_SECTION_SPEC_FULLWIDTH
|
|
21
|
+
};
|
|
35
22
|
}
|
|
36
23
|
exports.parseCustomSectionPlacement = parseCustomSectionPlacement;
|
|
37
24
|
exports.default = parseCustomSectionPlacement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Device,
|
|
1
|
+
import type { Device, JsonPropertiesParserResult } from './types';
|
|
2
2
|
import type { ISectionJsonProperties } from '../../../../DynamicLayout/types';
|
|
3
|
-
export default function parseJsonProperties(properties: ISectionJsonProperties | undefined, device: Device):
|
|
3
|
+
export default function parseJsonProperties(properties: ISectionJsonProperties | undefined, device: Device): JsonPropertiesParserResult;
|
|
@@ -19,14 +19,11 @@ var layoutPropParsers_1 = require("./layoutPropParsers");
|
|
|
19
19
|
var types_3 = require("./layoutPropParsers/types");
|
|
20
20
|
var stylePropParsers_1 = require("./stylePropParsers");
|
|
21
21
|
var types_4 = require("./stylePropParsers/types");
|
|
22
|
-
// export type specTypes = CB_LAYOUT_PROP_KEYS | CB_STYLE_PROP_KEYS;
|
|
23
22
|
function parseJsonProperties(properties, device) {
|
|
24
23
|
if (!properties) {
|
|
25
24
|
return {
|
|
26
25
|
style: {},
|
|
27
26
|
overlayStyle: {},
|
|
28
|
-
overlayHoverStyle: {},
|
|
29
|
-
hoverStyle: {},
|
|
30
27
|
layout: {},
|
|
31
28
|
effect: {},
|
|
32
29
|
content: {}
|
|
@@ -39,9 +36,9 @@ function parseJsonProperties(properties, device) {
|
|
|
39
36
|
specs: specs
|
|
40
37
|
};
|
|
41
38
|
if (normalizedProperty.name in types_4.CB_STYLE_PROP_KEYS) {
|
|
42
|
-
var _a = (0, stylePropParsers_1.parseStyleProperties)(normalizedProperty, device), style = _a.style,
|
|
39
|
+
var _a = (0, stylePropParsers_1.parseStyleProperties)(normalizedProperty, device), style = _a.style, overlayStyle = _a.overlayStyle;
|
|
43
40
|
// console.log(normalizedProperty.name, ' >>>', overlayStyle, overlayHoverStyle);
|
|
44
|
-
return __assign(__assign({}, acc), { style: __assign(__assign({}, acc.style), style),
|
|
41
|
+
return __assign(__assign({}, acc), { style: __assign(__assign({}, acc.style), style), overlayStyle: __assign(__assign({}, acc.overlayStyle), overlayStyle) });
|
|
45
42
|
}
|
|
46
43
|
if (normalizedProperty.name in types_3.CB_LAYOUT_PROP_KEYS) {
|
|
47
44
|
var style = (0, layoutPropParsers_1.parseLayoutProperties)(normalizedProperty, device).style;
|
|
@@ -62,8 +59,6 @@ function parseJsonProperties(properties, device) {
|
|
|
62
59
|
}, {
|
|
63
60
|
style: {},
|
|
64
61
|
overlayStyle: {},
|
|
65
|
-
overlayHoverStyle: {},
|
|
66
|
-
hoverStyle: {},
|
|
67
62
|
layout: {},
|
|
68
63
|
effect: {},
|
|
69
64
|
content: {}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { NamedStylePropType } from './types';
|
|
2
|
-
import type { Device,
|
|
3
|
-
export declare function parseStyleProperties(normalizedProperty: NamedStylePropType, device: Device): StyleAndHoverStyle & Partial<
|
|
2
|
+
import type { Device, OverlayStyle, StyleAndHoverStyle } from '../types';
|
|
3
|
+
export declare function parseStyleProperties(normalizedProperty: NamedStylePropType, device: Device): StyleAndHoverStyle & Partial<OverlayStyle>;
|
|
@@ -35,7 +35,7 @@ function parseStyleProperties(normalizedProperty, device) {
|
|
|
35
35
|
case types_1.CB_STYLE_PROP_KEYS.CB_STYLE_PROP_BGOVERLAY:
|
|
36
36
|
return (0, parseStylePropBgOverlay_1.default)(normalizedProperty, device);
|
|
37
37
|
default:
|
|
38
|
-
return { style: {}, hoverStyle: {}, overlayStyle: {}
|
|
38
|
+
return { style: {}, hoverStyle: {}, overlayStyle: {} };
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.parseStyleProperties = parseStyleProperties;
|
|
@@ -16,28 +16,28 @@ export declare type CB_STYLE_PROP_BGCOLOR_SPECS_BASE = {
|
|
|
16
16
|
CB_STYLE_PROP_BGCOLOR_SPEC_TYPE: ENUM_STRING;
|
|
17
17
|
};
|
|
18
18
|
export declare type CB_STYLE_PROP_BGCOLOR_SPECS = CB_STYLE_PROP_BGCOLOR_SPECS_BASE & {
|
|
19
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:HOVER': NUMBER_INTEGER;
|
|
20
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:MOBILE': NUMBER_INTEGER | undefined;
|
|
21
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:MOBILE:HOVER': NUMBER_INTEGER | undefined;
|
|
22
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:HOVER': STRING_8DIGIT_HEX;
|
|
23
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:MOBILE': STRING_8DIGIT_HEX | undefined;
|
|
24
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | undefined;
|
|
25
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:HOVER': STRING_8DIGIT_HEX;
|
|
26
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:MOBILE': STRING_8DIGIT_HEX | undefined;
|
|
27
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | undefined;
|
|
28
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:HOVER': NUMBER_INTEGER;
|
|
29
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:MOBILE': NUMBER_INTEGER | undefined;
|
|
30
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:MOBILE:HOVER': NUMBER_INTEGER | undefined;
|
|
31
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:HOVER': ENUM_STRING;
|
|
32
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:MOBILE': ENUM_STRING | undefined;
|
|
33
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:MOBILE:HOVER': ENUM_STRING | undefined;
|
|
34
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:HOVER': STRING_8DIGIT_HEX;
|
|
35
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:MOBILE': STRING_8DIGIT_HEX | undefined;
|
|
36
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | undefined;
|
|
37
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:HOVER': NUMBER_INTEGER;
|
|
38
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:MOBILE': NUMBER_INTEGER | undefined;
|
|
39
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:MOBILE:HOVER': NUMBER_INTEGER | undefined;
|
|
40
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:HOVER': ENUM_STRING;
|
|
41
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:MOBILE': ENUM_STRING | undefined;
|
|
42
|
-
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:MOBILE:HOVER': ENUM_STRING | undefined;
|
|
19
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:HOVER': NUMBER_INTEGER | null | undefined;
|
|
20
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:MOBILE': NUMBER_INTEGER | null | undefined;
|
|
21
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE:MOBILE:HOVER': NUMBER_INTEGER | null | undefined;
|
|
22
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
23
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:MOBILE': STRING_8DIGIT_HEX | null | undefined;
|
|
24
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
25
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
26
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:MOBILE': STRING_8DIGIT_HEX | null | undefined;
|
|
27
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
28
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:HOVER': NUMBER_INTEGER | null | undefined;
|
|
29
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:MOBILE': NUMBER_INTEGER | null | undefined;
|
|
30
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC:MOBILE:HOVER': NUMBER_INTEGER | null | undefined;
|
|
31
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:HOVER': ENUM_STRING | null | undefined;
|
|
32
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:MOBILE': ENUM_STRING | null | undefined;
|
|
33
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT:MOBILE:HOVER': ENUM_STRING | null | undefined;
|
|
34
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
35
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:MOBILE': STRING_8DIGIT_HEX | null | undefined;
|
|
36
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR:MOBILE:HOVER': STRING_8DIGIT_HEX | null | undefined;
|
|
37
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:HOVER': NUMBER_INTEGER | null | undefined;
|
|
38
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:MOBILE': NUMBER_INTEGER | null | undefined;
|
|
39
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC:MOBILE:HOVER': NUMBER_INTEGER | null | undefined;
|
|
40
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:HOVER': ENUM_STRING | null | undefined;
|
|
41
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:MOBILE': ENUM_STRING | null | undefined;
|
|
42
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE:MOBILE:HOVER': ENUM_STRING | null | undefined;
|
|
43
43
|
};
|
|
@@ -28,13 +28,12 @@ var AVAILABLE_SPECS = [
|
|
|
28
28
|
function parseStylePropBgColor(namedProps, device) {
|
|
29
29
|
var specs = namedProps.specs;
|
|
30
30
|
var bgColorCssProperties = AVAILABLE_SPECS.reduce(function (acc, cur) {
|
|
31
|
-
var _a
|
|
31
|
+
var _a;
|
|
32
32
|
var baseKey = device === 'DESKTOP' ? cur : cur + ":MOBILE";
|
|
33
33
|
var value = specs[baseKey];
|
|
34
|
-
var hoverValue = specs[baseKey + ":HOVER"];
|
|
35
34
|
return {
|
|
36
35
|
style: __assign(__assign({}, acc.style), (_a = {}, _a[baseKey] = (0, isNullOrUndefined_1.default)(value) ? specs[cur] : value, _a)),
|
|
37
|
-
hoverStyle: __assign(
|
|
36
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
38
37
|
};
|
|
39
38
|
}, {
|
|
40
39
|
style: {},
|
|
@@ -62,7 +61,7 @@ function valueGenerator(valueSet, device) {
|
|
|
62
61
|
case 'SOLID':
|
|
63
62
|
return "" + valueSet.CB_STYLE_PROP_BGCOLOR_SPEC_COLOR;
|
|
64
63
|
case 'NONE':
|
|
65
|
-
return '
|
|
64
|
+
return 'transparent';
|
|
66
65
|
default:
|
|
67
66
|
return '';
|
|
68
67
|
}
|
|
@@ -84,7 +83,7 @@ function valueGenerator(valueSet, device) {
|
|
|
84
83
|
case 'SOLID':
|
|
85
84
|
return "" + valueSet['CB_STYLE_PROP_BGCOLOR_SPEC_COLOR:MOBILE'];
|
|
86
85
|
case 'NONE':
|
|
87
|
-
return '
|
|
86
|
+
return 'transparent';
|
|
88
87
|
default:
|
|
89
88
|
return '';
|
|
90
89
|
}
|
|
@@ -10,10 +10,10 @@ export declare type CB_STYLE_PROP_BGIMAGE_SPECS_BASE = {
|
|
|
10
10
|
CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION: ENUM_STRING;
|
|
11
11
|
};
|
|
12
12
|
export declare type CB_STYLE_PROP_BGIMAGE_SPECS = CB_STYLE_PROP_BGIMAGE_SPECS_BASE & {
|
|
13
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:HOVER': STRING_PLAIN;
|
|
14
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE': STRING_PLAIN | undefined;
|
|
15
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE:HOVER': STRING_PLAIN | undefined;
|
|
16
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:HOVER': ENUM_STRING;
|
|
17
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE': ENUM_STRING | undefined;
|
|
18
|
-
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE:HOVER': ENUM_STRING | undefined;
|
|
13
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:HOVER': STRING_PLAIN | null | undefined;
|
|
14
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE': STRING_PLAIN | null | undefined;
|
|
15
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE:HOVER': STRING_PLAIN | null | undefined;
|
|
16
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:HOVER': ENUM_STRING | null | undefined;
|
|
17
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE': ENUM_STRING | null | undefined;
|
|
18
|
+
'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE:HOVER': ENUM_STRING | null | undefined;
|
|
19
19
|
};
|
|
@@ -21,20 +21,18 @@ function parseStylePropBGImage(namedProps, device) {
|
|
|
21
21
|
var _a, _b;
|
|
22
22
|
var baseKey = device === 'DESKTOP' ? cur : cur + ":MOBILE";
|
|
23
23
|
var cssPropertyKey = getParsedKey(baseKey);
|
|
24
|
-
var value = specs[baseKey];
|
|
25
|
-
var
|
|
26
|
-
var isPosition = cssPropertyKey === 'position';
|
|
24
|
+
var value = specs[baseKey] || specs[cur];
|
|
25
|
+
var isPosition = cssPropertyKey === 'backgroundPosition';
|
|
27
26
|
if (isPosition) {
|
|
28
27
|
var positionCss = getCssProperties(value);
|
|
29
|
-
var hoverPositionCss = getCssProperties(hoverValue);
|
|
30
28
|
return {
|
|
31
|
-
style: __assign(__assign({}, acc.style), positionCss),
|
|
32
|
-
hoverStyle: __assign(
|
|
29
|
+
style: __assign(__assign({}, acc.style), (_a = {}, _a[cssPropertyKey] = positionCss, _a)),
|
|
30
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
33
|
return {
|
|
36
|
-
style: __assign(__assign({}, acc.style), (
|
|
37
|
-
hoverStyle: __assign(
|
|
34
|
+
style: __assign(__assign({}, acc.style), (_b = {}, _b[cssPropertyKey] = value === null || value === void 0 ? void 0 : value.toLowerCase(), _b)),
|
|
35
|
+
hoverStyle: __assign({}, acc.hoverStyle)
|
|
38
36
|
};
|
|
39
37
|
}, {
|
|
40
38
|
style: {},
|
|
@@ -48,71 +46,35 @@ function getParsedKey(key) {
|
|
|
48
46
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:HOVER':
|
|
49
47
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE':
|
|
50
48
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT:MOBILE:HOVER':
|
|
51
|
-
return '
|
|
49
|
+
return 'backgroundSize';
|
|
52
50
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION':
|
|
53
51
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:HOVER':
|
|
54
52
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE':
|
|
55
53
|
case 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION:MOBILE:HOVER':
|
|
56
|
-
return '
|
|
54
|
+
return 'backgroundPosition';
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
function getCssProperties(value) {
|
|
60
58
|
switch (value) {
|
|
61
59
|
case 'LT':
|
|
62
|
-
return
|
|
63
|
-
display: 'flex',
|
|
64
|
-
alignItems: 'flex-start',
|
|
65
|
-
justifyContent: 'flex-start'
|
|
66
|
-
};
|
|
60
|
+
return 'left top';
|
|
67
61
|
case 'CT':
|
|
68
|
-
return
|
|
69
|
-
display: 'flex',
|
|
70
|
-
alignItems: 'flex-start',
|
|
71
|
-
justifyContent: 'center'
|
|
72
|
-
};
|
|
62
|
+
return 'center top';
|
|
73
63
|
case 'RT':
|
|
74
|
-
return
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'flex-start',
|
|
77
|
-
justifyContent: 'flex-end'
|
|
78
|
-
};
|
|
64
|
+
return 'right top';
|
|
79
65
|
case 'LC':
|
|
80
|
-
return
|
|
81
|
-
display: 'flex',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
justifyContent: 'flex-start'
|
|
84
|
-
};
|
|
66
|
+
return 'left center';
|
|
85
67
|
case 'CC':
|
|
86
|
-
return
|
|
87
|
-
display: 'flex',
|
|
88
|
-
alignItems: 'center',
|
|
89
|
-
justifyContent: 'center'
|
|
90
|
-
};
|
|
68
|
+
return 'center center';
|
|
91
69
|
case 'RC':
|
|
92
|
-
return
|
|
93
|
-
display: 'flex',
|
|
94
|
-
alignItems: 'center',
|
|
95
|
-
justifyContent: 'flex-end'
|
|
96
|
-
};
|
|
70
|
+
return 'right center';
|
|
97
71
|
case 'LB':
|
|
98
|
-
return
|
|
99
|
-
display: 'flex',
|
|
100
|
-
alignItems: 'flex-end',
|
|
101
|
-
justifyContent: 'flex-start'
|
|
102
|
-
};
|
|
72
|
+
return 'left bottom';
|
|
103
73
|
case 'CB':
|
|
104
|
-
return
|
|
105
|
-
display: 'flex',
|
|
106
|
-
alignItems: 'flex-end',
|
|
107
|
-
justifyContent: 'center'
|
|
108
|
-
};
|
|
74
|
+
return 'center bottom';
|
|
109
75
|
case 'RB':
|
|
110
|
-
return
|
|
111
|
-
display: 'flex',
|
|
112
|
-
alignItems: 'flex-end',
|
|
113
|
-
justifyContent: 'flex-end'
|
|
114
|
-
};
|
|
76
|
+
return 'right bottom';
|
|
115
77
|
default:
|
|
116
|
-
return
|
|
78
|
+
return '';
|
|
117
79
|
}
|
|
118
80
|
}
|