@fonixtree/magic-design 0.0.160 → 0.0.161

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 (31) hide show
  1. package/es/common/SwiperBan/index.less +1 -1
  2. package/es/common/Video/index.js +8 -5
  3. package/es/common/Video/index.less +9 -0
  4. package/es/composite-comp/bol/components/Video/components/VideoTag/index.js +3 -1
  5. package/es/composite-comp/bol/components/Video/components/VideoTag/index.less +4 -0
  6. package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +30 -21
  7. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +29 -21
  8. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.less +1 -1
  9. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +30 -21
  10. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.less +2 -2
  11. package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +30 -21
  12. package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +41 -40
  13. package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +33 -24
  14. package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +30 -21
  15. package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +30 -21
  16. package/lib/common/SwiperBan/index.less +1 -1
  17. package/lib/common/Video/index.js +8 -5
  18. package/lib/common/Video/index.less +9 -0
  19. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.js +3 -1
  20. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.less +4 -0
  21. package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +30 -21
  22. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +29 -21
  23. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.less +1 -1
  24. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +30 -21
  25. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.less +2 -2
  26. package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +30 -21
  27. package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +41 -40
  28. package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +33 -24
  29. package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +30 -21
  30. package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +30 -21
  31. package/package.json +1 -1
@@ -77,6 +77,27 @@ function (_super) {
77
77
  /** 视频ref映射 */
78
78
 
79
79
  _this.videoRefMap = {};
80
+
81
+ _this.playOrPause = function (group) {
82
+ (0, _commonUtil.ensure)(function () {
83
+ if (_this.videoRefMap[group.id].playing) {
84
+ _this.videoRefMap[group.id].playing = false;
85
+
86
+ _this.videoRefMap[group.id].el.player.pause();
87
+ } else {
88
+ if (group.video.playPosition == 'Popup') {
89
+ _this.videoRefMap[group.id].el.fullPlay('pc');
90
+ } else {
91
+ _this.videoRefMap[group.id].playing = true;
92
+
93
+ _this.videoRefMap[group.id].el.player.play();
94
+ }
95
+ }
96
+
97
+ _this.setState({});
98
+ });
99
+ };
100
+
80
101
  return _this;
81
102
  }
82
103
 
