@fonixtree/magic-design 1.0.218 → 1.0.220
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/assets/images/layout-icon/banner-layout1.png +0 -0
- package/es/assets/images/layout-icon/banner-layout2.svg +6 -0
- package/es/assets/images/layout-icon/center.png +0 -0
- package/es/assets/images/layout-icon/grouped-image-layout1.png +0 -0
- package/es/assets/images/layout-icon/left.png +0 -0
- package/es/assets/images/layout-icon/right.png +0 -0
- package/es/common/LinkModal/SelectPicture/imgs/picture-bg.png +0 -0
- package/es/common/LinkModal/SelectPicture/index.js +135 -0
- package/es/common/LinkModal/SelectPicture/index.less +88 -0
- package/es/common/LinkModal/index.js +6 -0
- package/es/common/PictureModal/index.js +37 -0
- package/es/common/PictureModal/index.less +41 -0
- package/es/composite-comp/bol/components/Banner/defaultJSON.js +28 -0
- package/es/composite-comp/bol/components/Banner/pc/components/BannerContent.js +82 -0
- package/es/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +270 -0
- package/es/composite-comp/bol/components/Banner/pc/index.js +43 -14
- package/es/composite-comp/bol/components/Banner/pc/index.less +81 -9
- package/es/composite-comp/bol/config-panels/BannerConfig/index.js +26 -0
- package/es/composite-comp/bol/second-config-panels/BannerSecondConfig/index.js +17 -1
- package/es/composite-comp/dito/components/GroupedImage/defaultJSON.js +149 -0
- package/es/composite-comp/dito/components/GroupedImage/index.js +88 -0
- package/es/composite-comp/dito/components/GroupedImage/pc/index.js +417 -0
- package/es/composite-comp/dito/components/GroupedImage/pc/index.less +124 -0
- package/es/composite-comp/dito/components/Recommend/pc/index.js +2 -2
- package/es/composite-comp/dito/components/Recommend/pc/index.less +3 -1
- package/es/composite-comp/dito/config-panels/GroupedImageConfig/ConfigGroup/index.js +146 -0
- package/es/composite-comp/dito/config-panels/GroupedImageConfig/imgs/defaultImg.png +0 -0
- package/es/composite-comp/dito/config-panels/GroupedImageConfig/index.js +127 -0
- package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +290 -0
- package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
- package/es/constants/component-types.js +9 -3
- package/es/constants/index.js +6 -1
- package/es/constants/layout.js +30 -2
- package/es/core/Designer/ConfigPanel/index.js +217 -4
- package/es/core/Designer/ConfigPanel/index.less +39 -0
- package/es/core/Renderer/index.js +25 -4
- 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 +15 -11
- package/es/meta-comp/config-panels/ImageConfig/index.js +25 -8
- package/es/mobx/Frame.js +5 -0
- package/es/mobx/Store.js +4 -1
- package/es/utils/businessUtil.js +11 -0
- package/es/utils/coreUtil.js +23 -4
- package/es/utils/dataUtil.js +14 -0
- package/lib/assets/images/layout-icon/banner-layout1.png +0 -0
- package/lib/assets/images/layout-icon/banner-layout2.svg +6 -0
- package/lib/assets/images/layout-icon/center.png +0 -0
- package/lib/assets/images/layout-icon/grouped-image-layout1.png +0 -0
- package/lib/assets/images/layout-icon/left.png +0 -0
- package/lib/assets/images/layout-icon/right.png +0 -0
- package/lib/common/LinkModal/SelectPicture/imgs/picture-bg.png +0 -0
- package/lib/common/LinkModal/SelectPicture/index.js +135 -0
- package/lib/common/LinkModal/SelectPicture/index.less +88 -0
- package/lib/common/LinkModal/index.js +6 -0
- package/lib/common/PictureModal/index.js +37 -0
- package/lib/common/PictureModal/index.less +41 -0
- package/lib/composite-comp/bol/components/Banner/defaultJSON.js +28 -0
- package/lib/composite-comp/bol/components/Banner/pc/components/BannerContent.js +82 -0
- package/lib/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +270 -0
- package/lib/composite-comp/bol/components/Banner/pc/index.js +43 -14
- package/lib/composite-comp/bol/components/Banner/pc/index.less +81 -9
- package/lib/composite-comp/bol/config-panels/BannerConfig/index.js +26 -0
- package/lib/composite-comp/bol/second-config-panels/BannerSecondConfig/index.js +17 -1
- package/lib/composite-comp/dito/components/GroupedImage/defaultJSON.js +149 -0
- package/lib/composite-comp/dito/components/GroupedImage/index.js +88 -0
- package/lib/composite-comp/dito/components/GroupedImage/pc/index.js +417 -0
- package/lib/composite-comp/dito/components/GroupedImage/pc/index.less +124 -0
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +2 -2
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +3 -1
- package/lib/composite-comp/dito/config-panels/GroupedImageConfig/ConfigGroup/index.js +146 -0
- package/lib/composite-comp/dito/config-panels/GroupedImageConfig/imgs/defaultImg.png +0 -0
- package/lib/composite-comp/dito/config-panels/GroupedImageConfig/index.js +127 -0
- package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +290 -0
- package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
- package/lib/constants/component-types.js +9 -3
- package/lib/constants/index.js +6 -1
- package/lib/constants/layout.js +30 -2
- package/lib/core/Designer/ConfigPanel/index.js +217 -4
- package/lib/core/Designer/ConfigPanel/index.less +39 -0
- package/lib/core/Renderer/index.js +25 -4
- 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 +15 -11
- package/lib/meta-comp/config-panels/ImageConfig/index.js +25 -8
- package/lib/mobx/Frame.js +5 -0
- package/lib/mobx/Store.js +4 -1
- package/lib/utils/businessUtil.js +11 -0
- package/lib/utils/coreUtil.js +23 -4
- package/lib/utils/dataUtil.js +14 -0
- package/package.json +3 -2
- package/es/utils/pluginsUtil.js +0 -1
- package/lib/utils/pluginsUtil.js +0 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _components = require("../../../../../../meta-comp/components");
|
|
15
|
+
|
|
16
|
+
var _AlignSelector = require("../../../../../../common/AlignSelector");
|
|
17
|
+
|
|
18
|
+
var _ConfigPanel = require("../../../../../../core/Designer/ConfigPanel");
|
|
19
|
+
|
|
20
|
+
var _commonUtil = require("../../../../../../utils/commonUtil");
|
|
21
|
+
|
|
22
|
+
var _coreUtil = require("../../../../../../utils/coreUtil");
|
|
23
|
+
|
|
24
|
+
var _BannerContent = _interopRequireDefault(require("./BannerContent"));
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
33
|
+
__assign = Object.assign || function (t) {
|
|
34
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
+
s = arguments[i];
|
|
36
|
+
|
|
37
|
+
for (var p in s) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return t;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return __assign.apply(this, arguments);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var SwiperBannerPc = function SwiperBannerPc(_a) {
|
|
49
|
+
var _b;
|
|
50
|
+
|
|
51
|
+
var data = _a.data,
|
|
52
|
+
carouseIndex = _a.carouseIndex,
|
|
53
|
+
hoverState = _a.hoverState,
|
|
54
|
+
onIndexChange = _a.onIndexChange,
|
|
55
|
+
swiperRef = _a.swiperRef,
|
|
56
|
+
autoplay = _a.autoplay;
|
|
57
|
+
|
|
58
|
+
var _c = _react["default"].useState(carouseIndex || 0),
|
|
59
|
+
currentIndex = _c[0],
|
|
60
|
+
setCurrentIndex = _c[1];
|
|
61
|
+
|
|
62
|
+
var _d = _react["default"].useState(false),
|
|
63
|
+
isPaused = _d[0],
|
|
64
|
+
setIsPaused = _d[1];
|
|
65
|
+
|
|
66
|
+
var autoplayTimerRef = _react["default"].useRef(null);
|
|
67
|
+
|
|
68
|
+
var containerRef = _react["default"].useRef(null);
|
|
69
|
+
|
|
70
|
+
var GAData = (0, _commonUtil.getGAData)(data);
|
|
71
|
+
var slideCount = ((_b = data.groupSource) === null || _b === void 0 ? void 0 : _b.length) || 1;
|
|
72
|
+
var thumbWidth = 40;
|
|
73
|
+
var thumbGap = 12;
|
|
74
|
+
var otherThumbsCount = slideCount - 1;
|
|
75
|
+
var activeWidth = "calc(100% - " + otherThumbsCount * (thumbWidth + thumbGap) + "px)"; // 同步外部传入的 carouseIndex
|
|
76
|
+
|
|
77
|
+
_react["default"].useEffect(function () {
|
|
78
|
+
if (carouseIndex !== undefined && carouseIndex !== currentIndex) {
|
|
79
|
+
setCurrentIndex(carouseIndex);
|
|
80
|
+
}
|
|
81
|
+
}, [carouseIndex]); // 暴露方法给父组件
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
_react["default"].useEffect(function () {
|
|
85
|
+
if (swiperRef) {
|
|
86
|
+
swiperRef.current = {
|
|
87
|
+
slideTo: function slideTo(index) {
|
|
88
|
+
if (index >= 0 && index < slideCount) {
|
|
89
|
+
setCurrentIndex(index);
|
|
90
|
+
onIndexChange(index);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
next: function next() {
|
|
94
|
+
var nextIndex = (currentIndex + 1) % slideCount;
|
|
95
|
+
setCurrentIndex(nextIndex);
|
|
96
|
+
onIndexChange(nextIndex);
|
|
97
|
+
},
|
|
98
|
+
prev: function prev() {
|
|
99
|
+
var prevIndex = (currentIndex - 1 + slideCount) % slideCount;
|
|
100
|
+
setCurrentIndex(prevIndex);
|
|
101
|
+
onIndexChange(prevIndex);
|
|
102
|
+
},
|
|
103
|
+
goTo: function goTo(index) {
|
|
104
|
+
if (index >= 0 && index < slideCount) {
|
|
105
|
+
setCurrentIndex(index);
|
|
106
|
+
onIndexChange(index);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
activeIndex: currentIndex
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}, [currentIndex, slideCount, swiperRef, onIndexChange]); // 自动播放
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
_react["default"].useEffect(function () {
|
|
116
|
+
var _a;
|
|
117
|
+
|
|
118
|
+
var autoplay = data.setting.autoplay.open && (!(0, _coreUtil.isDesignMode)() || !((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) || !window.magicDesign.clickedGroup);
|
|
119
|
+
|
|
120
|
+
if (autoplay && !isPaused && slideCount > 1) {
|
|
121
|
+
autoplayTimerRef.current = setInterval(function () {
|
|
122
|
+
setCurrentIndex(function (prevIndex) {
|
|
123
|
+
var nextIndex = (prevIndex + 1) % slideCount;
|
|
124
|
+
onIndexChange(nextIndex);
|
|
125
|
+
return nextIndex;
|
|
126
|
+
});
|
|
127
|
+
}, data.setting.autoplay.interval * 1000);
|
|
128
|
+
} else {
|
|
129
|
+
if (autoplayTimerRef.current) {
|
|
130
|
+
clearInterval(autoplayTimerRef.current);
|
|
131
|
+
autoplayTimerRef.current = null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return function () {
|
|
136
|
+
if (autoplayTimerRef.current) {
|
|
137
|
+
clearInterval(autoplayTimerRef.current);
|
|
138
|
+
autoplayTimerRef.current = null;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}, [data.setting.autoplay.open, data.setting.autoplay.interval, isPaused, slideCount, onIndexChange]);
|
|
142
|
+
|
|
143
|
+
var getBackgroundStyle = function getBackgroundStyle(item) {
|
|
144
|
+
var wrapStyle = {};
|
|
145
|
+
|
|
146
|
+
if (item.background) {
|
|
147
|
+
if (item.background.bgType === 'color') {
|
|
148
|
+
wrapStyle.backgroundColor = item.background.color;
|
|
149
|
+
wrapStyle.opacity = item.background.opacity ? item.background.opacity : 1;
|
|
150
|
+
} else {
|
|
151
|
+
wrapStyle.backgroundImage = "url(" + item.background.image + ")";
|
|
152
|
+
wrapStyle.backgroundPosition = 'center';
|
|
153
|
+
wrapStyle.backgroundSize = 'cover';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return wrapStyle;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var getItemStyle = function getItemStyle(item) {
|
|
161
|
+
return {
|
|
162
|
+
justifyContent: _AlignSelector.alignItemMap[item.customize.layout]
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
var getContentStyle = function getContentStyle(item) {
|
|
167
|
+
var styleObj = {
|
|
168
|
+
alignItems: _AlignSelector.alignItemMap[item.customize.layout],
|
|
169
|
+
textAlign: item.customize.align
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
if (item.customize.vertical === 'bottom') {
|
|
173
|
+
styleObj.bottom = 30;
|
|
174
|
+
} else if (item.customize.vertical === 'center') {
|
|
175
|
+
styleObj.top = '50%';
|
|
176
|
+
styleObj.transform = 'translateY(-50%)';
|
|
177
|
+
} else {
|
|
178
|
+
styleObj.top = 30;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return styleObj;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var handleClick = function handleClick(e, index) {
|
|
185
|
+
// 点击切换到对应轮播
|
|
186
|
+
if (index !== currentIndex && slideCount > 1) {
|
|
187
|
+
setCurrentIndex(index);
|
|
188
|
+
onIndexChange(index); // 点击非激活项时,立即暂停自动播放
|
|
189
|
+
|
|
190
|
+
setIsPaused(true);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var handleMouseEnter = function handleMouseEnter(isActive) {
|
|
195
|
+
// 鼠标进入激活项时暂停自动播放
|
|
196
|
+
if (isActive) {
|
|
197
|
+
setIsPaused(true);
|
|
198
|
+
}
|
|
199
|
+
}; // 容器级别的鼠标事件处理
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
var handleContainerMouseLeave = function handleContainerMouseLeave() {
|
|
203
|
+
// 鼠标离开整个容器时,恢复自动播放
|
|
204
|
+
setIsPaused(false);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
(0, _react.useEffect)(function () {
|
|
208
|
+
// 如果 autoplay 关闭,强制暂停
|
|
209
|
+
// 如果 autoplay 开启,不强制恢复(保持用户交互的暂停状态)
|
|
210
|
+
if (!autoplay) {
|
|
211
|
+
setIsPaused(true);
|
|
212
|
+
}
|
|
213
|
+
}, [autoplay]);
|
|
214
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
215
|
+
ref: containerRef,
|
|
216
|
+
className: "swiper-main",
|
|
217
|
+
onMouseLeave: handleContainerMouseLeave
|
|
218
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
219
|
+
className: "custom-carousel-wrapper"
|
|
220
|
+
}, data.groupSource.map(function (item, index) {
|
|
221
|
+
var isActive = index === currentIndex;
|
|
222
|
+
var slideWidth = isActive ? activeWidth : thumbWidth + "px";
|
|
223
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
224
|
+
key: item.id,
|
|
225
|
+
className: (0, _classnames["default"])('custom-carousel-slide', {
|
|
226
|
+
active: isActive
|
|
227
|
+
}),
|
|
228
|
+
onMouseEnter: function onMouseEnter() {
|
|
229
|
+
return handleMouseEnter(isActive);
|
|
230
|
+
},
|
|
231
|
+
style: {
|
|
232
|
+
width: slideWidth,
|
|
233
|
+
marginRight: index < slideCount - 1 ? thumbGap + "px" : '0',
|
|
234
|
+
transition: 'width 0.4s ease'
|
|
235
|
+
}
|
|
236
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
237
|
+
style: getBackgroundStyle(item)
|
|
238
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
239
|
+
className: "carouselItem",
|
|
240
|
+
onClick: function onClick(e) {
|
|
241
|
+
return handleClick(e, index);
|
|
242
|
+
},
|
|
243
|
+
style: __assign({}, getItemStyle(item))
|
|
244
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
245
|
+
data: item.image,
|
|
246
|
+
GAData: __assign(__assign({}, GAData), {
|
|
247
|
+
groupId: item.id,
|
|
248
|
+
groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
|
|
249
|
+
}),
|
|
250
|
+
hoverState: hoverState && currentIndex === index,
|
|
251
|
+
isBackground: true,
|
|
252
|
+
style: {
|
|
253
|
+
width: '100%',
|
|
254
|
+
height: '100%',
|
|
255
|
+
objectFit: 'cover'
|
|
256
|
+
}
|
|
257
|
+
}), !isActive && item.name.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
|
|
258
|
+
className: "itemName",
|
|
259
|
+
data: item.name
|
|
260
|
+
}), isActive && /*#__PURE__*/_react["default"].createElement(_BannerContent["default"], {
|
|
261
|
+
item: item,
|
|
262
|
+
data: data,
|
|
263
|
+
GAData: GAData,
|
|
264
|
+
contentStyle: getContentStyle(item)
|
|
265
|
+
}))));
|
|
266
|
+
})));
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var _default = SwiperBannerPc;
|
|
270
|
+
exports["default"] = _default;
|
|
@@ -27,6 +27,8 @@ var _ConfigPanel = require("../../../../../core/Designer/ConfigPanel");
|
|
|
27
27
|
|
|
28
28
|
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
29
29
|
|
|
30
|
+
var _SwiperBannerPc = _interopRequireDefault(require("./components/SwiperBannerPc"));
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
33
|
|
|
32
34
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -87,7 +89,8 @@ function (_super) {
|
|
|
87
89
|
isDragging: false,
|
|
88
90
|
startX: 0,
|
|
89
91
|
startY: 0,
|
|
90
|
-
hasDragged: false
|
|
92
|
+
hasDragged: false,
|
|
93
|
+
autoplay: false
|
|
91
94
|
};
|
|
92
95
|
_this.carouselRef = /*#__PURE__*/_react["default"].createRef();
|
|
93
96
|
_this.destroy = null;
|
|
@@ -97,7 +100,7 @@ function (_super) {
|
|
|
97
100
|
return item.id === _mobx.store.clickedGroup;
|
|
98
101
|
});
|
|
99
102
|
|
|
100
|
-
if (nextIndex != -1 && nextIndex != _this.state.carouseIndex) {
|
|
103
|
+
if (nextIndex != -1 && nextIndex != _this.state.carouseIndex && _this.state.autoplay) {
|
|
101
104
|
_this.carouselRef.current.goTo(nextIndex);
|
|
102
105
|
}
|
|
103
106
|
};
|
|
@@ -348,6 +351,12 @@ function (_super) {
|
|
|
348
351
|
return styleObj;
|
|
349
352
|
};
|
|
350
353
|
|
|
354
|
+
_this.handleIndexChange = function (i) {
|
|
355
|
+
_this.setState({
|
|
356
|
+
carouseIndex: i
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
|
|
351
360
|
return _this;
|
|
352
361
|
}
|
|
353
362
|
|
|
@@ -358,6 +367,18 @@ function (_super) {
|
|
|
358
367
|
|
|
359
368
|
this.destroy = (0, _mobx.autorun)(function () {
|
|
360
369
|
_this.bannerGoto(_this.props.data.groupSource);
|
|
370
|
+
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
|
|
374
|
+
_this.setState({
|
|
375
|
+
autoplay: false
|
|
376
|
+
});
|
|
377
|
+
} else {
|
|
378
|
+
_this.setState({
|
|
379
|
+
autoplay: true
|
|
380
|
+
});
|
|
381
|
+
}
|
|
361
382
|
}); // 添加全局鼠标事件监听,处理鼠标移出元素的情况
|
|
362
383
|
|
|
363
384
|
if (!(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer') {
|
|
@@ -380,25 +401,25 @@ function (_super) {
|
|
|
380
401
|
BannerPc.prototype.render = function () {
|
|
381
402
|
var _this = this;
|
|
382
403
|
|
|
383
|
-
var
|
|
404
|
+
var _a, _b, _c;
|
|
384
405
|
|
|
385
|
-
var
|
|
386
|
-
|
|
387
|
-
|
|
406
|
+
var data = this.props.data;
|
|
407
|
+
var _d = this.state,
|
|
408
|
+
carouseIndex = _d.carouseIndex,
|
|
409
|
+
hoverState = _d.hoverState,
|
|
410
|
+
autoplay = _d.autoplay;
|
|
388
411
|
var navStyle = {
|
|
389
412
|
fontSize: (0, _commonUtil.convertToRem)(data.setting.navigation.size),
|
|
390
413
|
color: data.setting.navigation.color
|
|
391
414
|
};
|
|
392
|
-
var autoplay = data.setting.autoplay.open;
|
|
393
|
-
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
394
415
|
|
|
395
|
-
|
|
396
|
-
autoplay = false;
|
|
397
|
-
}
|
|
416
|
+
var _autoplay = autoplay && data.setting.autoplay.open;
|
|
398
417
|
|
|
399
418
|
var GAData = (0, _commonUtil.getGAData)(data);
|
|
400
419
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
401
|
-
className: "m-banner-pc
|
|
420
|
+
className: (0, _classnames["default"])('m-banner-pc', {
|
|
421
|
+
layout2: ((_a = data.customize.layout) === null || _a === void 0 ? void 0 : _a.pcLayout) === 'layout2'
|
|
422
|
+
})
|
|
402
423
|
}, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
|
|
403
424
|
className: "turnPage leftBtn",
|
|
404
425
|
onClick: function onClick() {
|
|
@@ -408,14 +429,22 @@ function (_super) {
|
|
|
408
429
|
onMouseLeave: this.mouseLeaveBtn,
|
|
409
430
|
style: navStyle,
|
|
410
431
|
type: "icon-outlined-left"
|
|
411
|
-
}), /*#__PURE__*/_react["default"].createElement(
|
|
432
|
+
}), ((_b = data.customize.layout) === null || _b === void 0 ? void 0 : _b.pcLayout) === 'layout2' && /*#__PURE__*/_react["default"].createElement(_SwiperBannerPc["default"], {
|
|
433
|
+
data: data,
|
|
434
|
+
autoplay: _autoplay,
|
|
435
|
+
carouseIndex: carouseIndex,
|
|
436
|
+
hoverState: hoverState,
|
|
437
|
+
onIndexChange: this.handleIndexChange,
|
|
438
|
+
swiperRef: this.carouselRef
|
|
439
|
+
}), ((_c = data.customize.layout) === null || _c === void 0 ? void 0 : _c.pcLayout) !== 'layout2' && /*#__PURE__*/_react["default"].createElement(_antd.Carousel, {
|
|
412
440
|
ref: this.carouselRef,
|
|
413
441
|
afterChange: function afterChange(n) {
|
|
414
442
|
return _this.setState({
|
|
415
443
|
carouseIndex: n
|
|
416
444
|
});
|
|
417
445
|
},
|
|
418
|
-
autoplay:
|
|
446
|
+
autoplay: _autoplay // initialSlide={0}
|
|
447
|
+
,
|
|
419
448
|
autoplaySpeed: data.setting.autoplay.interval * 1000,
|
|
420
449
|
dots: false
|
|
421
450
|
}, data.groupSource.map(function (item, index) {
|
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
.m-banner-pc {
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
|
+
&.layout2 {
|
|
5
|
+
padding: 16px 1.23%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.swiper-main {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: relative;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
.custom-carousel-wrapper {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.custom-carousel-slide {
|
|
22
|
+
height: 100%;
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
border-radius: 40px;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
&:not(.active) {
|
|
30
|
+
border-radius: 40px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
.carouselItem {
|
|
34
|
+
// hover 渐变遮罩:常驻,通过透明度和 delay 控制
|
|
35
|
+
&:after {
|
|
36
|
+
content: '';
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
right: 0;
|
|
42
|
+
z-index: 2;
|
|
43
|
+
background: linear-gradient(180deg, #de001a, #ed6918 50%, #27298e);
|
|
44
|
+
opacity: 0;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
transition: opacity .3s ease .05s; // 0.4s 过渡,延时 0.15s
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:hover:after {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.active {
|
|
56
|
+
border-radius: 20px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
4
61
|
.cylon-carousel {
|
|
5
62
|
.slick-track {
|
|
6
63
|
display: flex;
|
|
@@ -23,7 +80,7 @@
|
|
|
23
80
|
background: #FFF;
|
|
24
81
|
cursor: inherit;
|
|
25
82
|
margin-right: 0.3em;
|
|
26
|
-
transition: all
|
|
83
|
+
transition: all ease 1s;
|
|
27
84
|
|
|
28
85
|
&.active {
|
|
29
86
|
width: 1.5em;
|
|
@@ -49,24 +106,39 @@
|
|
|
49
106
|
}
|
|
50
107
|
|
|
51
108
|
.carouselItem {
|
|
52
|
-
|
|
109
|
+
height: 100%;
|
|
53
110
|
display: flex;
|
|
54
111
|
position: relative;
|
|
55
|
-
//
|
|
112
|
+
// 防止选中文本
|
|
56
113
|
-webkit-user-select: none;
|
|
57
114
|
-moz-user-select: none;
|
|
58
115
|
-ms-user-select: none;
|
|
59
116
|
user-select: none;
|
|
60
117
|
-webkit-touch-callout: none;
|
|
61
118
|
|
|
62
|
-
|
|
63
|
-
|
|
119
|
+
img {
|
|
120
|
+
height: 400px;
|
|
121
|
+
object-fit: cover;
|
|
122
|
+
object-position: left;
|
|
123
|
+
pointer-events: none;
|
|
64
124
|
}
|
|
65
125
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
126
|
+
.itemName {
|
|
127
|
+
z-index: 3;
|
|
128
|
+
color: #fff;
|
|
129
|
+
font-family: Outfit, Open Sans, sans-serif;
|
|
130
|
+
font-size: 16px;
|
|
131
|
+
font-style: normal;
|
|
132
|
+
font-weight: 400;
|
|
133
|
+
line-height: 22px;
|
|
134
|
+
text-shadow: 2px 2px 10px #000;
|
|
135
|
+
transition: all .3s ease;
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
position: absolute;
|
|
138
|
+
bottom: 16px;
|
|
139
|
+
transform: rotate(-90deg);
|
|
140
|
+
.meta_wrap {
|
|
141
|
+
width: fit-content!important;
|
|
70
142
|
}
|
|
71
143
|
}
|
|
72
144
|
|
|
@@ -15,12 +15,27 @@ var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
|
|
|
15
15
|
|
|
16
16
|
var _SpacingConfig = _interopRequireDefault(require("../../../common/config-panels/SpacingConfig"));
|
|
17
17
|
|
|
18
|
+
var _layout = require("../../../../constants/layout");
|
|
19
|
+
|
|
20
|
+
var _CustomizeConfig = _interopRequireDefault(require("../../../common/config-panels/CustomizeConfig"));
|
|
21
|
+
|
|
18
22
|
var _locale = require("../../../../locale");
|
|
19
23
|
|
|
24
|
+
var _coreUtil = require("../../../../utils/coreUtil");
|
|
25
|
+
|
|
20
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
27
|
|
|
22
28
|
function BannerConfig(props) {
|
|
23
29
|
var data = props.data;
|
|
30
|
+
|
|
31
|
+
var getLayout = function getLayout(v) {
|
|
32
|
+
if ((0, _coreUtil.isPc)()) {
|
|
33
|
+
data.customize.layout.pcLayout = v;
|
|
34
|
+
} else {
|
|
35
|
+
data.customize.layout.h5Layout = v;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
24
39
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
|
|
25
40
|
divider: "bold",
|
|
26
41
|
headerSize: "large",
|
|
@@ -42,6 +57,17 @@ function BannerConfig(props) {
|
|
|
42
57
|
value: /*#__PURE__*/_react["default"].createElement(_SpacingConfig["default"], {
|
|
43
58
|
data: data.spacing
|
|
44
59
|
})
|
|
60
|
+
}, {
|
|
61
|
+
key: 'customize',
|
|
62
|
+
name: (0, _locale.i18n)('CUSTOMIZE'),
|
|
63
|
+
value: /*#__PURE__*/_react["default"].createElement(_CustomizeConfig["default"], {
|
|
64
|
+
data: data.customize,
|
|
65
|
+
layoutSource: (0, _coreUtil.isPc)() ? _layout.bannerPcLayout : _layout.bannerH5Layout,
|
|
66
|
+
selectedLayoutFun: function selectedLayoutFun(v) {
|
|
67
|
+
getLayout(v);
|
|
68
|
+
},
|
|
69
|
+
isHideAlign: true
|
|
70
|
+
})
|
|
45
71
|
}],
|
|
46
72
|
type: "triangle"
|
|
47
73
|
}));
|
|
@@ -62,7 +62,11 @@ function (_super) {
|
|
|
62
62
|
_this.state = {};
|
|
63
63
|
|
|
64
64
|
_this.getContentPanel = function () {
|
|
65
|
-
var
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
|
|
67
|
+
var _d = _this.props,
|
|
68
|
+
panelProps = _d.panelProps,
|
|
69
|
+
parentNode = _d.parentNode;
|
|
66
70
|
var source = [{
|
|
67
71
|
key: panelProps.image.id,
|
|
68
72
|
name: (0, _locale.i18n)('IMAGE'),
|
|
@@ -100,6 +104,18 @@ function (_super) {
|
|
|
100
104
|
}),
|
|
101
105
|
metaOption: panelProps.secondButton
|
|
102
106
|
}];
|
|
107
|
+
|
|
108
|
+
if (((_b = (_a = parentNode.customize) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.pcLayout) === 'layout2') {
|
|
109
|
+
source.unshift({
|
|
110
|
+
key: (_c = panelProps.name) === null || _c === void 0 ? void 0 : _c.id,
|
|
111
|
+
name: (0, _locale.i18n)('NAME'),
|
|
112
|
+
value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
|
|
113
|
+
data: panelProps.name
|
|
114
|
+
}),
|
|
115
|
+
metaOption: panelProps.name
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
103
119
|
return /*#__PURE__*/_react["default"].createElement(_Collapse["default"], {
|
|
104
120
|
headerSize: "middle",
|
|
105
121
|
onRefresh: function onRefresh() {
|