@fonixtree/magic-design 1.0.219 → 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.
Files changed (33) hide show
  1. package/es/common/LinkModal/index.js +3 -23
  2. package/es/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +13 -8
  3. package/es/composite-comp/bol/components/Banner/pc/index.less +6 -6
  4. package/es/composite-comp/dito/components/GroupedImage/defaultJSON.js +6 -7
  5. package/es/composite-comp/dito/components/GroupedImage/pc/index.js +243 -26
  6. package/es/composite-comp/dito/components/GroupedImage/pc/index.less +78 -9
  7. package/es/composite-comp/dito/components/Recommend/pc/index.js +2 -2
  8. package/es/composite-comp/dito/components/Recommend/pc/index.less +1 -1
  9. package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +127 -29
  10. package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
  11. package/es/constants/index.js +1 -1
  12. package/es/core/Designer/ConfigPanel/index.js +217 -4
  13. package/es/core/Designer/ConfigPanel/index.less +39 -0
  14. package/es/meta-comp/components/Image/index.js +15 -11
  15. package/es/meta-comp/config-panels/ImageConfig/index.js +25 -8
  16. package/es/mobx/Store.js +4 -1
  17. package/lib/common/LinkModal/index.js +3 -23
  18. package/lib/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +13 -8
  19. package/lib/composite-comp/bol/components/Banner/pc/index.less +6 -6
  20. package/lib/composite-comp/dito/components/GroupedImage/defaultJSON.js +6 -7
  21. package/lib/composite-comp/dito/components/GroupedImage/pc/index.js +243 -26
  22. package/lib/composite-comp/dito/components/GroupedImage/pc/index.less +78 -9
  23. package/lib/composite-comp/dito/components/Recommend/pc/index.js +2 -2
  24. package/lib/composite-comp/dito/components/Recommend/pc/index.less +1 -1
  25. package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +127 -29
  26. package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
  27. package/lib/constants/index.js +1 -1
  28. package/lib/core/Designer/ConfigPanel/index.js +217 -4
  29. package/lib/core/Designer/ConfigPanel/index.less +39 -0
  30. package/lib/meta-comp/components/Image/index.js +15 -11
  31. package/lib/meta-comp/config-panels/ImageConfig/index.js +25 -8
  32. package/lib/mobx/Store.js +4 -1
  33. package/package.json +1 -1
@@ -212,20 +212,6 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
212
212
  }
213
213
  };
214
214
 
