@fonixtree/magic-design 1.0.133 → 1.0.134

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.
@@ -306,6 +306,12 @@ var getDefaultJSON = function getDefaultJSON() {
306
306
  },
307
307
  customize: {
308
308
  layout: 'layout1'
309
+ },
310
+ background: {
311
+ opacity: 100,
312
+ color: '#FFFFFF',
313
+ image: '',
314
+ bgType: 'color'
309
315
  }
310
316
  };
311
317
  };
@@ -61,12 +61,12 @@ var __assign = void 0 && (void 0).__assign || function () {
61
61
  return __assign.apply(this, arguments);
62
62
  };
63
63
 
64
- var Layout1 =
64
+ var VideoItem =
65
65
  /** @class */
66
66
  function (_super) {
67
- __extends(Layout1, _super);
67
+ __extends(VideoItem, _super);
68
68
 
69
- function Layout1() {
69
+ function VideoItem() {
70
70
  var _this = _super !== null && _super.apply(this, arguments) || this;
71
71
 
72
72
  _this.state = {};
@@ -97,7 +97,7 @@ function (_super) {
97
97
  return _this;
98
98
  }
99
99
 
100
- Layout1.prototype.render = function () {
100
+ VideoItem.prototype.render = function () {
101
101
  var _this = this;
102
102
 
103
103
  var _a, _b, _c, _d, _e;
@@ -138,9 +138,9 @@ function (_super) {
138
138
  })));
139
139
  };
140
140
 
141
- Layout1.defaultProps = {};
142
- return Layout1;
141
+ VideoItem.defaultProps = {};
142
+ return VideoItem;
143
143
  }(_react["default"].Component);
144
144
 
145
- var _default = Layout1;
145
+ var _default = VideoItem;
146
146
  exports["default"] = _default;
@@ -399,6 +399,20 @@ function (_super) {
399
399
  (0, _coreUtil.clickUrl)(jumpUrl);
400
400
  };
401
401
 
402
+ _this.getRealIndex = function (rawIndex, total) {
403
+ if (rawIndex === 0) return total - 1; // 第一个克隆页对应最后一个真实项
404
+
405
+ if (rawIndex === total + 1) return 0; // 最后一个克隆页对应第一个真实项
406
+
407
+ return rawIndex - 1; // 中间项索引-1得到真实索引
408
+ };
409
+
410
+ _this.afterChange = function (n) {
411
+ _this.setState({
412
+ carouseIndex: n
413
+ });
414
+ };
415
+
402
416
  return _this;
403
417
  }
404
418
 