@@ -90,7 +111,7 @@ function (_super) {
90
111
  return /*#__PURE__*/_react["default"].createElement("div", {
91
112
  className: "video-pc-layout1-wrap"
92
113
  }, /*#__PURE__*/_react["default"].createElement("div", null, data.groupSource.map(function (group) {
93
- var _a;
114
+ var _a, _b;
94
115
  /** 当前是否在播放 */
95
116
 
96
117
 
@@ -98,25 +119,6 @@ function (_super) {
98
119
  return /*#__PURE__*/_react["default"].createElement("div", {
99
120
  key: group.id,
100
121
  className: "video-item-wrap",
101
- onClick: function onClick() {
102
- (0, _commonUtil.ensure)(function () {
103
- if (_this.videoRefMap[group.id].playing) {
104
- _this.videoRefMap[group.id].playing = false;
105
-
106
- _this.videoRefMap[group.id].el.player.pause();
107
- } else {
108
- if (group.video.playPosition == 'Popup') {
109
- _this.videoRefMap[group.id].el.fullPlay('pc');
110
- } else {
111
- _this.videoRefMap[group.id].playing = true;
112
-
113
- _this.videoRefMap[group.id].el.player.play();
114
- }
115
- }
116
-
117
- _this.setState({});
118
- });
119
- },
120
122
  style: {
121
123
  height: data.pcHeight
122
124
  }
@@ -135,9 +137,13 @@ function (_super) {
135
137
  cover: (0, _coreUtil.getVideoCover)(group),
136
138
  source: group.video.sourceUrl
137
139
  }),
140
+ play: (_b = _this.videoRefMap[group.id]) === null || _b === void 0 ? void 0 : _b.playing,
138
141
  videoId: group.id
139
142
  }), !isPlaying && group.video.playButton == 'Middle' && /*#__PURE__*/_react["default"].createElement("div", {
140
- className: "play-btn center"
143
+ className: "play-btn center",
144
+ onClick: function onClick() {
145
+ _this.playOrPause(group);
146
+ }
141
147
  }, /*#__PURE__*/_react["default"].createElement("img", {
142
148
  alt: "",
143
149
  src: _playCircle["default"]
@@ -145,6 +151,9 @@ function (_super) {
145
151
  align: data.customize.align,
146
152
  data: group,
147
153
  noShare: true,
154
+ onPlayClick: function onPlayClick() {
155
+ return _this.playOrPause(group);
156
+ },
148
157
  padding: 48
149
158
  }), data.share.open && !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
150
159
  data: __assign({
@@ -79,6 +79,27 @@ function (_super) {
79
79
  /** 视频ref映射 */
80
80
 
81
81
  _this.videoRefMap = {};
82
+
83
+ _this.playOrPause = function (group) {
84
+ (0, _commonUtil.ensure)(function () {
85
+ if (_this.videoRefMap[group.id].playing) {
86
+ _this.videoRefMap[group.id].playing = false;
87
+
88
+ _this.videoRefMap[group.id].el.player.pause();
89
+ } else {
90
+ if (group.video.playPosition == 'Popup') {
91
+ _this.videoRefMap[group.id].el.fullPlay('pc');
92
+ } else {
93
+ _this.videoRefMap[group.id].playing = true;
94
+
95
+ _this.videoRefMap[group.id].el.player.play();
96
+ }
97
+ }
98
+
99
+ _this.setState({});
100
+ });
101
+ };
102
+
82
103
  return _this;
83
104
  }
84
105
 
@@ -102,22 +123,7 @@ function (_super) {
102
123
  }
103
124
  }, firstGroup && /*#__PURE__*/_react["default"].createElement("div", {
104
125
  key: firstGroup.id,
105
- className: "video-left-wrap",
106
- onClick: function onClick() {
107
- (0, _commonUtil.ensure)(function () {
108
- if (_this.videoRefMap[firstGroup.id].playing) {
109
- _this.videoRefMap[firstGroup.id].playing = false;
110
-
111
- _this.videoRefMap[firstGroup.id].el.player.pause();
112
- } else {
113
- _this.videoRefMap[firstGroup.id].playing = true;
114
-
115
- _this.videoRefMap[firstGroup.id].el.player.play();
116
- }
117
-
118
- _this.setState({});
119
- });
120
- }
126
+ className: "video-left-wrap"
121
127
  }, /*#__PURE__*/_react["default"].createElement(_common.Video, {
122
128
  ref: function ref(el) {
123
129
  if (!_this.videoRefMap[firstGroup.id]) {
@@ -133,9 +139,13 @@ function (_super) {
133
139
  cover: (0, _coreUtil.isPc)() ? firstGroup.overilay.content.pcImgSrc : firstGroup.overilay.content.h5ImgSrc,
134
140
  source: firstGroup.video.sourceUrl
135
141
  }),
142
+ play: isFirstGroupPlaying,
136
143
  videoId: firstGroup.id
137
144
  }), !isFirstGroupPlaying && firstGroup.video.playButton == 'Middle' && /*#__PURE__*/_react["default"].createElement("div", {
138
- className: "play-btn center"
145
+ className: "play-btn center",
146
+ onClick: function onClick() {
147
+ _this.playOrPause(firstGroup);
148
+ }
139
149
  }, /*#__PURE__*/_react["default"].createElement("img", {
140
150
  alt: "",
141
151
  src: _playCircle["default"]
@@ -143,37 +153,21 @@ function (_super) {
143
153
  align: data.customize.align,
144
154
  data: firstGroup,
145
155
  noShare: true,
156
+ onPlayClick: function onPlayClick() {
157
+ return _this.playOrPause(firstGroup);
158
+ },
146
159
  padding: 32
147
160
  })), /*#__PURE__*/_react["default"].createElement("div", {
148
161
  className: "right-list-wrap"
149
162
  }, data.groupSource.slice(1).map(function (group) {
150
- var _a;
163
+ var _a, _b;
151
164
  /** 当前是否在播放 */
152
165
 
153
166
 
154
167
  var isPlaying = !!((_a = _this.videoRefMap[group.id]) === null || _a === void 0 ? void 0 : _a.playing);
155
168
  return /*#__PURE__*/_react["default"].createElement("div", {
156
169
  key: group.id,
157
- className: "video-item-wrap",
158
- onClick: function onClick() {
159
- (0, _commonUtil.ensure)(function () {
160
- if (_this.videoRefMap[group.id].playing) {
161
- _this.videoRefMap[group.id].playing = false;
162
-
163
- _this.videoRefMap[group.id].el.player.pause();
164
- } else {
165
- if (group.video.playPosition == 'Popup') {
166
- _this.videoRefMap[group.id].el.fullPlay('pc');
167
- } else {
168
- _this.videoRefMap[group.id].playing = true;
169
-
170
- _this.videoRefMap[group.id].el.player.play();
171
- }
172
- }
173
-
174
- _this.setState({});
175
- });
176
- }
170
+ className: "video-item-wrap"
177
171
  }, /*#__PURE__*/_react["default"].createElement(_common.Video, {
178
172
  ref: function ref(el) {
179
173
  if (!_this.videoRefMap[group.id]) {
@@ -189,16 +183,23 @@ function (_super) {
189
183
  cover: (0, _coreUtil.getVideoCover)(group),
190
184
  source: group.video.sourceUrl
191
185
  }),
186
+ play: (_b = _this.videoRefMap[group.id]) === null || _b === void 0 ? void 0 : _b.playing,
192
187
  videoId: group.id
193
188
  }), !isPlaying && group.video.playButton == 'Middle' && /*#__PURE__*/_react["default"].createElement("div", {
194
- className: "play-btn center"
189
+ className: "play-btn center",
190
+ onClick: function onClick() {
191
+ _this.playOrPause(group);
192
+ }
195
193
  }, /*#__PURE__*/_react["default"].createElement("img", {
196
194
  alt: "",
197
195
  src: _playCircle["default"]
198
- })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
196
+ })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
199
197
  align: data.customize.align,
200
198
  data: group,
201
199
  noShare: true,
200
+ onPlayClick: function onPlayClick() {
201
+ return _this.playOrPause(group);
202
+ },
202
203
  padding: 32
203
204
  }));
204
205
  })), data.share.open && !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
@@ -79,6 +79,27 @@ function (_super) {
79
79
  /** 视频ref映射 */
80
80
 
81
81
  _this.videoRefMap = {};
82
+
83
+ _this.playOrPause = function (group) {
84
+ (0, _commonUtil.ensure)(function () {
85
+ if (_this.videoRefMap[group.id].playing) {
86
+ _this.videoRefMap[group.id].playing = false;
87
+
88
+ _this.videoRefMap[group.id].el.player.pause();
89
+ } else {
90
+ if (group.video.playPosition == 'Popup') {
91
+ _this.videoRefMap[group.id].el.fullPlay('pc');
92
+ } else {
93
+ _this.videoRefMap[group.id].playing = true;
94
+
95
+ _this.videoRefMap[group.id].el.player.play();
96
+ }
97
+ }
98
+
99
+ _this.setState({});
100
+ });
101
+ };
102
+
82
103
  return _this;
83
104
  }
84
105
 
@@ -94,7 +115,7 @@ function (_super) {
94
115
  style: {
95
116
  height: data.pcHeight
96
117
  }
97
- }, !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
118
+ }, data.share.open && !hasPlaying && /*#__PURE__*/_react["default"].createElement(_ShareBtn["default"], {
98
119
  data: __assign({
99
120
  url: (0, _commonUtil.addUrlQuery)(window.location.href, {
100
121
  scroll: 'node-' + data.id
@@ -102,33 +123,14 @@ function (_super) {
102
123
  }, data.share),
103
124
  pc: true
104
125
  }), data.groupSource.map(function (group) {
105
- var _a;
126
+ var _a, _b;
106
127
  /** 当前是否在播放 */
107
128
 
108
129
 
109
130
  var isPlaying = !!((_a = _this.videoRefMap[group.id]) === null || _a === void 0 ? void 0 : _a.playing);
110
131
  return /*#__PURE__*/_react["default"].createElement("div", {
111
132
  key: group.id,
112
- className: "video-item-wrap",
113
- onClick: function onClick() {
114
- (0, _commonUtil.ensure)(function () {
115
- if (_this.videoRefMap[group.id].playing) {
116
- _this.videoRefMap[group.id].playing = false;
117
-
118
- _this.videoRefMap[group.id].el.player.pause();
119
- } else {
120
- if (group.video.playPosition == 'Popup') {
121
- _this.videoRefMap[group.id].el.fullPlay('pc');
122
- } else {
123
- _this.videoRefMap[group.id].playing = true;
124
-
125
- _this.videoRefMap[group.id].el.player.play();
126
- }
127
- }
128
-
129
- _this.setState({});
130
- });
131
- }
133
+ className: "video-item-wrap"
132
134
  }, /*#__PURE__*/_react["default"].createElement(_common.Video, {
133
135
  ref: function ref(el) {
134
136
  if (!_this.videoRefMap[group.id]) {
@@ -144,16 +146,23 @@ function (_super) {
144
146
  cover: (0, _coreUtil.getVideoCover)(group),
145
147
  source: group.video.sourceUrl
146
148
  }),
149
+ play: (_b = _this.videoRefMap[group.id]) === null || _b === void 0 ? void 0 : _b.playing,
147
150
  videoId: group.id
148
151
  }), !isPlaying && group.video.playButton == 'Middle' && /*#__PURE__*/_react["default"].createElement("div", {
149
- className: "play-btn center"
152
+ className: "play-btn center",
153
+ onClick: function onClick() {
154
+ _this.playOrPause(group);
155
+ }
150
156
  }, /*#__PURE__*/_react["default"].createElement("img", {
151
157
  alt: "",
152
158
  src: _playCircle["default"]
153
- })), data.share.open && !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
159
+ })), !isPlaying && /*#__PURE__*/_react["default"].createElement(_VideoTag["default"], {
154
160
  align: data.customize.align,
155
161
  data: group,
156
162
  noShare: true,
163
+ onPlayClick: function onPlayClick() {
164
+ return _this.playOrPause(group);
165
+ },
157
166
  padding: 20
158
167
  }));
159
168
  }));
@@ -81,6 +81,27 @@ function (_super) {
81
81
  /** 视频ref映射 */
82
82
 
83
83
  _this.videoRefMap = {};
84
+
85
+ _this.playOrPause = function (group) {
86
+ (0, _commonUtil.ensure)(function () {
87
+ if (_this.videoRefMap[group.id].playing) {
88
+ _this.videoRefMap[group.id].playing = false;
89
+
90
+ _this.videoRefMap[group.id].el.player.pause();
91
+ } else {
92
+ if (group.video.playPosition == 'Popup') {
93
+ _this.videoRefMap[group.id].el.fullPlay('pc');
94
+ } else {
95
+ _this.videoRefMap[group.id].playing = true;
96
+
97
+ _this.videoRefMap[group.id].el.player.play();
98
+ }
99
+ }
100
+
101
+ _this.setState({});
102
+ });
103
+ };
104
+
84
105
  return _this;
85
106
  }
86
107
 
@@ -91,7 +112,7 @@ function (_super) {
91
112
  return /*#__PURE__*/_react["default"].createElement("div", {
92
113
  className: "video-layout4-wrap"
93
114
  }, data.groupSource.map(function (group) {
94
- var _a;
115
+ var _a, _b;
95
116
  /** 当前是否在播放 */
96
117
 
97
118
 
@@ -101,25 +122,6 @@ function (_super) {
101
122
  }, /*#__PURE__*/_react["default"].createElement("div", {
102
123
  key: group.id,
103
124
  className: "video-item-wrap",
104
- onClick: function onClick() {
105
- (0, _commonUtil.ensure)(function () {
106
- if (_this.videoRefMap[group.id].playing) {
107
- _this.videoRefMap[group.id].playing = false;
108
-
109
- _this.videoRefMap[group.id].el.player.pause();
110
- } else {
111
- if (group.video.playPosition == 'Popup') {
112
- _this.videoRefMap[group.id].el.fullPlay('pc');
113
- } else {
114
- _this.videoRefMap[group.id].playing = true;
115
-
116
- _this.videoRefMap[group.id].el.player.play();
117
- }
118
- }
119
-
120
- _this.setState({});
121
- });
122
- },
123
125
  style: {
124
126
  height: data.pcHeight
125
127
  }
@@ -138,12 +140,16 @@ function (_super) {
138
140
  cover: (0, _coreUtil.getVideoCover)(group),
139
141
  source: group.video.sourceUrl
140
142
  }),
143
+ play: (_b = _this.videoRefMap[group.id]) === null || _b === void 0 ? void 0 : _b.playing,
141
144
  videoId: group.id
142
145
  }), !isPlaying && /*#__PURE__*/_react["default"].createElement("div", {
143
146
  className: (0, _classnames["default"])('play-btn', {
144
147
  middle: group.video.playButton == 'Middle',
145
148
  bottomLeft: group.video.playButton == 'Bottom Left'
146
- })
149
+ }),
150
+ onClick: function onClick() {
151
+ _this.playOrPause(group);
152
+ }
147
153
  }, /*#__PURE__*/_react["default"].createElement("img", {
148
154
  alt: "",
149
155
  src: _playCircle["default"]
@@ -162,6 +168,9 @@ function (_super) {
162
168
  data: group,
163
169
  layout: 'pc-' + data.customize.layout.pcLayout,
164
170
  noShare: true,
171
+ onPlayClick: function onPlayClick() {
172
+ return _this.playOrPause(group);
173
+ },
165
174
  position: "relative"
166
175
  })));
167
176
  }));
@@ -81,6 +81,27 @@ function (_super) {
81
81
  /** 视频ref映射 */
82
82
 
83
83
  _this.videoRefMap = {};
84
+
85
+ _this.playOrPause = function (group) {
86
+ (0, _commonUtil.ensure)(function () {
87
+ if (_this.videoRefMap[group.id].playing) {
88
+ _this.videoRefMap[group.id].playing = false;
89
+
90
+ _this.videoRefMap[group.id].el.player.pause();
91
+ } else {
92
+ if (group.video.playPosition == 'Popup') {
93
+ _this.videoRefMap[group.id].el.fullPlay('pc');
94
+ } else {
95
+ _this.videoRefMap[group.id].playing = true;
96
+
97
+ _this.videoRefMap[group.id].el.player.play();
98
+ }
99
+ }
100
+
101
+ _this.setState({});
102
+ });
103
+ };
104
+
84
105
  return _this;
85
106
  }
86
107
 
@@ -91,7 +112,7 @@ function (_super) {
91
112
  return /*#__PURE__*/_react["default"].createElement("div", {
92
113
  className: "video-layout5-wrap"
93
114
  }, data.groupSource.map(function (group) {
94
- var _a;
115
+ var _a, _b;
95
116
  /** 当前是否在播放 */
96
117
 
97
118
 
@@ -101,25 +122,6 @@ function (_super) {
101
122
  }, /*#__PURE__*/_react["default"].createElement("div", {
102
123
  key: group.id,
103
124
  className: "video-item-wrap",
104
- onClick: function onClick() {
105
- (0, _commonUtil.ensure)(function () {
106
- if (_this.videoRefMap[group.id].playing) {
107
- _this.videoRefMap[group.id].playing = false;
108
-
109
- _this.videoRefMap[group.id].el.player.pause();
110
- } else {
111
- if (group.video.playPosition == 'Popup') {
112
- _this.videoRefMap[group.id].el.fullPlay('pc');
113
- } else {
114
- _this.videoRefMap[group.id].playing = true;
115
-
116
- _this.videoRefMap[group.id].el.player.play();
117
- }
118
- }
119
-
120
- _this.setState({});
121
- });
122
- },
123
125
  style: {
124
126
  height: data.pcHeight
125
127
  }
@@ -138,12 +140,16 @@ function (_super) {
138
140
  cover: (0, _coreUtil.getVideoCover)(group),
139
141
  source: group.video.sourceUrl
140
142
  }),
143
+ play: (_b = _this.videoRefMap[group.id]) === null || _b === void 0 ? void 0 : _b.playing,
141
144
  videoId: group.id
142
145
  }), !isPlaying && /*#__PURE__*/_react["default"].createElement("div", {
143
146
  className: (0, _classnames["default"])('play-btn', {
144
147
  middle: group.video.playButton == 'Middle',
145
148
  bottomLeft: group.video.playButton == 'Bottom Left'
146
- })
149
+ }),
150
+ onClick: function onClick() {
151
+ _this.playOrPause(group);
152
+ }
147
153
  }, /*#__PURE__*/_react["default"].createElement("img", {
148
154
  alt: "",
149
155
  src: _playCircle["default"]
@@ -162,6 +168,9 @@ function (_super) {
162
168
  data: group,
163
169
  layout: 'pc-' + data.customize.layout.pcLayout,
164
170
  noShare: true,
171
+ onPlayClick: function onPlayClick() {
172
+ return _this.playOrPause(group);
173
+ },
165
174
  position: "relative"
166
175
  })));
167
176
  }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.0.160",
4
+ "version": "0.0.161",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",