@fonixtree/magic-design 0.0.81 → 0.0.83
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 +48 -2
- package/es/composite-comp/bol/components/Banner/pc/index.js +62 -16
- 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/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/TagCompConfig/TagConfigGroup/index.js +4 -2
- package/es/composite-comp/common/components/ProductItem/index.less +1 -0
- 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/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/core/Designer/CompListPanel/CompCard/index.js +3 -1
- package/es/core/Designer/CompListPanel/index.js +3 -3
- package/es/decorator/compositeDecorator.js +16 -13
- package/es/locale/en/en.json +2 -2
- package/es/locale/id/id.json +2 -2
- 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/es/utils/businessUtil.js +3 -3
- package/lib/composite-comp/bol/components/Banner/mobile/index.js +48 -2
- package/lib/composite-comp/bol/components/Banner/pc/index.js +62 -16
- 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/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/TagCompConfig/TagConfigGroup/index.js +4 -2
- package/lib/composite-comp/common/components/ProductItem/index.less +1 -0
- 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/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/core/Designer/CompListPanel/CompCard/index.js +3 -1
- package/lib/core/Designer/CompListPanel/index.js +3 -3
- package/lib/decorator/compositeDecorator.js +16 -13
- package/lib/locale/en/en.json +2 -2
- package/lib/locale/id/id.json +2 -2
- 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/lib/utils/businessUtil.js +3 -3
- package/package.json +1 -1
|
@@ -49,6 +49,22 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
49
49
|
};
|
|
50
50
|
}();
|
|
51
51
|
|
|
52
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
53
|
+
__assign = Object.assign || function (t) {
|
|
54
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
55
|
+
s = arguments[i];
|
|
56
|
+
|
|
57
|
+
for (var p in s) {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return t;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return __assign.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
|
|
52
68
|
var BannerMobile =
|
|
53
69
|
/** @class */
|
|
54
70
|
function (_super) {
|
|
@@ -74,6 +90,31 @@ function (_super) {
|
|
|
74
90
|
}
|
|
75
91
|
};
|
|
76
92
|
|
|
93
|
+
_this.getPaddingAndBackground = function (item) {
|
|
94
|
+
var spacing = _this.props.data.spacing; // const { spacing, background } = data;
|
|
95
|
+
|
|
96
|
+
var device = window.magicDesign.device;
|
|
97
|
+
var wrapStyle = {}; // 边距
|
|
98
|
+
|
|
99
|
+
if (spacing && spacing[device]) {
|
|
100
|
+
wrapStyle = __assign(__assign({}, wrapStyle), spacing[device]);
|
|
101
|
+
} // 背景
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
if (item.background) {
|
|
105
|
+
if (item.background.bgType === 'color') {
|
|
106
|
+
wrapStyle.backgroundColor = item.background.color;
|
|
107
|
+
wrapStyle.opacity = item.background.opacity ? item.background.opacity : 1;
|
|
108
|
+
} else {
|
|
109
|
+
wrapStyle.backgroundImage = "url(" + item.background.image + ")";
|
|
110
|
+
wrapStyle.backgroundPosition = 'center';
|
|
111
|
+
wrapStyle.backgroundSize = 'cover';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return __assign({}, wrapStyle);
|
|
116
|
+
};
|
|
117
|
+
|
|
77
118
|
_this.getItemStyle = function (item) {
|
|
78
119
|
var data = _this.props.data;
|
|
79
120
|
return {
|
|
@@ -128,7 +169,10 @@ function (_super) {
|
|
|
128
169
|
}
|
|
129
170
|
|
|
130
171
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
131
|
-
className: "m-banner-mobile"
|
|
172
|
+
className: "m-banner-mobile",
|
|
173
|
+
style: {
|
|
174
|
+
marginBottom: data.spacing.mobile.marginBottom || 0
|
|
175
|
+
}
|
|
132
176
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Carousel, {
|
|
133
177
|
ref: this.carouselRef,
|
|
134
178
|
afterChange: function afterChange(n) {
|
|
@@ -142,6 +186,8 @@ function (_super) {
|
|
|
142
186
|
}, data.groupSource.map(function (item, index) {
|
|
143
187
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
144
188
|
key: item.id
|
|
189
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
|
+
style: _this.getPaddingAndBackground(item)
|
|
145
191
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
192
|
className: "carouselItem",
|
|
147
193
|
onMouseEnter: _this.mouseEnterWrap,
|
|
@@ -176,7 +222,7 @@ function (_super) {
|
|
|
176
222
|
}), item.secondButton.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
177
223
|
className: "btn",
|
|
178
224
|
data: item.secondButton
|
|
179
|
-
})))));
|
|
225
|
+
}))))));
|
|
180
226
|
})), data.setting.dots.open && /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
227
|
className: "swiper-ban"
|
|
182
228
|
}, data.groupSource.length > 1 && data.groupSource.map(function (item, i) {
|
|
@@ -23,8 +23,6 @@ var _AlignSelector = require("../../../../../common/AlignSelector");
|
|
|
23
23
|
|
|
24
24
|
var _common = require("../../../../../common");
|
|
25
25
|
|
|
26
|
-
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
27
|
-
|
|
28
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
27
|
|
|
30
28
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -53,6 +51,22 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
53
51
|
};
|
|
54
52
|
}();
|
|
55
53
|
|
|
54
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
55
|
+
__assign = Object.assign || function (t) {
|
|
56
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
57
|
+
s = arguments[i];
|
|
58
|
+
|
|
59
|
+
for (var p in s) {
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return t;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return __assign.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
|
|
56
70
|
// @inject('store')
|
|
57
71
|
// @observer
|
|
58
72
|
var BannerPc =
|
|
@@ -120,20 +134,37 @@ function (_super) {
|
|
|
120
134
|
}
|
|
121
135
|
};
|
|
122
136
|
|
|
123
|
-
_this.
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
};
|
|
137
|
+
_this.getPaddingAndBackground = function (item) {
|
|
138
|
+
var spacing = _this.props.data.spacing; // const { spacing, background } = data;
|
|
139
|
+
|
|
140
|
+
var device = window.magicDesign.device;
|
|
141
|
+
var wrapStyle = {}; // 边距
|
|
128
142
|
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
143
|
+
if (spacing && spacing[device]) {
|
|
144
|
+
wrapStyle = __assign(__assign({}, wrapStyle), spacing[device]);
|
|
145
|
+
} // 背景
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if (item.background) {
|
|
149
|
+
if (item.background.bgType === 'color') {
|
|
150
|
+
wrapStyle.backgroundColor = item.background.color;
|
|
151
|
+
wrapStyle.opacity = item.background.opacity ? item.background.opacity : 1;
|
|
152
|
+
} else {
|
|
153
|
+
wrapStyle.backgroundImage = "url(" + item.background.image + ")";
|
|
154
|
+
wrapStyle.backgroundPosition = 'center';
|
|
155
|
+
wrapStyle.backgroundSize = 'cover';
|
|
156
|
+
}
|
|
133
157
|
}
|
|
134
158
|
|
|
135
|
-
|
|
136
|
-
|
|
159
|
+
return __assign({}, wrapStyle);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
_this.getItemStyle = function (item) {
|
|
163
|
+
var data = _this.props.data;
|
|
164
|
+
return {
|
|
165
|
+
justifyContent: _AlignSelector.alignItemMap[item.customize.layout],
|
|
166
|
+
height: data.setting.pcHeight
|
|
167
|
+
};
|
|
137
168
|
};
|
|
138
169
|
|
|
139
170
|
return _this;
|
|
@@ -153,7 +184,20 @@ function (_super) {
|
|
|
153
184
|
|
|
154
185
|
BannerPc.prototype.componentWillUnmount = function () {
|
|
155
186
|
this.destroy();
|
|
156
|
-
};
|
|
187
|
+
}; // getBgStyle = item => {
|
|
188
|
+
// const { data } = this.props;
|
|
189
|
+
// const bgStyle = {
|
|
190
|
+
// justifyContent: alignItemMap[item.customize.layout],
|
|
191
|
+
// };
|
|
192
|
+
// if (item.background.bgType === 'color') {
|
|
193
|
+
// bgStyle.backgroundColor = getColorRgba(item.background.color || '#fff', item.background.opacity / 100 || 1);
|
|
194
|
+
// } else {
|
|
195
|
+
// bgStyle.backgroundImage = `url(${item.background.image})`;
|
|
196
|
+
// }
|
|
197
|
+
// if (data.setting.pcHeight) bgStyle.height = data.setting.pcHeight;
|
|
198
|
+
// return bgStyle;
|
|
199
|
+
// }
|
|
200
|
+
|
|
157
201
|
|
|
158
202
|
BannerPc.prototype.render = function () {
|
|
159
203
|
var _this = this;
|
|
@@ -197,11 +241,13 @@ function (_super) {
|
|
|
197
241
|
}, data.groupSource.map(function (item, index) {
|
|
198
242
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
199
243
|
key: item.id
|
|
244
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
245
|
+
style: _this.getPaddingAndBackground(item)
|
|
200
246
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
201
247
|
className: "carouselItem",
|
|
202
248
|
onMouseEnter: _this.mouseEnterWrap,
|
|
203
249
|
onMouseLeave: _this.mouseLeaveWrap,
|
|
204
|
-
style: _this.
|
|
250
|
+
style: _this.getItemStyle(item)
|
|
205
251
|
}, item.image.open && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
206
252
|
data: item.image,
|
|
207
253
|
hoverState: hoverState && carouseIndex === index,
|
|
@@ -231,7 +277,7 @@ function (_super) {
|
|
|
231
277
|
}), item.secondButton.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
232
278
|
className: "btn",
|
|
233
279
|
data: item.secondButton
|
|
234
|
-
})))));
|
|
280
|
+
}))))));
|
|
235
281
|
})), data.setting.dots.open && /*#__PURE__*/_react["default"].createElement("div", {
|
|
236
282
|
className: "swiper-ban"
|
|
237
283
|
}, data.groupSource.length > 1 && data.groupSource.map(function (item, i) {
|
|
@@ -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 ? '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 ? '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", {
|