@@ -537,15 +551,14 @@ function (_super) {
537
551
  key: JSON.stringify(data.groupSource),
538
552
  ref: this.carouselRef,
539
553
  afterChange: function afterChange(n) {
540
- return _this.setState({
541
- carouseIndex: n
542
- });
554
+ return _this.afterChange(n);
543
555
  },
544
556
  autoplay: autoplay,
545
557
  autoplaySpeed: data.setting.autoplay.interval * 1000,
546
558
  className: "carousel-img",
547
- dots: false
548
- }, data.groupSource.map(function (m) {
559
+ dots: false,
560
+ infinite: false
561
+ }, data.groupSource.map(function (m, i) {
549
562
  return /*#__PURE__*/_react["default"].createElement("div", {
550
563
  key: m.id
551
564
  }, m.image && m.image.open && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
@@ -553,7 +566,7 @@ function (_super) {
553
566
  data: m.image,
554
567
  imgCover: true,
555
568
  isBackground: true
556
- }), m.video && /*#__PURE__*/_react["default"].createElement(_VideoItem["default"], {
569
+ }), m.video && i === carouseIndex && /*#__PURE__*/_react["default"].createElement(_VideoItem["default"], {
557
570
  data: m
558
571
  }));
559
572
  })), data.setting.dots.open && /*#__PURE__*/_react["default"].createElement("div", {
@@ -1,6 +1,7 @@
1
1
  .m-search-dito-pc {
2
2
  position: relative;
3
3
  width: 100%;
4
+ background-color: #fff;
4
5
 
5
6
  .search-bar {
6
7
  display: block;
@@ -120,6 +121,10 @@
120
121
  display: flex;
121
122
  gap: 15px;
122
123
  align-items: center;
124
+
125
+ .icon-wrap {
126
+ cursor: pointer;
127
+ }
123
128
  }
124
129
  }
125
130
 
@@ -77,7 +77,7 @@ var getDefaultJSON = function getDefaultJSON() {
77
77
  return {
78
78
  id: groupId,
79
79
  type: 'SLIDE_IMAGE',
80
- groupSource: [groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId)],
80
+ groupSource: [groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId)],
81
81
  spacing: {
82
82
  pc: {
83
83
  paddingTop: 0,
@@ -1 +1,3 @@
1
- .slide-image-card-item-wrap {}
1
+ .slide-image-card-item-wrap {
2
+ cursor: pointer;
3
+ }
@@ -7,7 +7,7 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _commonUtil = require("../../../../../../../utils/commonUtil");
10
+ var _coreUtil = require("../../../../../../../utils/coreUtil");
11
11
 
12
12
  require("./index.less");
13
13
 
@@ -39,41 +39,18 @@ var __extends = void 0 && (void 0).__extends || function () {
39
39
  };
40
40
  }();
41
41
 
42
- var Layout1 =
42
+ var VideoItem =
43
43
  /** @class */
44
44
  function (_super) {
45
- __extends(Layout1, _super);
45
+ __extends(VideoItem, _super);
46
46
 
47
- function Layout1() {
47
+ function VideoItem() {
48
48
  var _this = _super !== null && _super.apply(this, arguments) || this;
49
49
 
50
50
  _this.state = {
51
51
  playing: false
52
52
  };
53
53
  _this.videoRef = /*#__PURE__*/_react["default"].createRef();
54
- /** 视频ref映射 */
55
-
56
- _this.videoRefMap = {};
57
-
58
- _this.playOrPause = function (group) {
59
- (0, _commonUtil.ensure)(function () {
60
- if (_this.videoRefMap[group.id].playing) {
61
- _this.videoRefMap[group.id].playing = false;
62
-
63
- _this.videoRefMap[group.id].el.player.pause();
64
- } else {
65
- if (group.video.playPosition == 'Popup') {
66
- _this.videoRefMap[group.id].el.fullPlay('pc');
67
- } else {
68
- _this.videoRefMap[group.id].playing = true;
69
-
70
- _this.videoRefMap[group.id].el.player.play();
71
- }
72
- }
73
-
74
- _this.setState({});
75
- });
76
- };
77
54
 
78
55
  _this.onMouseEnter = function () {
79
56
  _this.videoRef.current.play();
@@ -94,28 +71,36 @@ function (_super) {
94
71
  return _this;
95
72
  }
96
73
 
97
- Layout1.prototype.render = function () {
74
+ VideoItem.prototype.render = function () {
98
75
  var _a, _b, _c, _d, _e;
99
76
 
100
77
  var data = this.props.data;
101
78
  var playing = this.state.playing;
102
79
  return /*#__PURE__*/_react["default"].createElement("div", {
103
80
  className: "slide-image-video-wrap",
81
+ onClick: function onClick() {
82
+ return (0, _coreUtil.clickUrl)(data.groupName.content.clickUrl.value);
83
+ },
104
84
  onMouseEnter: this.onMouseEnter,
105
85
  onMouseLeave: this.onMouseLeave
106
86
  }, ((_a = data.video) === null || _a === void 0 ? void 0 : _a.sourceUrl) && /*#__PURE__*/_react["default"].createElement("video", {
107
87
  ref: this.videoRef,
108
- src: (_b = data.video) === null || _b === void 0 ? void 0 : _b.sourceUrl
109
- }), !playing && ((_c = data.overilay) === null || _c === void 0 ? void 0 : _c.open) && /*#__PURE__*/_react["default"].createElement("img", {
88
+ loop: true,
89
+ muted: true,
90
+ playsinline: true
91
+ }, /*#__PURE__*/_react["default"].createElement("source", {
92
+ src: (_b = data.video) === null || _b === void 0 ? void 0 : _b.sourceUrl,
93
+ type: "video/mp4"
94
+ })), !playing && ((_c = data.overilay) === null || _c === void 0 ? void 0 : _c.open) && /*#__PURE__*/_react["default"].createElement("img", {
95
+ alt: "",
110
96
  className: "video-cover-img",
111
- src: (_e = (_d = data.overilay) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.pcImgSrc,
112
- alt: ""
97
+ src: (_e = (_d = data.overilay) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.pcImgSrc
113
98
  }));
114
99
  };
115
100
 
116
- Layout1.defaultProps = {};
117
- return Layout1;
101
+ VideoItem.defaultProps = {};
102
+ return VideoItem;
118
103
  }(_react["default"].Component);
119
104
 
120
- var _default = Layout1;
105
+ var _default = VideoItem;
121
106
  exports["default"] = _default;
@@ -17,6 +17,8 @@ var _SpacingConfig = _interopRequireDefault(require("../../../common/config-pane
17
17
 
18
18
  var _CustomizeConfig = _interopRequireDefault(require("../../../common/config-panels/CustomizeConfig"));
19
19
 
20
+ var _BackgroundConfig = _interopRequireDefault(require("../../../common/config-panels/BackgroundConfig"));
21
+
20
22
  var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
21
23
 
22
24
  var _locale = require("../../../../locale");
@@ -91,6 +93,12 @@ function (_super) {
91
93
  isHideAlign: true,
92
94
  layoutSource: _layout.groupedCarouselLayout
93
95
  })
96
+ }, {
97
+ key: '5',
98
+ name: (0, _locale.i18n)('BACKGROUND'),
99
+ value: /*#__PURE__*/_react["default"].createElement(_BackgroundConfig["default"], {
100
+ data: data.background
101
+ })
94
102
  }],
95
103
  type: "triangle"
96
104
  }));
@@ -529,9 +529,12 @@ function (_super) {
529
529
 
530
530
  case _constants.quickMenuCode.SAVE:
531
531
  /** 如果保存则重置为mobile,同一移动端截图 #10504010 */
532
- _this.onSwitchDevice(_constants.deviceTypeMap.PHONE);
532
+ _this.onSwitchDevice(_constants.deviceTypeMap.PHONE); // onSave(handleParams);
533
+
533
534
 
534
- onSave(handleParams);
535
+ onSave(__assign(__assign({}, handleParams), {
536
+ device: _constants.deviceTypeMap.PHONE
537
+ }));
535
538
  break;
536
539
 
537
540
  case _constants.quickMenuCode.MODE_PC:
@@ -306,6 +306,12 @@ var getDefaultJSON = function getDefaultJSON() {
306
306
  },
307
307
  customize: {
308
308
  layout: 'layout1'
309
+ },
310
+ background: {
311
+ opacity: 100,
312
+ color: '#FFFFFF',
313
+ image: '',
314
+ bgType: 'color'
309
315
  }
310
316
  };
311
317
  };
@@ -61,12 +61,12 @@ var __assign = void 0 && (void 0).__assign || function () {
61
61
  return __assign.apply(this, arguments);
62
62
  };
63
63
 
64
- var Layout1 =
64
+ var VideoItem =
65
65
  /** @class */
66
66
  function (_super) {
67
- __extends(Layout1, _super);
67
+ __extends(VideoItem, _super);
68
68
 
69
- function Layout1() {
69
+ function VideoItem() {
70
70
  var _this = _super !== null && _super.apply(this, arguments) || this;
71
71
 
72
72
  _this.state = {};
@@ -97,7 +97,7 @@ function (_super) {
97
97
  return _this;
98
98
  }
99
99
 
100
- Layout1.prototype.render = function () {
100
+ VideoItem.prototype.render = function () {
101
101
  var _this = this;
102
102
 
103
103
  var _a, _b, _c, _d, _e;
@@ -138,9 +138,9 @@ function (_super) {
138
138
  })));
139
139
  };
140
140
 
141
- Layout1.defaultProps = {};
142
- return Layout1;
141
+ VideoItem.defaultProps = {};
142
+ return VideoItem;
143
143
  }(_react["default"].Component);
144
144
 
145
- var _default = Layout1;
145
+ var _default = VideoItem;
146
146
  exports["default"] = _default;
@@ -399,6 +399,20 @@ function (_super) {
399
399
  (0, _coreUtil.clickUrl)(jumpUrl);
400
400
  };
401
401
 
402
+ _this.getRealIndex = function (rawIndex, total) {
403
+ if (rawIndex === 0) return total - 1; // 第一个克隆页对应最后一个真实项
404
+
405
+ if (rawIndex === total + 1) return 0; // 最后一个克隆页对应第一个真实项
406
+
407
+ return rawIndex - 1; // 中间项索引-1得到真实索引
408
+ };
409
+
410
+ _this.afterChange = function (n) {
411
+ _this.setState({
412
+ carouseIndex: n
413
+ });
414
+ };
415
+
402
416
  return _this;
403
417
  }
404
418
 
@@ -537,15 +551,14 @@ function (_super) {
537
551
  key: JSON.stringify(data.groupSource),
538
552
  ref: this.carouselRef,
539
553
  afterChange: function afterChange(n) {
540
- return _this.setState({
541
- carouseIndex: n
542
- });
554
+ return _this.afterChange(n);
543
555
  },
544
556
  autoplay: autoplay,
545
557
  autoplaySpeed: data.setting.autoplay.interval * 1000,
546
558
  className: "carousel-img",
547
- dots: false
548
- }, data.groupSource.map(function (m) {
559
+ dots: false,
560
+ infinite: false
561
+ }, data.groupSource.map(function (m, i) {
549
562
  return /*#__PURE__*/_react["default"].createElement("div", {
550
563
  key: m.id
551
564
  }, m.image && m.image.open && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
@@ -553,7 +566,7 @@ function (_super) {
553
566
  data: m.image,
554
567
  imgCover: true,
555
568
  isBackground: true
556
- }), m.video && /*#__PURE__*/_react["default"].createElement(_VideoItem["default"], {
569
+ }), m.video && i === carouseIndex && /*#__PURE__*/_react["default"].createElement(_VideoItem["default"], {
557
570
  data: m
558
571
  }));
559
572
  })), data.setting.dots.open && /*#__PURE__*/_react["default"].createElement("div", {
@@ -1,6 +1,7 @@
1
1
  .m-search-dito-pc {
2
2
  position: relative;
3
3
  width: 100%;
4
+ background-color: #fff;
4
5
 
5
6
  .search-bar {
6
7
  display: block;
@@ -120,6 +121,10 @@
120
121
  display: flex;
121
122
  gap: 15px;
122
123
  align-items: center;
124
+
125
+ .icon-wrap {
126
+ cursor: pointer;
127
+ }
123
128
  }
124
129
  }
125
130
 
@@ -77,7 +77,7 @@ var getDefaultJSON = function getDefaultJSON() {
77
77
  return {
78
78
  id: groupId,
79
79
  type: 'SLIDE_IMAGE',
80
- groupSource: [groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId)],
80
+ groupSource: [groupSourceJSON(groupId), groupSourceJSON(groupId), groupSourceJSON(groupId)],
81
81
  spacing: {
82
82
  pc: {
83
83
  paddingTop: 0,
@@ -1 +1,3 @@
1
- .slide-image-card-item-wrap {}
1
+ .slide-image-card-item-wrap {
2
+ cursor: pointer;
3
+ }
@@ -7,7 +7,7 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _commonUtil = require("../../../../../../../utils/commonUtil");
10
+ var _coreUtil = require("../../../../../../../utils/coreUtil");
11
11
 
12
12
  require("./index.less");
13
13
 
@@ -39,41 +39,18 @@ var __extends = void 0 && (void 0).__extends || function () {
39
39
  };
40
40
  }();
41
41
 
42
- var Layout1 =
42
+ var VideoItem =
43
43
  /** @class */
44
44
  function (_super) {
45
- __extends(Layout1, _super);
45
+ __extends(VideoItem, _super);
46
46
 
47
- function Layout1() {
47
+ function VideoItem() {
48
48
  var _this = _super !== null && _super.apply(this, arguments) || this;
49
49
 
50
50
  _this.state = {
51
51
  playing: false
52
52
  };
53
53
  _this.videoRef = /*#__PURE__*/_react["default"].createRef();
54
- /** 视频ref映射 */
55
-
56
- _this.videoRefMap = {};
57
-
58
- _this.playOrPause = function (group) {
59
- (0, _commonUtil.ensure)(function () {
60
- if (_this.videoRefMap[group.id].playing) {
61
- _this.videoRefMap[group.id].playing = false;
62
-
63
- _this.videoRefMap[group.id].el.player.pause();
64
- } else {
65
- if (group.video.playPosition == 'Popup') {
66
- _this.videoRefMap[group.id].el.fullPlay('pc');
67
- } else {
68
- _this.videoRefMap[group.id].playing = true;
69
-
70
- _this.videoRefMap[group.id].el.player.play();
71
- }
72
- }
73
-
74
- _this.setState({});
75
- });
76
- };
77
54
 
78
55
  _this.onMouseEnter = function () {
79
56
  _this.videoRef.current.play();
@@ -94,28 +71,36 @@ function (_super) {
94
71
  return _this;
95
72
  }
96
73
 
97
- Layout1.prototype.render = function () {
74
+ VideoItem.prototype.render = function () {
98
75
  var _a, _b, _c, _d, _e;
99
76
 
100
77
  var data = this.props.data;
101
78
  var playing = this.state.playing;
102
79
  return /*#__PURE__*/_react["default"].createElement("div", {
103
80
  className: "slide-image-video-wrap",
81
+ onClick: function onClick() {
82
+ return (0, _coreUtil.clickUrl)(data.groupName.content.clickUrl.value);
83
+ },
104
84
  onMouseEnter: this.onMouseEnter,
105
85
  onMouseLeave: this.onMouseLeave
106
86
  }, ((_a = data.video) === null || _a === void 0 ? void 0 : _a.sourceUrl) && /*#__PURE__*/_react["default"].createElement("video", {
107
87
  ref: this.videoRef,
108
- src: (_b = data.video) === null || _b === void 0 ? void 0 : _b.sourceUrl
109
- }), !playing && ((_c = data.overilay) === null || _c === void 0 ? void 0 : _c.open) && /*#__PURE__*/_react["default"].createElement("img", {
88
+ loop: true,
89
+ muted: true,
90
+ playsinline: true
91
+ }, /*#__PURE__*/_react["default"].createElement("source", {
92
+ src: (_b = data.video) === null || _b === void 0 ? void 0 : _b.sourceUrl,
93
+ type: "video/mp4"
94
+ })), !playing && ((_c = data.overilay) === null || _c === void 0 ? void 0 : _c.open) && /*#__PURE__*/_react["default"].createElement("img", {
95
+ alt: "",
110
96
  className: "video-cover-img",
111
- src: (_e = (_d = data.overilay) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.pcImgSrc,
112
- alt: ""
97
+ src: (_e = (_d = data.overilay) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.pcImgSrc
113
98
  }));
114
99
  };
115
100
 
116
- Layout1.defaultProps = {};
117
- return Layout1;
101
+ VideoItem.defaultProps = {};
102
+ return VideoItem;
118
103
  }(_react["default"].Component);
119
104
 
120
- var _default = Layout1;
105
+ var _default = VideoItem;
121
106
  exports["default"] = _default;
@@ -17,6 +17,8 @@ var _SpacingConfig = _interopRequireDefault(require("../../../common/config-pane
17
17
 
18
18
  var _CustomizeConfig = _interopRequireDefault(require("../../../common/config-panels/CustomizeConfig"));
19
19
 
20
+ var _BackgroundConfig = _interopRequireDefault(require("../../../common/config-panels/BackgroundConfig"));
21
+
20
22
  var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
21
23
 
22
24
  var _locale = require("../../../../locale");
@@ -91,6 +93,12 @@ function (_super) {
91
93
  isHideAlign: true,
92
94
  layoutSource: _layout.groupedCarouselLayout
93
95
  })
96
+ }, {
97
+ key: '5',
98
+ name: (0, _locale.i18n)('BACKGROUND'),
99
+ value: /*#__PURE__*/_react["default"].createElement(_BackgroundConfig["default"], {
100
+ data: data.background
101
+ })
94
102
  }],
95
103
  type: "triangle"
96
104
  }));
@@ -529,9 +529,12 @@ function (_super) {
529
529
 
530
530
  case _constants.quickMenuCode.SAVE:
531
531
  /** 如果保存则重置为mobile,同一移动端截图 #10504010 */
532
- _this.onSwitchDevice(_constants.deviceTypeMap.PHONE);
532
+ _this.onSwitchDevice(_constants.deviceTypeMap.PHONE); // onSave(handleParams);
533
+
533
534
 
534
- onSave(handleParams);
535
+ onSave(__assign(__assign({}, handleParams), {
536
+ device: _constants.deviceTypeMap.PHONE
537
+ }));
535
538
  break;
536
539
 
537
540
  case _constants.quickMenuCode.MODE_PC:
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.133",
4
+ "version": "1.0.134",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",