@fonixtree/magic-design 1.0.204 → 1.0.206

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.
@@ -128,6 +128,7 @@ function (_super) {
128
128
  return /*#__PURE__*/_react["default"].createElement("img", _extends({
129
129
  ref: this.imageRef,
130
130
  alt: "",
131
+ draggable: "false",
131
132
  className: (0, _classnames["default"])('new-img-container', className),
132
133
  src: isShow ? src : '',
133
134
  style: __assign({
@@ -83,7 +83,10 @@ function (_super) {
83
83
 
84
84
  _this.state = {
85
85
  carouseIndex: 0,
86
- hoverState: false
86
+ hoverState: false,
87
+ isDragging: false,
88
+ startX: 0,
89
+ startY: 0
87
90
  };
88
91
  _this.carouselRef = /*#__PURE__*/_react["default"].createRef();
89
92
  _this.destroy = null;
@@ -136,6 +139,85 @@ function (_super) {
136
139
  if ((_b = data.setting.navigation) === null || _b === void 0 ? void 0 : _b.size) {
137
140
  e.target.style.fontSize = data.setting.navigation.size;
138
141
  }
142
+ }; // 鼠标拖拽相关方法
143
+
144
+
145
+ _this.handleMouseDown = function (e) {
146
+ var _a; // 设计器模式下禁用拖拽
147
+
148
+
149
+ if ((0, _coreUtil.isDesignMode)() && ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) !== 'renderer') {
150
+ return;
151
+ }
152
+
153
+ _this.setState({
154
+ isDragging: true,
155
+ startX: e.clientX,
156
+ startY: e.clientY
157
+ });
158
+ };
159
+
160
+ _this.handleMouseMove = function (e) {
161
+ if (!_this.state.isDragging) return; // 防止默认行为,避免选中文本
162
+
163
+ e.preventDefault();
164
+ };
165
+
166
+ _this.handleMouseUp = function (e) {
167
+ _this.processMouseUp(e.clientX, e.clientY);
168
+ };
169
+
170
+ _this.handleGlobalMouseMove = function (e) {
171
+ if (!_this.state.isDragging) return; // 防止默认行为,避免选中文本
172
+
173
+ e.preventDefault();
174
+ };
175
+
176
+ _this.handleGlobalMouseUp = function (e) {
177
+ if (!_this.state.isDragging) return;
178
+
179
+ _this.processMouseUp(e.clientX, e.clientY);
180
+ };
181
+
182
+ _this.processMouseUp = function (endX, endY) {
183
+ var _a, _b;
184
+
185
+ if (!_this.state.isDragging) return;
186
+ var _c = _this.state,
187
+ startX = _c.startX,
188
+ startY = _c.startY;
189
+ var deltaX = startX - endX;
190
+ var deltaY = startY - endY; // 重置拖拽状态
191
+
192
+ _this.setState({
193
+ isDragging: false,
194
+ startX: 0,
195
+ startY: 0
196
+ }); // 判断是否为水平滑动(水平距离大于垂直距离,且水平距离超过阈值)
197
+
198
+
199
+ var minSwipeDistance = 50; // 最小滑动距离阈值
200
+
201
+ if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > minSwipeDistance) {
202
+ if (deltaX > 0) {
203
+ // 向左滑动,切换到下一页
204
+ (_a = _this.carouselRef.current) === null || _a === void 0 ? void 0 : _a.next();
205
+ } else {
206
+ // 向右滑动,切换到上一页
207
+ (_b = _this.carouselRef.current) === null || _b === void 0 ? void 0 : _b.prev();
208
+ }
209
+ }
210
+ };
211
+
212
+ _this.handleMouseLeave = function () {
213
+ // 鼠标离开时重置拖拽状态
214
+ if (_this.state.isDragging) {
215
+ _this.setState({
216
+ isDragging: false,
217
+ startX: 0,
218
+ startY: 0
219
+ });
220
+ }
139
221
  }; // padding用统一设置
140
222
 
141
223
 
@@ -195,9 +277,16 @@ function (_super) {
195
277
  BannerPc.prototype.componentDidMount = function () {
196
278
  var _this = this;
197
279
 
280
+ var _a;
281
+
198
282
  this.destroy = (0, _mobx.autorun)(function () {
199
283
  _this.bannerGoto(_this.props.data.groupSource);
200
- });
284
+ }); // 添加全局鼠标事件监听,处理鼠标移出元素的情况
285
+
286
+ if (!(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer') {
287
+ document.addEventListener('mousemove', this.handleGlobalMouseMove);
288
+ document.addEventListener('mouseup', this.handleGlobalMouseUp);
289
+ }
201
290
  };
202
291
 
203
292
  BannerPc.prototype.componentWillReceiveProps = function (nextProps) {
@@ -205,7 +294,10 @@ function (_super) {
205
294
  };
206
295
 
207
296
  BannerPc.prototype.componentWillUnmount = function () {
208
- this.destroy();
297
+ this.destroy(); // 移除全局鼠标事件监听
298
+
299
+ document.removeEventListener('mousemove', this.handleGlobalMouseMove);
300
+ document.removeEventListener('mouseup', this.handleGlobalMouseUp);
209
301
  };
210
302
 
211
303
  BannerPc.prototype.render = function () {
@@ -250,17 +342,28 @@ function (_super) {
250
342
  autoplaySpeed: data.setting.autoplay.interval * 1000,
251
343
  dots: false
252
344
  }, data.groupSource.map(function (item, index) {
253
- var _a, _b;
345
+ var _a, _b, _c;
254
346
 
255
347
  return /*#__PURE__*/_react["default"].createElement("div", {
256
348
  key: item.id
257
349
  }, /*#__PURE__*/_react["default"].createElement("div", {
258
350
  style: _this.getBackgroundStyle(item)
259
351
  }, /*#__PURE__*/_react["default"].createElement("div", {
260
- className: "carouselItem",
352
+ className: (0, _classnames["default"])('carouselItem', {
353
+ dragging: _this.state.isDragging
354
+ }),
261
355
  onMouseEnter: _this.mouseEnterWrap,
262
- onMouseLeave: _this.mouseLeaveWrap,
263
- style: _this.getItemStyle(item)
356
+ onMouseLeave: function onMouseLeave(e) {
357
+ _this.mouseLeaveWrap();
358
+
359
+ _this.handleMouseLeave();
360
+ },
361
+ onMouseDown: _this.handleMouseDown,
362
+ onMouseMove: _this.handleMouseMove,
363
+ onMouseUp: _this.handleMouseUp,
364
+ style: __assign(__assign({}, _this.getItemStyle(item)), {
365
+ cursor: _this.state.isDragging ? 'grabbing' : !(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer' ? 'grab' : 'default'
366
+ })
264
367
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
265
368
  data: item.image,
266
369
  GAData: __assign(__assign({}, GAData), {
@@ -296,7 +399,7 @@ function (_super) {
296
399
  className: "btn-wrap",
297
400
  style: {
298
401
  justifyContent: _AlignSelector.alignItemMap[item.customize.align],
299
- width: Math.max((_a = item.title.content) === null || _a === void 0 ? void 0 : _a.pcWidth, (_b = item.text.content) === null || _b === void 0 ? void 0 : _b.pcWidth) + "%"
402
+ width: Math.max((_b = item.title.content) === null || _b === void 0 ? void 0 : _b.pcWidth, (_c = item.text.content) === null || _c === void 0 ? void 0 : _c.pcWidth) + "%"
300
403
  }
301
404
  }, item.button.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
302
405
  className: "btn",
@@ -41,17 +41,27 @@
41
41
  }
42
42
 
43
43
  .leftBtn {
44
- left: 20px;
44
+ left: 70px;
45
45
  }
46
46
 
47
47
  .rightBtn {
48
- right: 20px;
48
+ right: 70px;
49
49
  }
50
50
 
51
51
  .carouselItem {
52
52
  // height: 360px;
53
53
  display: flex;
54
54
  position: relative;
55
+ // 拖拽相关样式
56
+ -webkit-user-select: none;
57
+ -moz-user-select: none;
58
+ -ms-user-select: none;
59
+ user-select: none;
60
+ -webkit-touch-callout: none;
61
+
62
+ &.dragging {
63
+ cursor: grabbing !important;
64
+ }
55
65
 
56
66
  .carouseContent {
57
67
  padding: 0 80px;
@@ -77,12 +77,14 @@ function (_super) {
77
77
  data = _b.data,
78
78
  onItemClick = _b.onItemClick,
79
79
  hideLabels = _b.hideLabels,
80
- rest = __rest(_b, ["data", "onItemClick", "hideLabels"]);
80
+ rest = __rest(_b, ["data", "onItemClick", "hideLabels"]); // data.labels = [
81
+ // {
82
+ // position: '2',
83
+ // imgUrl: '/get/resource/platform/20250425/picture/Frame42731928621915591174458650624.png',
84
+ // },
85
+ // ];
86
+
81
87
 
82
- data.labels = [{
83
- position: '2',
84
- imgUrl: '/get/resource/platform/20250425/picture/Frame42731928621915591174458650624.png'
85
- }];
86
88
  var imgLabels = ((_a = data.labels) === null || _a === void 0 ? void 0 : _a.filter(function (f) {
87
89
  return f.position !== '6' && f.position !== '7' && f.position !== '8';
88
90
  })) || [];
@@ -307,7 +307,10 @@ function (_super) {
307
307
  now: '',
308
308
  isWill: false,
309
309
  scrollToLeftDisabled: true,
310
- scrollToRightDisabled: true
310
+ scrollToRightDisabled: true,
311
+ isDragging: false,
312
+ startX: 0,
313
+ startScrollLeft: 0
311
314
  };
312
315
 
313
316
  _this.getFlashData = function (pageSize, campaign) {
@@ -424,6 +427,86 @@ function (_super) {
424
427
  if (scrollDom.scrollLeft > 0) {
425
428
  scrollDom.scrollTo(scrollDom.scrollLeft - scrollDom.clientWidth, 0);
426
429
  }
430
+ }; // 鼠标拖拽滚动相关方法
431
+
432
+
433
+ _this.handleMouseDown = function (e) {
434
+ var _a; // 设计器模式下禁用拖拽
435
+
436
+
437
+ if ((0, _coreUtil.isDesignMode)() && ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) !== 'renderer') {
438
+ return;
439
+ }
440
+
441
+ var scrollDom = _this.scrollRef.current;
442
+ if (!scrollDom) return;
443
+
444
+ _this.setState({
445
+ isDragging: true,
446
+ startX: e.clientX,
447
+ startScrollLeft: scrollDom.scrollLeft
448
+ });
449
+ };
450
+
451
+ _this.handleMouseMove = function (e) {
452
+ if (!_this.state.isDragging) return;
453
+ e.preventDefault();
454
+
455
+ _this.updateScrollPosition(e.clientX);
456
+ };
457
+
458
+ _this.handleGlobalMouseMove = function (e) {
459
+ if (!_this.state.isDragging) return;
460
+ e.preventDefault();
461
+
462
+ _this.updateScrollPosition(e.clientX);
463
+ };
464
+
465
+ _this.handleGlobalMouseUp = function (e) {
466
+ if (!_this.state.isDragging) return;
467
+
468
+ _this.setState({
469
+ isDragging: false,
470
+ startX: 0,
471
+ startScrollLeft: 0
472
+ });
473
+ };
474
+
475
+ _this.handleMouseUp = function (e) {
476
+ if (!_this.state.isDragging) return;
477
+
478
+ _this.setState({
479
+ isDragging: false,
480
+ startX: 0,
481
+ startScrollLeft: 0
482
+ });
483
+ };
484
+
485
+ _this.handleMouseLeave = function () {
486
+ // 鼠标离开时重置拖拽状态
487
+ if (_this.state.isDragging) {
488
+ _this.setState({
489
+ isDragging: false,
490
+ startX: 0,
491
+ startScrollLeft: 0
492
+ });
493
+ }
494
+ };
495
+
496
+ _this.updateScrollPosition = function (currentX) {
497
+ var scrollDom = _this.scrollRef.current;
498
+ if (!scrollDom) return;
499
+ var _a = _this.state,
500
+ startX = _a.startX,
501
+ startScrollLeft = _a.startScrollLeft;
502
+ var deltaX = currentX - startX;
503
+ var newScrollLeft = startScrollLeft - deltaX; // 限制滚动范围
504
+
505
+ var maxScrollLeft = scrollDom.scrollWidth - scrollDom.clientWidth;
506
+ var clampedScrollLeft = Math.max(0, Math.min(newScrollLeft, maxScrollLeft));
507
+ scrollDom.scrollLeft = clampedScrollLeft;
508
+
509
+ _this.setScrollDisabled(scrollDom);
427
510
  };
428
511
 
429
512
  return _this;
@@ -432,6 +515,8 @@ function (_super) {
432
515
  FlashDealPc.prototype.componentDidMount = function () {
433
516
  var _this = this;
434
517
 
518
+ var _a;
519
+
435
520
  this.sortType = this.props.panelProps.content.sortType;
436
521
  this.getNextFlashSale();
437
522
  setTimeout(function () {
@@ -444,7 +529,12 @@ function (_super) {
444
529
  _this.setScrollDisabled(scrollDom);
445
530
  }, 500);
446
531
  }
447
- }, 0);
532
+ }, 0); // 添加全局鼠标事件监听,处理鼠标拖拽滚动
533
+
534
+ if (!(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer') {
535
+ document.addEventListener('mousemove', this.handleGlobalMouseMove);
536
+ document.addEventListener('mouseup', this.handleGlobalMouseUp);
537
+ }
448
538
  };
449
539
 
450
540
  FlashDealPc.prototype.componentWillReceiveProps = function (nextProps) {
@@ -471,20 +561,26 @@ function (_super) {
471
561
  }
472
562
  };
473
563
 
564
+ FlashDealPc.prototype.componentWillUnmount = function () {
565
+ // 移除全局鼠标事件监听
566
+ document.removeEventListener('mousemove', this.handleGlobalMouseMove);
567
+ document.removeEventListener('mouseup', this.handleGlobalMouseUp);
568
+ };
569
+
474
570
  FlashDealPc.prototype.render = function () {
475
571
  var _this = this;
476
572
 
477
- var _a, _b;
573
+ var _a, _b, _c;
478
574
 
479
575
  var panelProps = this.props.panelProps;
480
- var _c = this.state,
481
- list = _c.list,
482
- effDate = _c.effDate,
483
- expDate = _c.expDate,
484
- now = _c.now,
485
- isWill = _c.isWill,
486
- scrollToLeftDisabled = _c.scrollToLeftDisabled,
487
- scrollToRightDisabled = _c.scrollToRightDisabled;
576
+ var _d = this.state,
577
+ list = _d.list,
578
+ effDate = _d.effDate,
579
+ expDate = _d.expDate,
580
+ now = _d.now,
581
+ isWill = _d.isWill,
582
+ scrollToLeftDisabled = _d.scrollToLeftDisabled,
583
+ scrollToRightDisabled = _d.scrollToRightDisabled;
488
584
 
489
585
  var _list = list.length === 0 && (0, _coreUtil.isDesignMode)() ? defaultData : list;
490
586
 
@@ -526,7 +622,14 @@ function (_super) {
526
622
  type: "icon-outlined-left"
527
623
  })), /*#__PURE__*/_react["default"].createElement("div", {
528
624
  ref: this.scrollRef,
529
- className: "flash-deal-list"
625
+ className: "flash-deal-list",
626
+ onMouseDown: this.handleMouseDown,
627
+ onMouseMove: this.handleMouseMove,
628
+ onMouseUp: this.handleMouseUp,
629
+ onMouseLeave: this.handleMouseLeave,
630
+ style: {
631
+ cursor: this.state.isDragging ? 'grabbing' : !(0, _coreUtil.isDesignMode)() || ((_c = window.magicDesign) === null || _c === void 0 ? void 0 : _c.mode) === 'renderer' ? 'grab' : 'default'
632
+ }
530
633
  }, _list.map(function (item) {
531
634
  return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
532
635
  key: item.id,
@@ -93,6 +93,23 @@
93
93
  position: relative;
94
94
  flex: 1;
95
95
  gap: 40px;
96
+ // 拖拽相关样式
97
+ -webkit-user-select: none;
98
+ -moz-user-select: none;
99
+ -ms-user-select: none;
100
+ user-select: none;
101
+ -webkit-touch-callout: none;
102
+ // 隐藏滚动条但保持滚动功能
103
+ scrollbar-width: none; /* Firefox */
104
+ -ms-overflow-style: none; /* IE and Edge */
105
+
106
+ &::-webkit-scrollbar {
107
+ display: none; /* Chrome, Safari, Opera */
108
+ }
109
+
110
+ &.dragging {
111
+ cursor: grabbing !important;
112
+ }
96
113
  }
97
114
  }
98
115
 
@@ -128,6 +128,7 @@ function (_super) {
128
128
  return /*#__PURE__*/_react["default"].createElement("img", _extends({
129
129
  ref: this.imageRef,
130
130
  alt: "",
131
+ draggable: "false",
131
132
  className: (0, _classnames["default"])('new-img-container', className),
132
133
  src: isShow ? src : '',
133
134
  style: __assign({
@@ -83,7 +83,10 @@ function (_super) {
83
83
 
84
84
  _this.state = {
85
85
  carouseIndex: 0,
86
- hoverState: false
86
+ hoverState: false,
87
+ isDragging: false,
88
+ startX: 0,
89
+ startY: 0
87
90
  };
88
91
  _this.carouselRef = /*#__PURE__*/_react["default"].createRef();
89
92
  _this.destroy = null;
@@ -136,6 +139,85 @@ function (_super) {
136
139
  if ((_b = data.setting.navigation) === null || _b === void 0 ? void 0 : _b.size) {
137
140
  e.target.style.fontSize = data.setting.navigation.size;
138
141
  }
142
+ }; // 鼠标拖拽相关方法
143
+
144
+
145
+ _this.handleMouseDown = function (e) {
146
+ var _a; // 设计器模式下禁用拖拽
147
+
148
+
149
+ if ((0, _coreUtil.isDesignMode)() && ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) !== 'renderer') {
150
+ return;
151
+ }
152
+
153
+ _this.setState({
154
+ isDragging: true,
155
+ startX: e.clientX,
156
+ startY: e.clientY
157
+ });
158
+ };
159
+
160
+ _this.handleMouseMove = function (e) {
161
+ if (!_this.state.isDragging) return; // 防止默认行为,避免选中文本
162
+
163
+ e.preventDefault();
164
+ };
165
+
166
+ _this.handleMouseUp = function (e) {
167
+ _this.processMouseUp(e.clientX, e.clientY);
168
+ };
169
+
170
+ _this.handleGlobalMouseMove = function (e) {
171
+ if (!_this.state.isDragging) return; // 防止默认行为,避免选中文本
172
+
173
+ e.preventDefault();
174
+ };
175
+
176
+ _this.handleGlobalMouseUp = function (e) {
177
+ if (!_this.state.isDragging) return;
178
+
179
+ _this.processMouseUp(e.clientX, e.clientY);
180
+ };
181
+
182
+ _this.processMouseUp = function (endX, endY) {
183
+ var _a, _b;
184
+
185
+ if (!_this.state.isDragging) return;
186
+ var _c = _this.state,
187
+ startX = _c.startX,
188
+ startY = _c.startY;
189
+ var deltaX = startX - endX;
190
+ var deltaY = startY - endY; // 重置拖拽状态
191
+
192
+ _this.setState({
193
+ isDragging: false,
194
+ startX: 0,
195
+ startY: 0
196
+ }); // 判断是否为水平滑动(水平距离大于垂直距离,且水平距离超过阈值)
197
+
198
+
199
+ var minSwipeDistance = 50; // 最小滑动距离阈值
200
+
201
+ if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > minSwipeDistance) {
202
+ if (deltaX > 0) {
203
+ // 向左滑动,切换到下一页
204
+ (_a = _this.carouselRef.current) === null || _a === void 0 ? void 0 : _a.next();
205
+ } else {
206
+ // 向右滑动,切换到上一页
207
+ (_b = _this.carouselRef.current) === null || _b === void 0 ? void 0 : _b.prev();
208
+ }
209
+ }
210
+ };
211
+
212
+ _this.handleMouseLeave = function () {
213
+ // 鼠标离开时重置拖拽状态
214
+ if (_this.state.isDragging) {
215
+ _this.setState({
216
+ isDragging: false,
217
+ startX: 0,
218
+ startY: 0
219
+ });
220
+ }
139
221
  }; // padding用统一设置
140
222
 
141
223
 
@@ -195,9 +277,16 @@ function (_super) {
195
277
  BannerPc.prototype.componentDidMount = function () {
196
278
  var _this = this;
197
279
 
280
+ var _a;
281
+
198
282
  this.destroy = (0, _mobx.autorun)(function () {
199
283
  _this.bannerGoto(_this.props.data.groupSource);
200
- });
284
+ }); // 添加全局鼠标事件监听,处理鼠标移出元素的情况
285
+
286
+ if (!(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer') {
287
+ document.addEventListener('mousemove', this.handleGlobalMouseMove);
288
+ document.addEventListener('mouseup', this.handleGlobalMouseUp);
289
+ }
201
290
  };
202
291
 
203
292
  BannerPc.prototype.componentWillReceiveProps = function (nextProps) {
@@ -205,7 +294,10 @@ function (_super) {
205
294
  };
206
295
 
207
296
  BannerPc.prototype.componentWillUnmount = function () {
208
- this.destroy();
297
+ this.destroy(); // 移除全局鼠标事件监听
298
+
299
+ document.removeEventListener('mousemove', this.handleGlobalMouseMove);
300
+ document.removeEventListener('mouseup', this.handleGlobalMouseUp);
209
301
  };
210
302
 
211
303
  BannerPc.prototype.render = function () {
@@ -250,17 +342,28 @@ function (_super) {
250
342
  autoplaySpeed: data.setting.autoplay.interval * 1000,
251
343
  dots: false
252
344
  }, data.groupSource.map(function (item, index) {
253
- var _a, _b;
345
+ var _a, _b, _c;
254
346
 
255
347
  return /*#__PURE__*/_react["default"].createElement("div", {
256
348
  key: item.id
257
349
  }, /*#__PURE__*/_react["default"].createElement("div", {
258
350
  style: _this.getBackgroundStyle(item)
259
351
  }, /*#__PURE__*/_react["default"].createElement("div", {
260
- className: "carouselItem",
352
+ className: (0, _classnames["default"])('carouselItem', {
353
+ dragging: _this.state.isDragging
354
+ }),
261
355
  onMouseEnter: _this.mouseEnterWrap,
262
- onMouseLeave: _this.mouseLeaveWrap,
263
- style: _this.getItemStyle(item)
356
+ onMouseLeave: function onMouseLeave(e) {
357
+ _this.mouseLeaveWrap();
358
+
359
+ _this.handleMouseLeave();
360
+ },
361
+ onMouseDown: _this.handleMouseDown,
362
+ onMouseMove: _this.handleMouseMove,
363
+ onMouseUp: _this.handleMouseUp,
364
+ style: __assign(__assign({}, _this.getItemStyle(item)), {
365
+ cursor: _this.state.isDragging ? 'grabbing' : !(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer' ? 'grab' : 'default'
366
+ })
264
367
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
265
368
  data: item.image,
266
369
  GAData: __assign(__assign({}, GAData), {
@@ -296,7 +399,7 @@ function (_super) {
296
399
  className: "btn-wrap",
297
400
  style: {
298
401
  justifyContent: _AlignSelector.alignItemMap[item.customize.align],
299
- width: Math.max((_a = item.title.content) === null || _a === void 0 ? void 0 : _a.pcWidth, (_b = item.text.content) === null || _b === void 0 ? void 0 : _b.pcWidth) + "%"
402
+ width: Math.max((_b = item.title.content) === null || _b === void 0 ? void 0 : _b.pcWidth, (_c = item.text.content) === null || _c === void 0 ? void 0 : _c.pcWidth) + "%"
300
403
  }
301
404
  }, item.button.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
302
405
  className: "btn",
@@ -41,17 +41,27 @@
41
41
  }
42
42
 
43
43
  .leftBtn {
44
- left: 20px;
44
+ left: 70px;
45
45
  }
46
46
 
47
47
  .rightBtn {
48
- right: 20px;
48
+ right: 70px;
49
49
  }
50
50
 
51
51
  .carouselItem {
52
52
  // height: 360px;
53
53
  display: flex;
54
54
  position: relative;
55
+ // 拖拽相关样式
56
+ -webkit-user-select: none;
57
+ -moz-user-select: none;
58
+ -ms-user-select: none;
59
+ user-select: none;
60
+ -webkit-touch-callout: none;
61
+
62
+ &.dragging {
63
+ cursor: grabbing !important;
64
+ }
55
65
 
56
66
  .carouseContent {
57
67
  padding: 0 80px;
@@ -77,12 +77,14 @@ function (_super) {
77
77
  data = _b.data,
78
78
  onItemClick = _b.onItemClick,
79
79
  hideLabels = _b.hideLabels,
80
- rest = __rest(_b, ["data", "onItemClick", "hideLabels"]);
80
+ rest = __rest(_b, ["data", "onItemClick", "hideLabels"]); // data.labels = [
81
+ // {
82
+ // position: '2',
83
+ // imgUrl: '/get/resource/platform/20250425/picture/Frame42731928621915591174458650624.png',
84
+ // },
85
+ // ];
86
+
81
87
 
82
- data.labels = [{
83
- position: '2',
84
- imgUrl: '/get/resource/platform/20250425/picture/Frame42731928621915591174458650624.png'
85
- }];
86
88
  var imgLabels = ((_a = data.labels) === null || _a === void 0 ? void 0 : _a.filter(function (f) {
87
89
  return f.position !== '6' && f.position !== '7' && f.position !== '8';
88
90
  })) || [];
@@ -307,7 +307,10 @@ function (_super) {
307
307
  now: '',
308
308
  isWill: false,
309
309
  scrollToLeftDisabled: true,
310
- scrollToRightDisabled: true
310
+ scrollToRightDisabled: true,
311
+ isDragging: false,
312
+ startX: 0,
313
+ startScrollLeft: 0
311
314
  };
312
315
 
313
316
  _this.getFlashData = function (pageSize, campaign) {
@@ -424,6 +427,86 @@ function (_super) {
424
427
  if (scrollDom.scrollLeft > 0) {
425
428
  scrollDom.scrollTo(scrollDom.scrollLeft - scrollDom.clientWidth, 0);
426
429
  }
430
+ }; // 鼠标拖拽滚动相关方法
431
+
432
+
433
+ _this.handleMouseDown = function (e) {
434
+ var _a; // 设计器模式下禁用拖拽
435
+
436
+
437
+ if ((0, _coreUtil.isDesignMode)() && ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) !== 'renderer') {
438
+ return;
439
+ }
440
+
441
+ var scrollDom = _this.scrollRef.current;
442
+ if (!scrollDom) return;
443
+
444
+ _this.setState({
445
+ isDragging: true,
446
+ startX: e.clientX,
447
+ startScrollLeft: scrollDom.scrollLeft
448
+ });
449
+ };
450
+
451
+ _this.handleMouseMove = function (e) {
452
+ if (!_this.state.isDragging) return;
453
+ e.preventDefault();
454
+
455
+ _this.updateScrollPosition(e.clientX);
456
+ };
457
+
458
+ _this.handleGlobalMouseMove = function (e) {
459
+ if (!_this.state.isDragging) return;
460
+ e.preventDefault();
461
+
462
+ _this.updateScrollPosition(e.clientX);
463
+ };
464
+
465
+ _this.handleGlobalMouseUp = function (e) {
466
+ if (!_this.state.isDragging) return;
467
+
468
+ _this.setState({
469
+ isDragging: false,
470
+ startX: 0,
471
+ startScrollLeft: 0
472
+ });
473
+ };
474
+
475
+ _this.handleMouseUp = function (e) {
476
+ if (!_this.state.isDragging) return;
477
+
478
+ _this.setState({
479
+ isDragging: false,
480
+ startX: 0,
481
+ startScrollLeft: 0
482
+ });
483
+ };
484
+
485
+ _this.handleMouseLeave = function () {
486
+ // 鼠标离开时重置拖拽状态
487
+ if (_this.state.isDragging) {
488
+ _this.setState({
489
+ isDragging: false,
490
+ startX: 0,
491
+ startScrollLeft: 0
492
+ });
493
+ }
494
+ };
495
+
496
+ _this.updateScrollPosition = function (currentX) {
497
+ var scrollDom = _this.scrollRef.current;
498
+ if (!scrollDom) return;
499
+ var _a = _this.state,
500
+ startX = _a.startX,
501
+ startScrollLeft = _a.startScrollLeft;
502
+ var deltaX = currentX - startX;
503
+ var newScrollLeft = startScrollLeft - deltaX; // 限制滚动范围
504
+
505
+ var maxScrollLeft = scrollDom.scrollWidth - scrollDom.clientWidth;
506
+ var clampedScrollLeft = Math.max(0, Math.min(newScrollLeft, maxScrollLeft));
507
+ scrollDom.scrollLeft = clampedScrollLeft;
508
+
509
+ _this.setScrollDisabled(scrollDom);
427
510
  };
428
511
 
429
512
  return _this;
@@ -432,6 +515,8 @@ function (_super) {
432
515
  FlashDealPc.prototype.componentDidMount = function () {
433
516
  var _this = this;
434
517
 
518
+ var _a;
519
+
435
520
  this.sortType = this.props.panelProps.content.sortType;
436
521
  this.getNextFlashSale();
437
522
  setTimeout(function () {
@@ -444,7 +529,12 @@ function (_super) {
444
529
  _this.setScrollDisabled(scrollDom);
445
530
  }, 500);
446
531
  }
447
- }, 0);
532
+ }, 0); // 添加全局鼠标事件监听,处理鼠标拖拽滚动
533
+
534
+ if (!(0, _coreUtil.isDesignMode)() || ((_a = window.magicDesign) === null || _a === void 0 ? void 0 : _a.mode) === 'renderer') {
535
+ document.addEventListener('mousemove', this.handleGlobalMouseMove);
536
+ document.addEventListener('mouseup', this.handleGlobalMouseUp);
537
+ }
448
538
  };
449
539
 
450
540
  FlashDealPc.prototype.componentWillReceiveProps = function (nextProps) {
@@ -471,20 +561,26 @@ function (_super) {
471
561
  }
472
562
  };
473
563
 
564
+ FlashDealPc.prototype.componentWillUnmount = function () {
565
+ // 移除全局鼠标事件监听
566
+ document.removeEventListener('mousemove', this.handleGlobalMouseMove);
567
+ document.removeEventListener('mouseup', this.handleGlobalMouseUp);
568
+ };
569
+
474
570
  FlashDealPc.prototype.render = function () {
475
571
  var _this = this;
476
572
 
477
- var _a, _b;
573
+ var _a, _b, _c;
478
574
 
479
575
  var panelProps = this.props.panelProps;
480
- var _c = this.state,
481
- list = _c.list,
482
- effDate = _c.effDate,
483
- expDate = _c.expDate,
484
- now = _c.now,
485
- isWill = _c.isWill,
486
- scrollToLeftDisabled = _c.scrollToLeftDisabled,
487
- scrollToRightDisabled = _c.scrollToRightDisabled;
576
+ var _d = this.state,
577
+ list = _d.list,
578
+ effDate = _d.effDate,
579
+ expDate = _d.expDate,
580
+ now = _d.now,
581
+ isWill = _d.isWill,
582
+ scrollToLeftDisabled = _d.scrollToLeftDisabled,
583
+ scrollToRightDisabled = _d.scrollToRightDisabled;
488
584
 
489
585
  var _list = list.length === 0 && (0, _coreUtil.isDesignMode)() ? defaultData : list;
490
586
 
@@ -526,7 +622,14 @@ function (_super) {
526
622
  type: "icon-outlined-left"
527
623
  })), /*#__PURE__*/_react["default"].createElement("div", {
528
624
  ref: this.scrollRef,
529
- className: "flash-deal-list"
625
+ className: "flash-deal-list",
626
+ onMouseDown: this.handleMouseDown,
627
+ onMouseMove: this.handleMouseMove,
628
+ onMouseUp: this.handleMouseUp,
629
+ onMouseLeave: this.handleMouseLeave,
630
+ style: {
631
+ cursor: this.state.isDragging ? 'grabbing' : !(0, _coreUtil.isDesignMode)() || ((_c = window.magicDesign) === null || _c === void 0 ? void 0 : _c.mode) === 'renderer' ? 'grab' : 'default'
632
+ }
530
633
  }, _list.map(function (item) {
531
634
  return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
532
635
  key: item.id,
@@ -93,6 +93,23 @@
93
93
  position: relative;
94
94
  flex: 1;
95
95
  gap: 40px;
96
+ // 拖拽相关样式
97
+ -webkit-user-select: none;
98
+ -moz-user-select: none;
99
+ -ms-user-select: none;
100
+ user-select: none;
101
+ -webkit-touch-callout: none;
102
+ // 隐藏滚动条但保持滚动功能
103
+ scrollbar-width: none; /* Firefox */
104
+ -ms-overflow-style: none; /* IE and Edge */
105
+
106
+ &::-webkit-scrollbar {
107
+ display: none; /* Chrome, Safari, Opera */
108
+ }
109
+
110
+ &.dragging {
111
+ cursor: grabbing !important;
112
+ }
96
113
  }
97
114
  }
98
115
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.204",
4
+ "version": "1.0.206",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",