215
- var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
216
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
217
- s += arguments[i].length;
218
- }
219
-
220
- for (var r = Array(s), k = 0, i = 0; i < il; i++) {
221
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
222
- r[k] = a[j];
223
- }
224
- }
225
-
226
- return r;
227
- };
228
-
229
215
  var LinkModal = function LinkModal(props) {
230
216
  var onConfirm = props.onConfirm,
231
217
  onClose = props.onClose,
@@ -250,7 +236,7 @@ var LinkModal = function LinkModal(props) {
250
236
 
251
237
  var getLinkTypes = function getLinkTypes() {
252
238
  return __awaiter(void 0, void 0, void 0, function () {
253
- var types, type, defaultTypes;
239
+ var types, type;
254
240
  return __generator(this, function (_a) {
255
241
  switch (_a.label) {
256
242
  case 0:
@@ -273,13 +259,7 @@ var LinkModal = function LinkModal(props) {
273
259
  }
274
260
  }
275
261
 
276
- defaultTypes = [{
277
- "linkTypeName": "Picture",
278
- "linkTypeCode": "Picture",
279
- "seq": 100,
280
- "comments": "Picture"
281
- }];
282
- setLinkTypes(__spreadArrays(types, defaultTypes));
262
+ setLinkTypes(types);
283
263
  setSelected(types[0].linkTypeCode);
284
264
  return [2
285
265
  /*return*/
@@ -388,7 +368,7 @@ var LinkModal = function LinkModal(props) {
388
368
  setLinkUrl(url);
389
369
  setTotal(t);
390
370
  }
391
- }), item.linkTypeCode === 'Picture' && /*#__PURE__*/_react["default"].createElement(_SelectPicture["default"], {
371
+ }), item.linkTypeCode === 'ImageLibrary' && /*#__PURE__*/_react["default"].createElement(_SelectPicture["default"], {
392
372
  onChange: function onChange(value) {
393
373
  return setLinkUrl(value);
394
374
  }
@@ -185,30 +185,36 @@ var SwiperBannerPc = function SwiperBannerPc(_a) {
185
185
  // 点击切换到对应轮播
186
186
  if (index !== currentIndex && slideCount > 1) {
187
187
  setCurrentIndex(index);
188
- onIndexChange(index);
188
+ onIndexChange(index); // 点击非激活项时,立即暂停自动播放
189
+
190
+ setIsPaused(true);
189
191
  }
190
192
  };
191
193
 
192
194
  var handleMouseEnter = function handleMouseEnter(isActive) {
195
+ // 鼠标进入激活项时暂停自动播放
193
196
  if (isActive) {
194
197
  setIsPaused(true);
195
198
  }
196
- };
199
+ }; // 容器级别的鼠标事件处理
197
200
 
198
- var handleMouseLeave = function handleMouseLeave() {
201
+
202
+ var handleContainerMouseLeave = function handleContainerMouseLeave() {
203
+ // 鼠标离开整个容器时,恢复自动播放
199
204
  setIsPaused(false);
200
205
  };
201
206
 
202
207
  (0, _react.useEffect)(function () {
203
- if (autoplay) {
204
- setIsPaused(false);
205
- } else {
208
+ // 如果 autoplay 关闭,强制暂停
209
+ // 如果 autoplay 开启,不强制恢复(保持用户交互的暂停状态)
210
+ if (!autoplay) {
206
211
  setIsPaused(true);
207
212
  }
208
213
  }, [autoplay]);
209
214
  return /*#__PURE__*/_react["default"].createElement("div", {
210
215
  ref: containerRef,
211
- className: "swiper-main"
216
+ className: "swiper-main",
217
+ onMouseLeave: handleContainerMouseLeave
212
218
  }, /*#__PURE__*/_react["default"].createElement("div", {
213
219
  className: "custom-carousel-wrapper"
214
220
  }, data.groupSource.map(function (item, index) {
@@ -222,7 +228,6 @@ var SwiperBannerPc = function SwiperBannerPc(_a) {
222
228
  onMouseEnter: function onMouseEnter() {
223
229
  return handleMouseEnter(isActive);
224
230
  },
225
- onMouseLeave: handleMouseLeave,
226
231
  style: {
227
232
  width: slideWidth,
228
233
  marginRight: index < slideCount - 1 ? thumbGap + "px" : '0',
@@ -124,9 +124,6 @@
124
124
  }
125
125
 
126
126
  .itemName {
127
- position: absolute;
128
- left: 0;
129
- bottom: 0;
130
127
  z-index: 3;
131
128
  color: #fff;
132
129
  font-family: Outfit, Open Sans, sans-serif;
@@ -134,12 +131,15 @@
134
131
  font-style: normal;
135
132
  font-weight: 400;
136
133
  line-height: 22px;
137
- position: absolute;
138
134
  text-shadow: 2px 2px 10px #000;
139
- transform: rotate(-90deg) translate(50%);
140
135
  transition: all .3s ease;
141
136
  white-space: nowrap;
142
- width: 100%;
137
+ position: absolute;
138
+ bottom: 16px;
139
+ transform: rotate(-90deg);
140
+ .meta_wrap {
141
+ width: fit-content!important;
142
+ }
143
143
  }
144
144
 
145
145
  .carouseContent {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.groupedImageGroupSourceJSON = exports.getDefaultJSON = void 0;
6
+ exports.groupedImageGroupSourceJSON = exports.getDefaultJSON = exports.createImageMeta = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
@@ -82,6 +82,8 @@ var createImageMeta = function createImageMeta(parentId) {
82
82
  };
83
83
  };
84
84
 
85
+ exports.createImageMeta = createImageMeta;
86
+
85
87
  var groupedImageGroupSourceJSON = function groupedImageGroupSourceJSON(parentId, text) {
86
88
  var groupId = (0, _uuid.v4)();
87
89
  var baseImage = createImageMeta(groupId);
@@ -92,10 +94,7 @@ var groupedImageGroupSourceJSON = function groupedImageGroupSourceJSON(parentId,
92
94
  image: baseImage,
93
95
  groupName: baseGroupName,
94
96
  title: createTextMeta(groupId, 'Group Title', '#CE1126', 16, 700),
95
- image1: createImageMeta(groupId),
96
- image2: createImageMeta(groupId),
97
- image3: createImageMeta(groupId),
98
- image4: createImageMeta(groupId),
97
+ images: [createImageMeta(groupId), createImageMeta(groupId), createImageMeta(groupId), createImageMeta(groupId)],
99
98
  hover: {
100
99
  open: true,
101
100
  image: __assign(__assign({}, createImageMeta(groupId)), {
@@ -122,14 +121,14 @@ var getDefaultJSON = function getDefaultJSON() {
122
121
  paddingBottom: 0,
123
122
  paddingLeft: 0,
124
123
  paddingRight: 0,
125
- marginBottom: window.magicDesign.compSpacing * 1.5
124
+ marginBottom: window.magicDesign.compSpacing ? window.magicDesign.compSpacing * 1.5 : 48
126
125
  },
127
126
  mobile: {
128
127
  paddingTop: 0,
129
128
  paddingBottom: 0,
130
129
  paddingLeft: 0,
131
130
  paddingRight: 0,
132
- marginBottom: window.magicDesign.compSpacing
131
+ marginBottom: window.magicDesign.compSpacing || 32
133
132
  }
134
133
  },
135
134
  customize: {
@@ -17,6 +17,12 @@ var _commonUtil = require("../../../../../utils/commonUtil");
17
17
 
18
18
  var _mobx = require("../../../../../mobx");
19
19
 
20
+ var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
21
+
22
+ var _lodash = _interopRequireDefault(require("lodash.throttle"));
23
+
24
+ var _coreUtil = require("../../../../../utils/coreUtil");
25
+
20
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
27
 
22
28
  var __extends = void 0 && (void 0).__extends || function () {
@@ -53,11 +59,84 @@ function (_super) {
53
59
  function GroupedImagePc() {
54
60
  var _this = _super !== null && _super.apply(this, arguments) || this;
55
61
 
62
+ _this.scrollRef = /*#__PURE__*/_react["default"].createRef();
63
+ _this.preGroupSource = '';
56
64
  _this.state = {
57
65
  tabIndex: 0,
58
66
  tabLeft: 0,
59
67
  tabWidth: 0,
60
- groupSource: []
68
+ groupSource: [],
69
+ scrollToLeftDisabled: true,
70
+ scrollToRightDisabled: true
71
+ }; // 数据迁移:将旧的image1-4迁移到images数组
72
+
73
+ _this.migrateData = function (groupSource) {
74
+ groupSource.forEach(function (group) {
75
+ // 如果存在旧的image1-4字段且没有images数组,进行迁移
76
+ if (!group.images && (group.image1 || group.image2 || group.image3 || group.image4)) {
77
+ group.images = [];
78
+ [group.image1, group.image2, group.image3, group.image4].forEach(function (img) {
79
+ if (img) {
80
+ group.images.push(img);
81
+ }
82
+ }); // 删除旧字段
83
+
84
+ delete group.image1;
85
+ delete group.image2;
86
+ delete group.image3;
87
+ delete group.image4;
88
+ } // 确保images数组存在
89
+
90
+
91
+ if (!group.images) {
92
+ group.images = [];
93
+ }
94
+ });
95
+ };
96
+
97
+ _this.initScroll = function (resetPosition) {
98
+ if (resetPosition === void 0) {
99
+ resetPosition = false;
100
+ }
101
+
102
+ setTimeout(function () {
103
+ var scrollDom = _this.scrollRef.current;
104
+
105
+ if (scrollDom) {
106
+ // 如果需要重置位置,将滚动条重置到最左边
107
+ if (resetPosition) {
108
+ // 先禁用滚动监听,避免触发状态更新
109
+ scrollDom.onscroll = null; // 使用requestAnimationFrame延迟一帧,让tab切换的视觉效果先完成
110
+
111
+ requestAnimationFrame(function () {
112
+ if (scrollDom) {
113
+ // 使用scrollTo并设置behavior为'auto',覆盖CSS的scroll-behavior: smooth
114
+ // 这样重置时不会有明显的滚动动画效果
115
+ scrollDom.scrollTo({
116
+ left: 0,
117
+ behavior: 'auto'
118
+ });
119
+ }
120
+ });
121
+ }
122
+
123
+ _this.setScrollDisabled(scrollDom);
124
+
125
+ scrollDom.onscroll = (0, _lodash["default"])(function () {
126
+ _this.setScrollDisabled(scrollDom);
127
+ }, 100);
128
+ }
129
+ }, 0);
130
+ };
131
+
132
+ _this.setScrollDisabled = function (scrollDom) {
133
+ var scrollToLeftDisabled = scrollDom.scrollLeft === 0;
134
+ var scrollToRightDisabled = scrollDom.clientWidth + scrollDom.scrollLeft >= scrollDom.scrollWidth - 1;
135
+
136
+ _this.setState({
137
+ scrollToLeftDisabled: scrollToLeftDisabled,
138
+ scrollToRightDisabled: scrollToRightDisabled
139
+ });
61
140
  };
62
141
 
63
142
  _this.initTab = function (index) {
@@ -81,19 +160,81 @@ function (_super) {
81
160
  tabIndex = _a.tabIndex,
82
161
  groupSource = _a.groupSource;
83
162
  if (tabIndex === index) return;
84
- var tab = groupSource[index];
163
+ var tab = groupSource[index]; // 在切换tab之前,立即重置滚动位置到最左边,避免滚动效果
164
+
165
+ var scrollDom = _this.scrollRef.current;
166
+
167
+ if (scrollDom) {
168
+ scrollDom.onscroll = null; // 先禁用滚动监听
169
+
170
+ scrollDom.scrollLeft = 0; // 立即重置,不使用任何动画
171
+ } // 先更新本地状态,确保tabIndex立即更新
172
+
85
173
 
86
174
  _this.setState({
87
175
  tabIndex: index
88
176
  }, function () {
89
- _this.initTab(index);
90
- });
177
+ _this.initTab(index); // 重新初始化滚动(不重置位置,因为已经重置过了)
178
+
179
+
180
+ _this.initScroll(false);
181
+ }); // 然后更新store状态,触发props更新
182
+ // 使用setTimeout确保本地状态先更新完成
183
+
184
+
185
+ setTimeout(function () {
186
+ if (tab) {
187
+ _mobx.store.setState({
188
+ clickedGroup: tab.id,
189
+ clickedFloor: _mobx.store.getFloorIdByGroupId(tab.id)
190
+ });
191
+ }
192
+ }, 0);
193
+ };
194
+
195
+ _this.scrollToRight = function () {
196
+ var scrollDom = _this.scrollRef.current;
197
+
198
+ if (scrollDom) {
199
+ var _a = _this.state,
200
+ tabIndex = _a.tabIndex,
201
+ groupSource = _a.groupSource;
202
+ var current = groupSource[tabIndex] || {};
203
+ var images = current.images || []; // 如果当前tab的图片可以滚动,则滚动图片
204
+
205
+ if (scrollDom.clientWidth + scrollDom.scrollLeft < scrollDom.scrollWidth - 1) {
206
+ scrollDom.scrollTo({
207
+ left: scrollDom.scrollLeft + scrollDom.clientWidth,
208
+ behavior: 'smooth'
209
+ });
210
+ } else {
211
+ // 否则切换到下一个tab
212
+ var nextTabIndex = (tabIndex + 1) % groupSource.length;
213
+
214
+ _this.onTabClick(null, nextTabIndex);
215
+ }
216
+ }
217
+ };
218
+
219
+ _this.scrollToLeft = function () {
220
+ var scrollDom = _this.scrollRef.current;
91
221
 
92
- if (tab) {
93
- _mobx.store.setState({
94
- clickedGroup: tab.id,
95
- clickedFloor: _mobx.store.getFloorIdByGroupId(tab.id)
96
- });
222
+ if (scrollDom) {
223
+ var _a = _this.state,
224
+ tabIndex = _a.tabIndex,
225
+ groupSource = _a.groupSource; // 如果当前tab的图片可以向左滚动,则滚动图片
226
+
227
+ if (scrollDom.scrollLeft > 0) {
228
+ scrollDom.scrollTo({
229
+ left: scrollDom.scrollLeft - scrollDom.clientWidth,
230
+ behavior: 'smooth'
231
+ });
232
+ } else {
233
+ // 否则切换到上一个tab
234
+ var prevTabIndex = (tabIndex - 1 + groupSource.length) % groupSource.length;
235
+
236
+ _this.onTabClick(null, prevTabIndex);
237
+ }
97
238
  }
98
239
  };
99
240
 
@@ -103,16 +244,22 @@ function (_super) {
103
244
  GroupedImagePc.prototype.componentDidMount = function () {
104
245
  var _this = this;
105
246
 
106
- var panelProps = this.props.panelProps;
247
+ var panelProps = this.props.panelProps; // 数据迁移
248
+
249
+ this.migrateData(panelProps.groupSource);
107
250
  var source = [];
108
251
  panelProps.groupSource.forEach(function (m) {
109
252
  var show = m.image.open || m.groupName.open;
110
253
  if (show) source.push(m);
111
254
  });
255
+ var groupSource = source.length > 0 ? source : panelProps.groupSource;
256
+ this.preGroupSource = JSON.stringify(groupSource);
112
257
  this.setState({
113
- groupSource: source.length > 0 ? source : panelProps.groupSource
258
+ groupSource: groupSource
114
259
  }, function () {
115
260
  _this.initTab(0);
261
+
262
+ _this.initScroll();
116
263
  });
117
264
  };
118
265
 
@@ -120,25 +267,39 @@ function (_super) {
120
267
  var _this = this;
121
268
 
122
269
  var tabIndex = this.state.tabIndex;
123
- var panelProps = nextProps.panelProps;
270
+ var panelProps = nextProps.panelProps; // 数据迁移
271
+
272
+ this.migrateData(panelProps.groupSource);
124
273
  var source = [];
125
274
  panelProps.groupSource.forEach(function (m) {
126
275
  var show = m.image.open || m.groupName.open;
127
276
  if (show) source.push(m);
128
277
  });
129
278
  var groupSource = source.length > 0 ? source : panelProps.groupSource;
130
- this.setState({
131
- groupSource: groupSource
132
- }, function () {
133
- var newTabIndex = tabIndex;
134
- if (tabIndex >= groupSource.length) newTabIndex = 0;
279
+ var groupSourceStr = JSON.stringify(groupSource); // 只有当groupSource真正变化时才更新状态
280
+
281
+ if (groupSourceStr !== this.preGroupSource) {
282
+ this.preGroupSource = groupSourceStr;
283
+ this.setState({
284
+ groupSource: groupSource
285
+ }, function () {
286
+ // 使用当前的tabIndex,确保获取最新状态
287
+ var currentTabIndex = _this.state.tabIndex;
288
+ var newTabIndex = currentTabIndex;
289
+ if (currentTabIndex >= groupSource.length) newTabIndex = 0;
135
290
 
136
- _this.initTab(newTabIndex);
291
+ _this.initTab(newTabIndex);
137
292
 
138
- _this.setState({
139
- tabIndex: newTabIndex
293
+ _this.initScroll(); // 只有当tabIndex需要调整时才更新
294
+
295
+
296
+ if (newTabIndex !== currentTabIndex) {
297
+ _this.setState({
298
+ tabIndex: newTabIndex
299
+ });
300
+ }
140
301
  });
141
- });
302
+ }
142
303
  };
143
304
 
144
305
  GroupedImagePc.prototype.render = function () {
@@ -148,15 +309,20 @@ function (_super) {
148
309
  tabIndex = _a.tabIndex,
149
310
  tabLeft = _a.tabLeft,
150
311
  tabWidth = _a.tabWidth,
151
- groupSource = _a.groupSource;
312
+ groupSource = _a.groupSource,
313
+ scrollToLeftDisabled = _a.scrollToLeftDisabled,
314
+ scrollToRightDisabled = _a.scrollToRightDisabled;
152
315
  var current = groupSource[tabIndex] || {};
316
+ var images = current.images || [];
153
317
 
154
318
  var _image = current.hover && current.hover.open && current.hover.image.open ? current.hover.image : current.image;
155
319
 
156
320
  var _groupName = current.hover && current.hover.open && current.hover.groupName.open ? current.hover.groupName : current.groupName;
157
321
 
158
322
  return /*#__PURE__*/_react["default"].createElement("div", {
159
- className: "m-grouped-image-pc"
323
+ className: (0, _classnames["default"])('m-grouped-image-pc', {
324
+ 'less-than-4': images.length <= 4
325
+ })
160
326
  }, /*#__PURE__*/_react["default"].createElement("div", {
161
327
  className: "tab-select-wrap"
162
328
  }, groupSource.map(function (tab, index) {
@@ -176,17 +342,68 @@ function (_super) {
176
342
  className: "title",
177
343
  data: current.title
178
344
  }), /*#__PURE__*/_react["default"].createElement("div", {
179
- className: "image-list"
180
- }, [current.image1, current.image2, current.image3, current.image4].map(function (img, idx) {
345
+ className: "image-list-wrapper"
346
+ }, images.length > 0 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
347
+ className: "image-list",
348
+ ref: this.scrollRef
349
+ }, images.map(function (img, idx) {
181
350
  if (!img || !img.open) return null;
182
351
  return /*#__PURE__*/_react["default"].createElement("div", {
183
352
  key: (0, _commonUtil.ensure)(function () {
184
353
  return img.id;
185
354
  }, idx),
186
- className: "image-item"
355
+ className: "image-item",
356
+ onClick: function onClick(e) {
357
+ // 只在设计模式下才触发联动
358
+ if (!(0, _coreUtil.isDesignMode)()) {
359
+ return;
360
+ } // 点击图片时,联动到第三级属性面板
361
+
362
+
363
+ e.stopPropagation();
364
+ e.preventDefault(); // 获取当前tab的group id和楼层id
365
+
366
+ var panelProps = _this.props.panelProps;
367
+ var currentGroupId = current.id; // panelProps.id 就是楼层ID
368
+
369
+ var floorId = panelProps.id; // 一次性设置所有需要的状态,确保联动正常
370
+
371
+ _mobx.store.setState({
372
+ clickedGroup: currentGroupId,
373
+ clickedFloor: floorId,
374
+ clickedImage: img.id
375
+ });
376
+ },
377
+ style: {
378
+ cursor: (0, _coreUtil.isDesignMode)() ? 'pointer' : 'default'
379
+ }
187
380
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
188
381
  data: img
189
382
  }));
383
+ }))), images.length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
384
+ className: "image-list"
385
+ }, /*#__PURE__*/_react["default"].createElement("div", {
386
+ className: "empty-placeholder"
387
+ }, "No images")))), /*#__PURE__*/_react["default"].createElement("div", {
388
+ className: "arrow-icon-wrapper"
389
+ }, /*#__PURE__*/_react["default"].createElement("div", {
390
+ className: (0, _classnames["default"])('arrow-icon', 'left', {
391
+ disabled: scrollToLeftDisabled && tabIndex === 0 && groupSource.length <= 1
392
+ }),
393
+ onClick: this.scrollToLeft
394
+ }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
395
+ color: "#fff",
396
+ size: 16,
397
+ type: "icon-outlined-left"
398
+ })), /*#__PURE__*/_react["default"].createElement("div", {
399
+ className: (0, _classnames["default"])('arrow-icon', 'right', {
400
+ disabled: scrollToRightDisabled && tabIndex === groupSource.length - 1 && groupSource.length <= 1
401
+ }),
402
+ onClick: this.scrollToRight
403
+ }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
404
+ color: "#fff",
405
+ size: 16,
406
+ type: "icon-outlined-right"
190
407
  }))));
191
408
  };
192
409
 
@@ -3,10 +3,20 @@
3
3
  flex-direction: column;
4
4
  position: relative;
5
5
 
6
+ &.less-than-4 {
7
+ .image-list-wrapper {
8
+ padding-left: 0!important;
9
+ .image-list {
10
+ width: fit-content;
11
+ margin: 0 auto;
12
+ }
13
+ }
14
+ }
15
+
6
16
  .tab-select-wrap {
7
17
  display: flex;
8
18
  align-items: center;
9
- height: 50px;
19
+ gap: 16px;
10
20
  background: #ffffff;
11
21
  overflow: auto;
12
22
  position: relative;
@@ -19,14 +29,13 @@
19
29
  text-align: center;
20
30
  padding: 0; // 无缝衔接:去掉左右间距
21
31
  width: fit-content;
22
- height: 100%;
23
32
  justify-content: center;
24
33
  white-space: nowrap;
25
34
  flex-direction: column;
26
35
  cursor: pointer;
27
36
 
28
37
  img {
29
- height: 50px;
38
+ max-height: 50px;
30
39
  margin-bottom: 2px;
31
40
  }
32
41
  }
@@ -38,15 +47,75 @@
38
47
  margin-bottom: 16px;
39
48
  }
40
49
 
41
- .image-list {
50
+ .image-list-wrapper {
51
+ padding-left: 88px;
52
+ position: relative;
53
+
54
+ .image-list {
55
+ display: flex;
56
+ flex-direction: row;
57
+ gap: 16px;
58
+ overflow-x: auto;
59
+ overflow-y: hidden;
60
+ flex: 1;
61
+ scroll-behavior: smooth;
62
+ -webkit-overflow-scrolling: touch;
63
+
64
+ &::-webkit-scrollbar {
65
+ display: none;
66
+ }
67
+
68
+ scrollbar-width: none;
69
+
70
+ .image-item {
71
+ flex-shrink: 0;
72
+ width: 300px;
73
+
74
+ &:last-child {
75
+ margin-right: 40px;
76
+ }
77
+ }
78
+
79
+ .empty-placeholder {
80
+ width: 100%;
81
+ text-align: center;
82
+ color: #999;
83
+ padding: 40px 0;
84
+ font-size: 14px;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ .arrow-icon-wrapper {
91
+ display: flex;
92
+ justify-content: end;
93
+ padding: 24px 0;
94
+ padding-right: 75px;
95
+
96
+ .arrow-icon {
42
97
  display: flex;
43
- flex-direction: row;
98
+ align-items: center;
44
99
  justify-content: center;
45
- gap: 16px;
100
+ width: 40px;
101
+ height: 40px;
102
+ background: #CE1126;
103
+ border-radius: 100px;
104
+ cursor: pointer;
105
+ flex-shrink: 0;
106
+ z-index: 1;
46
107
 
47
- .image-item {
48
- flex: 1;
49
- max-width: 23%;
108
+ &.left {
109
+ margin-right: 16px;
110
+ }
111
+
112
+ &.right {
113
+ // margin-left: 15px;
114
+ }
115
+
116
+ &.disabled {
117
+ cursor: not-allowed;
118
+ opacity: 0.5;
50
119
  }
51
120
  }
52
121
  }
@@ -279,7 +279,7 @@ function (_super) {
279
279
  };
280
280
 
281
281
  _this.initTab = function (index, hideTabs) {
282
- var selectedTabDom = document.querySelector(".tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
282
+ var selectedTabDom = document.querySelector(".recommend-tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
283
283
  var tabLeft = 0;
284
284
  var tabWidth = 0;
285
285
 
@@ -642,7 +642,7 @@ function (_super) {
642
642
  return /*#__PURE__*/_react["default"].createElement("div", {
643
643
  className: "m-recommend-pc"
644
644
  }, !hideTabs && /*#__PURE__*/_react["default"].createElement("div", {
645
- className: "tab-select-wrap"
645
+ className: "recommend-tab-select-wrap"
646
646
  }, groupSource.map(function (tab, index) {
647
647
  var _image = index == tabIndex && tab.hover.open && tab.hover.image.open ? tab.hover.image : tab.image;
648
648
 
@@ -13,7 +13,7 @@
13
13
  // display: none;
14
14
  // }
15
15
 
16
- .tab-select-wrap {
16
+ .recommend-tab-select-wrap {
17
17
  display: flex;
18
18
  align-items: center;
19
19
  height: 50px;