@fonixtree/magic-design 0.0.82 → 0.0.84
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/es/composite-comp/bol/components/Banner/mobile/index.js +5 -1
- package/es/composite-comp/bol/components/Button/index.less +8 -9
- package/es/composite-comp/bol/components/Carousel/mobile/index.js +69 -18
- package/es/composite-comp/bol/components/Carousel/mobile/index.less +9 -4
- package/es/composite-comp/bol/components/Carousel/pc/index.js +79 -31
- package/es/composite-comp/bol/components/Carousel/pc/index.less +10 -9
- package/es/composite-comp/bol/components/ImageGallery/defaultJSON.js +9 -3
- package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +53 -15
- package/es/composite-comp/bol/components/ImageGallery/mobile/index.less +11 -63
- package/es/composite-comp/bol/components/ImageText/defaultJSON.js +28 -8
- package/es/composite-comp/bol/components/ImageText/mobile/index.js +1 -0
- package/es/composite-comp/bol/components/Newsletter/index.less +1 -1
- package/es/composite-comp/bol/config-panels/ButtonCompConfig/ButtonConfigGroup/index.js +4 -2
- package/es/composite-comp/bol/config-panels/ButtonCompConfig/imgs/layout1.png +0 -0
- package/es/composite-comp/bol/config-panels/ButtonCompConfig/imgs/layout2.png +0 -0
- package/es/composite-comp/bol/config-panels/CarouselConfig/index.js +0 -1
- package/es/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +4 -2
- package/es/composite-comp/bol/config-panels/ImageGalleryConfig/index.js +4 -3
- package/es/composite-comp/bol/config-panels/TagCompConfig/TagConfigGroup/index.js +4 -2
- package/es/composite-comp/bol/second-config-panels/ImageGallerySecondConfig/index.js +6 -17
- package/es/composite-comp/common/components/ProductItem/index.less +1 -0
- package/es/composite-comp/common/config-panels/CustomizeConfig/index.js +30 -20
- package/es/composite-comp/common/config-panels/SpacingConfig/index.js +2 -4
- package/es/composite-comp/dito/components/FlashDeal/defaultJSON.js +9 -10
- package/es/composite-comp/dito/components/PcNavigation/pc/index.less +8 -0
- package/es/composite-comp/dito/components/Recommend/mobile/index.js +8 -5
- package/es/composite-comp/dito/components/Recommend/pc/index.js +6 -4
- package/es/composite-comp/dito/components/Recommend/pc/index.less +1 -0
- package/es/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -2
- package/es/composite-comp/dito/components/SearchBar/mobile/index.js +8 -6
- package/es/composite-comp/dito/config-panels/FlashDealConfig/index.js +0 -1
- package/es/composite-comp/dito/config-panels/RecommendConfig/RecommendConfigGroup/index.js +1 -1
- package/es/composite-comp/dito/config-panels/RecommendConfig/index.js +2 -0
- package/es/constants/component-types.js +3 -1
- package/es/constants/layout.js +1 -6
- package/es/core/Designer/ConfigPanel/index.js +1 -0
- package/es/locale/en/en.json +1 -0
- package/es/locale/es/es.json +1 -0
- package/es/locale/id/id.json +1 -0
- package/es/meta-comp/components/Image/index.js +5 -0
- package/es/meta-comp/components/Image/index.less +2 -2
- package/es/meta-comp/components/Text/index.less +1 -0
- package/lib/composite-comp/bol/components/Banner/mobile/index.js +5 -1
- package/lib/composite-comp/bol/components/Button/index.less +8 -9
- package/lib/composite-comp/bol/components/Carousel/mobile/index.js +69 -18
- package/lib/composite-comp/bol/components/Carousel/mobile/index.less +9 -4
- package/lib/composite-comp/bol/components/Carousel/pc/index.js +79 -31
- package/lib/composite-comp/bol/components/Carousel/pc/index.less +10 -9
- package/lib/composite-comp/bol/components/ImageGallery/defaultJSON.js +9 -3
- package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +53 -15
- package/lib/composite-comp/bol/components/ImageGallery/mobile/index.less +11 -63
- package/lib/composite-comp/bol/components/ImageText/defaultJSON.js +28 -8
- package/lib/composite-comp/bol/components/ImageText/mobile/index.js +1 -0
- package/lib/composite-comp/bol/components/Newsletter/index.less +1 -1
- package/lib/composite-comp/bol/config-panels/ButtonCompConfig/ButtonConfigGroup/index.js +4 -2
- package/lib/composite-comp/bol/config-panels/ButtonCompConfig/imgs/layout1.png +0 -0
- package/lib/composite-comp/bol/config-panels/ButtonCompConfig/imgs/layout2.png +0 -0
- package/lib/composite-comp/bol/config-panels/CarouselConfig/index.js +0 -1
- package/lib/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +4 -2
- package/lib/composite-comp/bol/config-panels/ImageGalleryConfig/index.js +4 -3
- package/lib/composite-comp/bol/config-panels/TagCompConfig/TagConfigGroup/index.js +4 -2
- package/lib/composite-comp/bol/second-config-panels/ImageGallerySecondConfig/index.js +6 -17
- package/lib/composite-comp/common/components/ProductItem/index.less +1 -0
- package/lib/composite-comp/common/config-panels/CustomizeConfig/index.js +30 -20
- package/lib/composite-comp/common/config-panels/SpacingConfig/index.js +2 -4
- package/lib/composite-comp/dito/components/FlashDeal/defaultJSON.js +9 -10
- package/lib/composite-comp/dito/components/PcNavigation/pc/index.less +8 -0
- package/lib/composite-comp/dito/components/Recommend/mobile/index.js +8 -5
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +6 -4
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +1 -0
- package/lib/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -2
- package/lib/composite-comp/dito/components/SearchBar/mobile/index.js +8 -6
- package/lib/composite-comp/dito/config-panels/FlashDealConfig/index.js +0 -1
- package/lib/composite-comp/dito/config-panels/RecommendConfig/RecommendConfigGroup/index.js +1 -1
- package/lib/composite-comp/dito/config-panels/RecommendConfig/index.js +2 -0
- package/lib/constants/component-types.js +3 -1
- package/lib/constants/layout.js +1 -6
- package/lib/core/Designer/ConfigPanel/index.js +1 -0
- package/lib/locale/en/en.json +1 -0
- package/lib/locale/es/es.json +1 -0
- package/lib/locale/id/id.json +1 -0
- package/lib/meta-comp/components/Image/index.js +5 -0
- package/lib/meta-comp/components/Image/index.less +2 -2
- package/lib/meta-comp/components/Text/index.less +1 -0
- package/package.json +1 -1
|
@@ -19,6 +19,8 @@ var _coreUtil = require("../../../../../utils/coreUtil");
|
|
|
19
19
|
|
|
20
20
|
var _AlignSelector = require("../../../../../common/AlignSelector");
|
|
21
21
|
|
|
22
|
+
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
23
|
+
|
|
22
24
|
var _components = require("../../../../../meta-comp/components");
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -171,7 +173,9 @@ function (_super) {
|
|
|
171
173
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
174
|
className: "m-banner-mobile",
|
|
173
175
|
style: {
|
|
174
|
-
marginBottom:
|
|
176
|
+
marginBottom: (0, _commonUtil.ensure)(function () {
|
|
177
|
+
return data.spacing.mobile.marginBottom;
|
|
178
|
+
}, 0)
|
|
175
179
|
}
|
|
176
180
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Carousel, {
|
|
177
181
|
ref: this.carouselRef,
|
|
@@ -13,36 +13,35 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
&.layout1 {
|
|
16
|
-
flex-direction:
|
|
16
|
+
flex-direction: row;
|
|
17
17
|
|
|
18
18
|
&.left {
|
|
19
|
-
|
|
19
|
+
justify-content: flex-start;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
&.center {
|
|
23
|
-
|
|
23
|
+
justify-content: center;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&.right {
|
|
27
|
-
|
|
27
|
+
justify-content: flex-end;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
&.layout2 {
|
|
32
|
-
flex-direction:
|
|
32
|
+
flex-direction: column;
|
|
33
33
|
|
|
34
34
|
&.left {
|
|
35
|
-
|
|
35
|
+
align-items: flex-start;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&.center {
|
|
39
|
-
|
|
39
|
+
align-items: center;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
&.right {
|
|
43
|
-
|
|
43
|
+
align-items: flex-end;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
48
47
|
}
|
|
@@ -13,6 +13,10 @@ var _reactSlick = _interopRequireDefault(require("react-slick"));
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
|
|
18
|
+
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
19
|
+
|
|
16
20
|
var _components = require("../../../../../meta-comp/components");
|
|
17
21
|
|
|
18
22
|
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
@@ -70,20 +74,20 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
var MOBILE_IMG_SIZE = [{
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
maxW: 375,
|
|
78
|
+
maxH: 160
|
|
75
79
|
}, {
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
maxW: 169,
|
|
81
|
+
maxH: 126
|
|
78
82
|
}, {
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
maxW: 109,
|
|
84
|
+
maxH: 82
|
|
81
85
|
}, {
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
maxW: 78,
|
|
87
|
+
maxH: 58
|
|
84
88
|
}, {
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
maxW: 50,
|
|
90
|
+
maxH: 50
|
|
87
91
|
}];
|
|
88
92
|
|
|
89
93
|
var CarouselMobile =
|
|
@@ -95,9 +99,28 @@ function (_super) {
|
|
|
95
99
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
96
100
|
|
|
97
101
|
_this.state = {
|
|
98
|
-
sliderIndex: 0
|
|
102
|
+
sliderIndex: 0,
|
|
103
|
+
contentWidth: 0
|
|
99
104
|
};
|
|
100
105
|
_this.sliderRef = /*#__PURE__*/_react["default"].createRef();
|
|
106
|
+
_this.destroy = null;
|
|
107
|
+
|
|
108
|
+
_this.listenWidth = function () {
|
|
109
|
+
var renderContainer = document.querySelector('.composite_wrap');
|
|
110
|
+
if (renderContainer) _this.setState({
|
|
111
|
+
contentWidth: renderContainer.offsetWidth
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
_this.sliderGoTo = function (groupSource) {
|
|
116
|
+
var nextIndex = groupSource.findIndex(function (item) {
|
|
117
|
+
return item.id === _mobx.store.clickedGroup;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (nextIndex != -1 && nextIndex != _this.state.sliderIndex) {
|
|
121
|
+
_this.sliderRef.slickGoTo(nextIndex);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
101
124
|
|
|
102
125
|
_this.mouseEnterBtn = function (e) {
|
|
103
126
|
var _a, _b;
|
|
@@ -133,14 +156,24 @@ function (_super) {
|
|
|
133
156
|
CarouselMobile.prototype.componentDidMount = function () {
|
|
134
157
|
var _a;
|
|
135
158
|
|
|
159
|
+
var _this = this;
|
|
160
|
+
|
|
136
161
|
var data = this.props.data;
|
|
137
162
|
|
|
138
163
|
_mobx.store.setState({
|
|
139
164
|
CarouselStore: __assign(__assign({}, _mobx.store.CarouselStore), (_a = {}, _a[data.id] = data.customize.layout, _a))
|
|
140
165
|
});
|
|
166
|
+
|
|
167
|
+
this.destroy = (0, _mobx.autorun)(function () {
|
|
168
|
+
_this.sliderGoTo(_this.props.data.groupSource);
|
|
169
|
+
});
|
|
170
|
+
this.listenWidth();
|
|
171
|
+
window.addEventListener('resize', (0, _lodash.debounce)(this.listenWidth));
|
|
141
172
|
};
|
|
142
173
|
|
|
143
174
|
CarouselMobile.prototype.componentWillReceiveProps = function (nextProps) {
|
|
175
|
+
this.sliderGoTo(nextProps.data.groupSource);
|
|
176
|
+
|
|
144
177
|
if (nextProps.data.setting.autoplay.open) {
|
|
145
178
|
this.sliderRef.slickPlay();
|
|
146
179
|
} else {
|
|
@@ -148,11 +181,17 @@ function (_super) {
|
|
|
148
181
|
}
|
|
149
182
|
};
|
|
150
183
|
|
|
184
|
+
CarouselMobile.prototype.componentWillUnmount = function () {
|
|
185
|
+
this.destroy();
|
|
186
|
+
};
|
|
187
|
+
|
|
151
188
|
CarouselMobile.prototype.render = function () {
|
|
152
189
|
var _this = this;
|
|
153
190
|
|
|
154
191
|
var data = this.props.data;
|
|
155
|
-
var
|
|
192
|
+
var _a = this.state,
|
|
193
|
+
sliderIndex = _a.sliderIndex,
|
|
194
|
+
contentWidth = _a.contentWidth;
|
|
156
195
|
var showText = data.customize.layout === 'layout2';
|
|
157
196
|
var colNum = showText ? 1 : Math.min(data.customize.rowNum, data.groupSource.length);
|
|
158
197
|
var bgStyle = {};
|
|
@@ -168,13 +207,18 @@ function (_super) {
|
|
|
168
207
|
};
|
|
169
208
|
}
|
|
170
209
|
|
|
171
|
-
var
|
|
172
|
-
|
|
210
|
+
var autoplay = data.setting.autoplay.open;
|
|
211
|
+
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
212
|
+
|
|
213
|
+
if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
|
|
214
|
+
autoplay = false;
|
|
215
|
+
}
|
|
216
|
+
|
|
173
217
|
var settings = {
|
|
174
218
|
className: 'slider-wrap',
|
|
175
219
|
arrows: false,
|
|
176
220
|
dots: false,
|
|
177
|
-
autoplay:
|
|
221
|
+
autoplay: autoplay,
|
|
178
222
|
autoplaySpeed: data.setting.autoplay.interval * 1000,
|
|
179
223
|
speed: 500,
|
|
180
224
|
draggable: window.magicDesign.mode === 'renderer',
|
|
@@ -186,9 +230,16 @@ function (_super) {
|
|
|
186
230
|
});
|
|
187
231
|
}
|
|
188
232
|
};
|
|
233
|
+
var spacing = data.spacing[window.magicDesign.device];
|
|
189
234
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
235
|
className: "m-carousel-mobile",
|
|
191
236
|
style: bgStyle
|
|
237
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
238
|
+
className: "content",
|
|
239
|
+
style: {
|
|
240
|
+
width: contentWidth - spacing.paddingLeft - spacing.paddingRight,
|
|
241
|
+
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '20px' : '0'
|
|
242
|
+
}
|
|
192
243
|
}, /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
|
|
193
244
|
ref: function ref(slider) {
|
|
194
245
|
return _this.sliderRef = slider;
|
|
@@ -201,8 +252,8 @@ function (_super) {
|
|
|
201
252
|
className: "img"
|
|
202
253
|
}, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
203
254
|
data: item.image,
|
|
204
|
-
maxHeight: MOBILE_IMG_SIZE[colNum - 1].
|
|
205
|
-
maxWidth: MOBILE_IMG_SIZE[colNum - 1].
|
|
255
|
+
maxHeight: MOBILE_IMG_SIZE[colNum - 1].maxH,
|
|
256
|
+
maxWidth: MOBILE_IMG_SIZE[colNum - 1].maxW
|
|
206
257
|
})), showText && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, item.title.open && /*#__PURE__*/_react["default"].createElement("div", {
|
|
207
258
|
className: "title"
|
|
208
259
|
}, /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
|
|
@@ -237,7 +288,7 @@ function (_super) {
|
|
|
237
288
|
fontSize: i == sliderIndex ? data.setting.dots.hoverSize : data.setting.dots.size
|
|
238
289
|
}
|
|
239
290
|
});
|
|
240
|
-
})));
|
|
291
|
+
}))));
|
|
241
292
|
};
|
|
242
293
|
|
|
243
294
|
CarouselMobile.defaultProps = {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
.m-carousel-mobile {
|
|
2
|
-
display: flex;
|
|
3
2
|
position: relative;
|
|
4
|
-
|
|
3
|
+
width: 100%;
|
|
4
|
+
|
|
5
|
+
.content {
|
|
6
|
+
display: flex;
|
|
7
|
+
margin: 0 auto;
|
|
8
|
+
}
|
|
5
9
|
|
|
6
10
|
.slider-wrap {
|
|
7
11
|
width: 100%;
|
|
8
|
-
padding: 30px 0;
|
|
9
12
|
margin: 0 auto;
|
|
13
|
+
line-height: 1;
|
|
10
14
|
|
|
11
15
|
.img-wrap {
|
|
12
16
|
.img {
|
|
@@ -30,6 +34,7 @@
|
|
|
30
34
|
|
|
31
35
|
.tags {
|
|
32
36
|
margin-top: 8px;
|
|
37
|
+
margin-bottom: 12px;
|
|
33
38
|
display: flex;
|
|
34
39
|
flex-direction: row;
|
|
35
40
|
align-items: center;
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
.swiper-ban {
|
|
55
60
|
position: absolute;
|
|
56
61
|
width: 100%;
|
|
57
|
-
bottom:
|
|
62
|
+
bottom: 6px;
|
|
58
63
|
display: flex;
|
|
59
64
|
align-items: center;
|
|
60
65
|
justify-content: center;
|
|
@@ -13,8 +13,12 @@ var _reactSlick = _interopRequireDefault(require("react-slick"));
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
|
|
16
18
|
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
17
19
|
|
|
20
|
+
var _mobx = require("../../../../../mobx");
|
|
21
|
+
|
|
18
22
|
var _components = require("../../../../../meta-comp/components");
|
|
19
23
|
|
|
20
24
|
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
@@ -25,10 +29,14 @@ require("slick-carousel/slick/slick.css");
|
|
|
25
29
|
|
|
26
30
|
require("slick-carousel/slick/slick-theme.css");
|
|
27
31
|
|
|
32
|
+
var _ref, _ref2, _ref3, _ref4;
|
|
33
|
+
|
|
28
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
35
|
|
|
30
36
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
37
|
|
|
38
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
+
|
|
32
40
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
33
41
|
var _extendStatics = function extendStatics(d, b) {
|
|
34
42
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -56,30 +64,28 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
56
64
|
}();
|
|
57
65
|
|
|
58
66
|
var PC_IMG_SIZE = [{
|
|
59
|
-
minW:
|
|
67
|
+
minW: 150,
|
|
60
68
|
maxW: 1072,
|
|
61
|
-
|
|
69
|
+
minH: 150,
|
|
70
|
+
maxH: 400
|
|
62
71
|
}, {
|
|
63
|
-
minW:
|
|
72
|
+
minW: 150,
|
|
64
73
|
maxW: 524,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, {
|
|
71
|
-
minW:
|
|
72
|
-
maxW: 251
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
maxW: 168,
|
|
81
|
-
maxH: 126
|
|
82
|
-
}];
|
|
74
|
+
minH: 150,
|
|
75
|
+
maxH: 524
|
|
76
|
+
}, (_ref = {
|
|
77
|
+
minW: 100,
|
|
78
|
+
maxW: 341
|
|
79
|
+
}, _defineProperty(_ref, "minW", 100), _defineProperty(_ref, "maxW", 341), _ref), (_ref2 = {
|
|
80
|
+
minW: 100,
|
|
81
|
+
maxW: 251
|
|
82
|
+
}, _defineProperty(_ref2, "minW", 100), _defineProperty(_ref2, "maxW", 251), _ref2), (_ref3 = {
|
|
83
|
+
minW: 100,
|
|
84
|
+
maxW: 195
|
|
85
|
+
}, _defineProperty(_ref3, "minW", 100), _defineProperty(_ref3, "maxW", 195), _ref3), (_ref4 = {
|
|
86
|
+
minW: 100,
|
|
87
|
+
maxW: 168
|
|
88
|
+
}, _defineProperty(_ref4, "minW", 100), _defineProperty(_ref4, "maxW", 168), _ref4)];
|
|
83
89
|
|
|
84
90
|
var CarouselPc =
|
|
85
91
|
/** @class */
|
|
@@ -90,9 +96,28 @@ function (_super) {
|
|
|
90
96
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
91
97
|
|
|
92
98
|
_this.state = {
|
|
93
|
-
sliderIndex: 0
|
|
99
|
+
sliderIndex: 0,
|
|
100
|
+
contentWidth: 0
|
|
94
101
|
};
|
|
95
102
|
_this.sliderRef = /*#__PURE__*/_react["default"].createRef();
|
|
103
|
+
_this.destroy = null;
|
|
104
|
+
|
|
105
|
+
_this.listenWidth = function () {
|
|
106
|
+
var renderContainer = document.querySelector('.composite_wrap');
|
|
107
|
+
if (renderContainer) _this.setState({
|
|
108
|
+
contentWidth: renderContainer.offsetWidth
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_this.sliderGoTo = function (groupSource) {
|
|
113
|
+
var nextIndex = groupSource.findIndex(function (item) {
|
|
114
|
+
return item.id === _mobx.store.clickedGroup;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
if (nextIndex != -1 && nextIndex != _this.state.sliderIndex) {
|
|
118
|
+
_this.sliderRef.slickGoTo(nextIndex);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
96
121
|
|
|
97
122
|
_this.mouseEnterBtn = function (e) {
|
|
98
123
|
var _a, _b;
|
|
@@ -125,7 +150,19 @@ function (_super) {
|
|
|
125
150
|
return _this;
|
|
126
151
|
}
|
|
127
152
|
|
|
153
|
+
CarouselPc.prototype.componentDidMount = function () {
|
|
154
|
+
var _this = this;
|
|
155
|
+
|
|
156
|
+
this.destroy = (0, _mobx.autorun)(function () {
|
|
157
|
+
_this.sliderGoTo(_this.props.data.groupSource);
|
|
158
|
+
});
|
|
159
|
+
this.listenWidth();
|
|
160
|
+
window.addEventListener('resize', (0, _lodash.debounce)(this.listenWidth));
|
|
161
|
+
};
|
|
162
|
+
|
|
128
163
|
CarouselPc.prototype.componentWillReceiveProps = function (nextProps) {
|
|
164
|
+
this.sliderGoTo(nextProps.data.groupSource);
|
|
165
|
+
|
|
129
166
|
if (nextProps.data.setting.autoplay.open) {
|
|
130
167
|
this.sliderRef.slickPlay();
|
|
131
168
|
} else {
|
|
@@ -133,11 +170,17 @@ function (_super) {
|
|
|
133
170
|
}
|
|
134
171
|
};
|
|
135
172
|
|
|
173
|
+
CarouselPc.prototype.componentWillUnmount = function () {
|
|
174
|
+
this.destroy();
|
|
175
|
+
};
|
|
176
|
+
|
|
136
177
|
CarouselPc.prototype.render = function () {
|
|
137
178
|
var _this = this;
|
|
138
179
|
|
|
139
180
|
var data = this.props.data;
|
|
140
|
-
var
|
|
181
|
+
var _a = this.state,
|
|
182
|
+
sliderIndex = _a.sliderIndex,
|
|
183
|
+
contentWidth = _a.contentWidth;
|
|
141
184
|
var showText = data.customize.layout === 'layout2';
|
|
142
185
|
var colNum = showText ? 1 : Math.min(data.customize.pcRowNum, data.groupSource.length);
|
|
143
186
|
var bgStyle = {};
|
|
@@ -153,11 +196,18 @@ function (_super) {
|
|
|
153
196
|
};
|
|
154
197
|
}
|
|
155
198
|
|
|
199
|
+
var autoplay = data.setting.autoplay.open;
|
|
200
|
+
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
201
|
+
|
|
202
|
+
if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
|
|
203
|
+
autoplay = false;
|
|
204
|
+
}
|
|
205
|
+
|
|
156
206
|
var settings = {
|
|
157
207
|
className: 'slider-wrap',
|
|
158
208
|
arrows: false,
|
|
159
209
|
dots: false,
|
|
160
|
-
autoplay:
|
|
210
|
+
autoplay: autoplay,
|
|
161
211
|
autoplaySpeed: data.setting.autoplay.interval * 1000,
|
|
162
212
|
speed: 500,
|
|
163
213
|
draggable: window.magicDesign.mode === 'renderer',
|
|
@@ -180,7 +230,8 @@ function (_super) {
|
|
|
180
230
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
231
|
className: "content",
|
|
182
232
|
style: {
|
|
183
|
-
width: spacing.
|
|
233
|
+
width: contentWidth - spacing.paddingLeft - spacing.paddingRight,
|
|
234
|
+
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '30px' : '0'
|
|
184
235
|
}
|
|
185
236
|
}, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
186
237
|
className: "carousel-icon-left",
|
|
@@ -191,11 +242,7 @@ function (_super) {
|
|
|
191
242
|
onMouseLeave: this.mouseLeaveBtn,
|
|
192
243
|
style: navStyle,
|
|
193
244
|
type: "icon-left"
|
|
194
|
-
}), /*#__PURE__*/_react["default"].createElement("
|
|
195
|
-
style: {
|
|
196
|
-
width: spacing.contentWidth || 'calc(100% - 52px)'
|
|
197
|
-
}
|
|
198
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
|
|
245
|
+
}), /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
|
|
199
246
|
ref: function ref(slider) {
|
|
200
247
|
return _this.sliderRef = slider;
|
|
201
248
|
}
|
|
@@ -209,6 +256,7 @@ function (_super) {
|
|
|
209
256
|
data: item.image,
|
|
210
257
|
maxHeight: PC_IMG_SIZE[colNum - 1].maxH,
|
|
211
258
|
maxWidth: PC_IMG_SIZE[colNum - 1].maxW,
|
|
259
|
+
minHeight: PC_IMG_SIZE[colNum - 1].minH,
|
|
212
260
|
minWidth: PC_IMG_SIZE[colNum - 1].minW
|
|
213
261
|
})), showText && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, item.title.open && !((0, _coreUtil.isPc)() && item.title.pcText === '') && /*#__PURE__*/_react["default"].createElement("div", {
|
|
214
262
|
className: "title"
|
|
@@ -228,7 +276,7 @@ function (_super) {
|
|
|
228
276
|
}), item.secondButtonTag.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
229
277
|
data: item.secondButtonTag
|
|
230
278
|
}))));
|
|
231
|
-
}))
|
|
279
|
+
})), data.setting.dots.open && Math.ceil(data.groupSource.length / colNum) > 1 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
232
280
|
className: "swiper-ban"
|
|
233
281
|
}, data.groupSource.length > 1 && data.groupSource.map(function (item, i) {
|
|
234
282
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
.m-carousel-pc {
|
|
2
2
|
position: relative;
|
|
3
|
-
overflow-x: auto;
|
|
4
3
|
width: 100%;
|
|
5
4
|
|
|
6
5
|
.content {
|
|
7
6
|
display: flex;
|
|
8
|
-
width: fit-content;
|
|
9
7
|
margin: 0 auto;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
.carousel-icon-left {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
margin-right: 20px;
|
|
12
|
+
cursor: pointer;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
.carousel-icon-right {
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
margin-left: 20px;
|
|
17
|
+
cursor: pointer;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
.slider-wrap {
|
|
23
|
-
width: 100
|
|
24
|
-
padding: 30px 0;
|
|
21
|
+
width: calc(100% - 72px);
|
|
25
22
|
margin: 0 auto;
|
|
23
|
+
line-height: 1;
|
|
26
24
|
|
|
27
25
|
.img-wrap {
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
|
|
28
28
|
.img {
|
|
29
29
|
width: fit-content;
|
|
30
30
|
height: fit-content;
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
.tags {
|
|
48
48
|
margin-top: 8px;
|
|
49
|
+
margin-bottom: 12px;
|
|
49
50
|
display: flex;
|
|
50
51
|
flex-direction: row;
|
|
51
52
|
align-items: center;
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
.swiper-ban {
|
|
71
72
|
position: absolute;
|
|
72
73
|
width: 100%;
|
|
73
|
-
bottom:
|
|
74
|
+
bottom: 10px;
|
|
74
75
|
left: 0;
|
|
75
76
|
right: 0;
|
|
76
77
|
display: flex;
|
|
@@ -22,8 +22,8 @@ var imagesGroupSourceJSON = function imagesGroupSourceJSON() {
|
|
|
22
22
|
open: true,
|
|
23
23
|
type: 'IMAGE',
|
|
24
24
|
content: {
|
|
25
|
-
h5Name: '
|
|
26
|
-
pcName: '
|
|
25
|
+
h5Name: 'Image Name',
|
|
26
|
+
pcName: 'Image Name',
|
|
27
27
|
h5ImgSrc: '',
|
|
28
28
|
pcImgSrc: '',
|
|
29
29
|
clickUrl: ''
|
|
@@ -60,7 +60,13 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
60
60
|
},
|
|
61
61
|
customize: {
|
|
62
62
|
layout: 'layout1',
|
|
63
|
-
align: 'left'
|
|
63
|
+
align: 'left',
|
|
64
|
+
pcRowNum: 2,
|
|
65
|
+
rowNum: 2,
|
|
66
|
+
mobileMinRowNum: 2,
|
|
67
|
+
mobileMaxRowNum: 5,
|
|
68
|
+
pcMinRowNum: 2,
|
|
69
|
+
pcMaxRowNum: 6
|
|
64
70
|
},
|
|
65
71
|
background: {
|
|
66
72
|
opacity: 100,
|
|
@@ -7,9 +7,11 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
|
|
10
12
|
require("./index.less");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _components = require("../../../../../meta-comp/components");
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
17
|
|
|
@@ -39,6 +41,34 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
39
41
|
};
|
|
40
42
|
}();
|
|
41
43
|
|
|
44
|
+
var MOBILE_IMG_SIZE = {
|
|
45
|
+
1: {
|
|
46
|
+
maxW: 343,
|
|
47
|
+
maxH: 258,
|
|
48
|
+
gap: 12
|
|
49
|
+
},
|
|
50
|
+
2: {
|
|
51
|
+
maxW: 165,
|
|
52
|
+
maxH: 124,
|
|
53
|
+
gap: 12
|
|
54
|
+
},
|
|
55
|
+
3: {
|
|
56
|
+
maxW: 106,
|
|
57
|
+
maxH: 80,
|
|
58
|
+
gap: 12
|
|
59
|
+
},
|
|
60
|
+
4: {
|
|
61
|
+
maxW: 77,
|
|
62
|
+
maxH: 56,
|
|
63
|
+
gap: 12
|
|
64
|
+
},
|
|
65
|
+
5: {
|
|
66
|
+
maxW: 62,
|
|
67
|
+
maxH: 45,
|
|
68
|
+
gap: 8
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
42
72
|
var ImageGalleryMobile =
|
|
43
73
|
/** @class */
|
|
44
74
|
function (_super) {
|
|
@@ -48,27 +78,35 @@ function (_super) {
|
|
|
48
78
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
49
79
|
|
|
50
80
|
_this.state = {};
|
|
51
|
-
_this.carouselRef = /*#__PURE__*/_react["default"].createRef();
|
|
52
|
-
_this.destroy = null;
|
|
53
81
|
return _this;
|
|
54
82
|
}
|
|
55
83
|
|
|
56
|
-
ImageGalleryMobile.prototype.componentDidMount = function () {
|
|
57
|
-
this.destroy = (0, _mobx.autorun)(function () {// this.init(this.props.data.groupSource);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
ImageGalleryMobile.prototype.componentWillReceiveProps = function (nextProps) {// this.init(nextProps.data.groupSource);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
ImageGalleryMobile.prototype.componentWillUnmount = function () {// this.destroy();
|
|
65
|
-
};
|
|
66
|
-
|
|
67
84
|
ImageGalleryMobile.prototype.render = function () {
|
|
68
85
|
var data = this.props.data;
|
|
86
|
+
var isHorizontal = data.customize.layout === 'layout2';
|
|
87
|
+
var colNum = isHorizontal ? data.customize.rowNum : 1;
|
|
69
88
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
70
89
|
className: "m-image-gallery-mobile"
|
|
71
|
-
}, "
|
|
90
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
91
|
+
className: (0, _classnames["default"])('content', {
|
|
92
|
+
horizontal: isHorizontal
|
|
93
|
+
}),
|
|
94
|
+
style: {
|
|
95
|
+
gap: MOBILE_IMG_SIZE[colNum].gap
|
|
96
|
+
}
|
|
97
|
+
}, data.groupSource.map(function (m) {
|
|
98
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
99
|
+
key: m.id,
|
|
100
|
+
className: "img-wrap",
|
|
101
|
+
style: {
|
|
102
|
+
width: MOBILE_IMG_SIZE[colNum].maxW
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
105
|
+
data: m.image,
|
|
106
|
+
maxHeight: MOBILE_IMG_SIZE[colNum].maxH,
|
|
107
|
+
maxWidth: MOBILE_IMG_SIZE[colNum].maxW
|
|
108
|
+
}));
|
|
109
|
+
})));
|
|
72
110
|
};
|
|
73
111
|
|
|
74
112
|
ImageGalleryMobile.defaultProps = {
|