@fonixtree/magic-design 0.0.161 → 0.0.163

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 (37) hide show
  1. package/es/common/ColorPicker/index.less +2 -1
  2. package/es/common/ImageModal/index.js +9 -37
  3. package/es/common/Video/index.js +73 -16
  4. package/es/common/Video/index.less +5 -0
  5. package/es/composite-comp/bol/components/Banner/defaultJSON.js +2 -6
  6. package/es/composite-comp/bol/components/Carousel/defaultJSON.js +2 -2
  7. package/es/composite-comp/bol/components/Carousel/mobile/index.js +2 -1
  8. package/es/composite-comp/bol/components/Carousel/mobile/index.less +6 -1
  9. package/es/composite-comp/bol/components/Carousel/pc/index.js +8 -2
  10. package/es/composite-comp/bol/components/Carousel/pc/index.less +7 -2
  11. package/es/composite-comp/bol/components/Text/index.js +2 -5
  12. package/es/composite-comp/bol/components/Text/index.less +2 -2
  13. package/es/composite-comp/bol/components/Video/defaultJSON.js +4 -8
  14. package/es/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
  15. package/es/core/Designer/ConfigPanel/index.js +10 -1
  16. package/es/core/Designer/PageCompList/index.js +34 -14
  17. package/es/meta-comp/components/Text/index.js +2 -1
  18. package/es/utils/commonUtil.js +27 -2
  19. package/lib/common/ColorPicker/index.less +2 -1
  20. package/lib/common/ImageModal/index.js +9 -37
  21. package/lib/common/Video/index.js +73 -16
  22. package/lib/common/Video/index.less +5 -0
  23. package/lib/composite-comp/bol/components/Banner/defaultJSON.js +2 -6
  24. package/lib/composite-comp/bol/components/Carousel/defaultJSON.js +2 -2
  25. package/lib/composite-comp/bol/components/Carousel/mobile/index.js +2 -1
  26. package/lib/composite-comp/bol/components/Carousel/mobile/index.less +6 -1
  27. package/lib/composite-comp/bol/components/Carousel/pc/index.js +8 -2
  28. package/lib/composite-comp/bol/components/Carousel/pc/index.less +7 -2
  29. package/lib/composite-comp/bol/components/Text/index.js +2 -5
  30. package/lib/composite-comp/bol/components/Text/index.less +2 -2
  31. package/lib/composite-comp/bol/components/Video/defaultJSON.js +4 -8
  32. package/lib/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
  33. package/lib/core/Designer/ConfigPanel/index.js +10 -1
  34. package/lib/core/Designer/PageCompList/index.js +34 -14
  35. package/lib/meta-comp/components/Text/index.js +2 -1
  36. package/lib/utils/commonUtil.js +27 -2
  37. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  .m-color-picker-panel {
2
- position: absolute;
2
+ position: fixed;
3
+ bottom: 5px;
3
4
  z-index: 999;
4
5
 
5
6
  .panel-bg {
@@ -427,46 +427,18 @@ function ImageModal(_a) {
427
427
  }
428
428
  });
429
429
  });
430
- };
431
-
432
- var getPreConfig = function getPreConfig() {
433
- return __awaiter(_this, void 0, void 0, function () {
434
- var wapUrl_1, error_1;
435
- return __generator(this, function (_a) {
436
- switch (_a.label) {
437
- case 0:
438
- _a.trys.push([0, 2,, 3]);
439
-
440
- return [4
441
- /*yield*/
442
- , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/pages/platforminfo")];
430
+ }; // const getPreConfig = async () => {
431
+ // try {
432
+ // const { wapUrl } = await commonFetch(`/designer/v1/${window.magicDesign.MBaseUrl}/pages/platforminfo`);
433
+ // setWapUrl(wapUrl);
434
+ // } catch (error) {
435
+ // console.error(error);
436
+ // }
437
+ // };
443
438
 
444
- case 1:
445
- wapUrl_1 = _a.sent().wapUrl;
446
- setWapUrl(wapUrl_1);
447
- return [3
448
- /*break*/
449
- , 3];
450
-
451
- case 2:
452
- error_1 = _a.sent();
453
- console.error(error_1);
454
- return [3
455
- /*break*/
456
- , 3];
457
-
458
- case 3:
459
- return [2
460
- /*return*/
461
- ];
462
- }
463
- });
464
- });
465
- };
466
439
 
467
440
  (0, _react.useEffect)(function () {
468
- getContentCatgs();
469
- getPreConfig();
441
+ getContentCatgs(); // getPreConfig();
470
442
  }, []);
471
443
 
472
444
  var selectFolder = function selectFolder(id) {
@@ -310,7 +310,32 @@ function (_super) {
310
310
  var _this = _super !== null && _super.apply(this, arguments) || this;
311
311
 
312
312
  _this.state = {};
313
- _this.player = null;
313
+ _this.player = {
314
+ play: function play() {
315
+ if (_this.aliPlayer) {
316
+ _this.aliPlayer.play();
317
+ }
318
+
319
+ if (_this.ytPlayer) {
320
+ _this.ytPlayer.playVideo();
321
+ }
322
+ },
323
+ pause: function pause() {
324
+ if (_this.aliPlayer) {
325
+ _this.aliPlayer.play();
326
+ }
327
+
328
+ if (_this.ytPlayer) {
329
+ _this.ytPlayer.pauseVideo();
330
+ }
331
+ }
332
+ };
333
+ /** 阿里播放器 */
334
+
335
+ _this.aliPlayer = null;
336
+ /** YouTube播放器 */
337
+
338
+ _this.ytPlayer = null;
314
339
  /** 创建视频弹框显示 */
315
340
 
316
341
  _this.createVideoModal = function (videoId) {
@@ -352,7 +377,7 @@ function (_super) {
352
377
 
353
378
  _this.getInit = function () {
354
379
  return __awaiter(_this, void 0, void 0, function () {
355
- var _a;
380
+ var videoId_1, _a;
356
381
 
357
382
  var _this = this;
358
383
 
@@ -372,23 +397,60 @@ function (_super) {
372
397
  _b.label = 2;
373
398
 
374
399
  case 2:
375
- if (!this.props.opts.source) return [3
400
+ if (!!window.YT) return [3
376
401
  /*break*/
377
402
  , 4];
403
+ return [4
404
+ /*yield*/
405
+ , Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
406
+
407
+ case 3:
408
+ _b.sent();
409
+
410
+ _b.label = 4;
411
+
412
+ case 4:
413
+ if (!this.props.opts.source) return [3
414
+ /*break*/
415
+ , 7];
416
+ if (!/youtu/.test(this.props.opts.source)) return [3
417
+ /*break*/
418
+ , 5];
419
+ videoId_1 = this.props.opts.source.split('youtu.be/')[1];
420
+ (0, _commonUtil.nextTick)(function () {
421
+ _this.ytPlayer = new YT.Player('video' + _this.props.videoId, {
422
+ height: '100%',
423
+ width: '100%',
424
+ videoId: videoId_1,
425
+ events: {
426
+ onReady: function onReady() {
427
+ console.log('onReady');
428
+ },
429
+ onStateChange: function onStateChange() {
430
+ console.log('onStateChange');
431
+ }
432
+ }
433
+ });
434
+ }, 500, 10);
435
+ return [3
436
+ /*break*/
437
+ , 7];
438
+
439
+ case 5:
378
440
  _a = this;
379
441
  return [4
380
442
  /*yield*/
381
443
  , createVideo(this.props.videoId, this.props.opts)];
382
444
 
383
- case 3:
384
- _a.player = _b.sent();
385
- this.player.on('ended', function () {
445
+ case 6:
446
+ _a.aliPlayer = _b.sent();
447
+ this.aliPlayer.on('ended', function () {
386
448
  if (!_this.props.opts.loop) {// this.props.onEnd();
387
449
  }
388
450
  });
389
- _b.label = 4;
451
+ _b.label = 7;
390
452
 
391
- case 4:
453
+ case 7:
392
454
  return [2
393
455
  /*return*/
394
456
  ];
@@ -397,13 +459,8 @@ function (_super) {
397
459
  });
398
460
  };
399
461
 
400
- _this.fullPlay = function (type) {
401
- // if (type == 'h5') {
402
- // this.player.fullscreenService.requestFullScreen();
403
- // }
404
- // if (type == 'pc') {
405
- _this.createVideoModal(_this.props.videoId); // }
406
-
462
+ _this.fullPlay = function () {
463
+ _this.createVideoModal(_this.props.videoId);
407
464
  };
408
465
 
409
466
  return _this;
@@ -418,10 +475,10 @@ function (_super) {
418
475
  videoId = _a.videoId,
419
476
  opts = _a.opts,
420
477
  play = _a.play;
421
- console.log('play: ', play);
422
478
  return /*#__PURE__*/_react["default"].createElement("div", {
423
479
  className: "video-container"
424
480
  }, opts.source ? /*#__PURE__*/_react["default"].createElement("div", {
481
+ className: "video-wrap",
425
482
  id: 'video' + videoId
426
483
  }) : null, !play && /*#__PURE__*/_react["default"].createElement("div", {
427
484
  className: "cover-video"
@@ -15,6 +15,11 @@
15
15
  top: 0;
16
16
  background-color: rgba(0, 0, 0, 0);
17
17
  }
18
+
19
+ .video-wrap {
20
+ width: 100%;
21
+ height: 100%;
22
+ }
18
23
  }
19
24
 
20
25
  .pc-video-modal-wrap {
@@ -7,10 +7,6 @@ exports.getDefaultJSON = exports.bannerGroupSourceJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
- var _banner = _interopRequireDefault(require("./imgs/banner.png"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
15
11
  var groupId = (0, _uuid.v4)();
16
12
  return {
@@ -23,8 +19,8 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
23
19
  content: {
24
20
  h5Name: 'name2',
25
21
  pcName: 'name2',
26
- h5ImgSrc: _banner["default"],
27
- pcImgSrc: _banner["default"],
22
+ h5ImgSrc: '',
23
+ pcImgSrc: '',
28
24
  clickUrl: ''
29
25
  },
30
26
  hover: {
@@ -18,8 +18,8 @@ var imagesGroupSourceJSON = function imagesGroupSourceJSON(compId) {
18
18
  open: true,
19
19
  type: 'IMAGE',
20
20
  content: {
21
- h5Name: 'h5Name',
22
- pcName: 'pcName',
21
+ h5Name: 'Image Name',
22
+ pcName: 'Image Name',
23
23
  h5ImgSrc: '',
24
24
  pcImgSrc: '',
25
25
  clickUrl: ''
@@ -208,12 +208,13 @@ function (_super) {
208
208
  });
209
209
  }
210
210
  };
211
+ var dotsSpace = Math.max(data.setting.dots.size, data.setting.dots.hoverSize) + 12 + "px";
211
212
  return /*#__PURE__*/_react["default"].createElement("div", {
212
213
  className: "m-carousel-mobile"
213
214
  }, /*#__PURE__*/_react["default"].createElement("div", {
214
215
  className: "content",
215
216
  style: {
216
- paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '20px' : '0'
217
+ paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
217
218
  }
218
219
  }, /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
219
220
  ref: function ref(slider) {
@@ -85,11 +85,16 @@
85
85
  border-radius: 50%;
86
86
  background: #FFF;
87
87
  cursor: inherit;
88
- margin-right: 1em;
88
+ margin-right: 10px;
89
89
  transition: all .5s;
90
90
 
91
+ &:last-child {
92
+ margin-right: 0;
93
+ }
94
+
91
95
  &.active {
92
96
  width: 2em;
97
+ height: 1em;
93
98
  border-radius: 100px;
94
99
  opacity: 1;
95
100
  }
@@ -205,12 +205,14 @@ function (_super) {
205
205
  fontSize: data.setting.navigation.size,
206
206
  color: data.setting.navigation.color
207
207
  };
208
+ var dotsSpace = Math.max(data.setting.dots.size, data.setting.dots.hoverSize) * 1.25 + 20 + "px";
209
+ var sliderWidth = "calc(100% - " + (data.setting.navigation.size + 20) * 2 + "px)";
208
210
  return /*#__PURE__*/_react["default"].createElement("div", {
209
211
  className: "m-carousel-pc"
210
212
  }, /*#__PURE__*/_react["default"].createElement("div", {
211
213
  className: "content",
212
214
  style: {
213
- paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '30px' : '0'
215
+ paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
214
216
  }
215
217
  }, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
216
218
  className: "carousel-icon-left",
@@ -225,7 +227,11 @@ function (_super) {
225
227
  ref: function ref(slider) {
226
228
  return _this.sliderRef = slider;
227
229
  }
228
- }, settings), data.groupSource.map(function (item) {
230
+ }, settings, {
231
+ style: {
232
+ width: sliderWidth
233
+ }
234
+ }), data.groupSource.map(function (item) {
229
235
  return /*#__PURE__*/_react["default"].createElement("div", {
230
236
  key: item.id,
231
237
  className: "img-wrap"
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .slider-wrap {
21
- width: calc(100% - 72px);
21
+ // width: calc(100% - 72px);
22
22
  margin: 0 auto;
23
23
  line-height: 1;
24
24
 
@@ -101,11 +101,16 @@
101
101
  border-radius: 50%;
102
102
  background: #FFF;
103
103
  cursor: inherit;
104
- margin-right: 1.25em;
104
+ margin-right: 10px;
105
105
  transition: all .5s;
106
106
 
107
+ &:last-child {
108
+ margin-right: 0;
109
+ }
110
+
107
111
  &.active {
108
112
  width: 2.5em;
113
+ height: 1.25em;
109
114
  border-radius: 100px;
110
115
  opacity: 1;
111
116
  }
@@ -59,11 +59,6 @@ var __decorate = void 0 && (void 0).__decorate || function (decorators, target,
59
59
  return c > 3 && r && Object.defineProperty(target, key, r), r;
60
60
  };
61
61
 
62
- // import './index.less';
63
- // less to css 在线地址 https://tool.oschina.net/less
64
- // css 压缩地址 https://www.runoob.com/csspack
65
- var style = '.m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{padding:10px 20px;}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}';
66
-
67
62
  var Text =
68
63
  /** @class */
69
64
  function (_super) {
@@ -80,6 +75,8 @@ function (_super) {
80
75
  nodeData = _b.nodeData,
81
76
  mode = _b.mode,
82
77
  outputType = _b.outputType;
78
+ var groupWrapContainerStyle = window.magicDesign.device === 'pc' ? 'padding: 16px 20px;' : 'padding: 12px 20px;';
79
+ var style = ".m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{" + groupWrapContainerStyle + "}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}";
83
80
  return /*#__PURE__*/_react["default"].createElement("div", {
84
81
  className: "m-text",
85
82
  onClick: this.onComponentClick
@@ -1,7 +1,7 @@
1
1
  .m-text {
2
2
  display: flex;
3
3
  flex-direction: column;
4
-
4
+
5
5
  .title-wrap {
6
6
  font-weight: 500;
7
7
  font-size: 20px;
@@ -17,7 +17,7 @@
17
17
  width: 100%;
18
18
 
19
19
  .group-wrap-container {
20
- padding: 10px 20px;
20
+ padding: 16px 20px;
21
21
  }
22
22
 
23
23
  .group-wrap {
@@ -7,10 +7,6 @@ exports.videoGroupSourceJSON = exports.getDefaultJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
- var _banner = _interopRequireDefault(require("./imgs/banner.png"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
15
11
  var groupId = (0, _uuid.v4)();
16
12
  return {
@@ -24,8 +20,8 @@ var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
24
20
  content: {
25
21
  h5Name: 'name2',
26
22
  pcName: 'name2',
27
- h5ImgSrc: _banner["default"],
28
- pcImgSrc: _banner["default"],
23
+ h5ImgSrc: '',
24
+ pcImgSrc: '',
29
25
  clickUrl: ''
30
26
  },
31
27
  hover: {
@@ -141,8 +137,8 @@ var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
141
137
  content: {
142
138
  h5Name: 'name2',
143
139
  pcName: 'name2',
144
- h5ImgSrc: _banner["default"],
145
- pcImgSrc: _banner["default"],
140
+ h5ImgSrc: '',
141
+ pcImgSrc: '',
146
142
  clickUrl: ''
147
143
  },
148
144
  hover: {}
@@ -112,7 +112,7 @@ function (_super) {
112
112
  src: ((0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc) || _defaultImg["default"]
113
113
  }), /*#__PURE__*/_react["default"].createElement("div", {
114
114
  className: "name"
115
- }, (0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc));
115
+ }, (0, _coreUtil.isPc)() ? src.image.content.pcName : src.image.content.h5Name));
116
116
  };
117
117
 
118
118
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -217,7 +217,7 @@ function (_super) {
217
217
  };
218
218
 
219
219
  _this.getSecondConfigName = function () {
220
- var _a, _b, _c, _d, _e;
220
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
221
221
 
222
222
  var selectedNode = _this.state.selectedNode;
223
223
 
@@ -237,6 +237,7 @@ function (_super) {
237
237
  }
238
238
 
239
239
  var groupName = '';
240
+ console.log('...', selectedNode.type, panelProps);
240
241
 
241
242
  switch (selectedNode.type) {
242
243
  case 'IMAGE_GALLERY':
@@ -250,11 +251,19 @@ function (_super) {
250
251
 
251
252
  break;
252
253
 
254
+ case 'CAROUSEL':
255
+ groupName = (0, _coreUtil.isPc)() ? (_g = (_f = panelProps.image) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.pcName : (_j = (_h = panelProps.image) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j.h5Name;
256
+ break;
257
+
253
258
  case 'MOBILE_NAVIGATION':
254
259
  case 'PC_NAVIGATION':
255
260
  groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
256
261
  break;
257
262
 
263
+ case 'TEXT':
264
+ groupName = panelProps.content.title.text;
265
+ break;
266
+
258
267
  case 'RECOMMEND':
259
268
  groupName = panelProps.groupName.text;
260
269
  break;
@@ -15,6 +15,8 @@ var _immutabilityHelper = _interopRequireDefault(require("immutability-helper"))
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
18
+ var _lodash = require("lodash");
19
+
18
20
  var _common = require("../../../common");
19
21
 
20
22
  var _coreUtil = require("../../../utils/coreUtil");
@@ -78,6 +80,15 @@ function PageCompList(_a) {
78
80
  setHoveredFloor = _e[1];
79
81
 
80
82
  var ref = (0, _react.useRef)();
83
+
84
+ var getActiveComponents = function getActiveComponents() {
85
+ var filter = components.filter(function (comp) {
86
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
87
+ });
88
+ return filter;
89
+ };
90
+
91
+ var activeComponents = getActiveComponents();
81
92
  (0, _react.useEffect)(function () {
82
93
  setComponents(pageData || []);
83
94
  }, [pageData]);
@@ -109,7 +120,6 @@ function PageCompList(_a) {
109
120
  };
110
121
 
111
122
  var onDragEnter = function onDragEnter(e) {
112
- console.log('drag enter');
113
123
  var hoverNodeId = e.currentTarget.dataset.nodeid;
114
124
 
115
125
  if (dragId === hoverNodeId) {
@@ -127,18 +137,36 @@ function PageCompList(_a) {
127
137
  }
128
138
  };
129
139
 
140
+ var getLastSameIndex = function getLastSameIndex(comps, index) {
141
+ var lastComps = comps.slice(0, index);
142
+ var newIndex = (0, _lodash.findLastIndex)(lastComps, function (comp) {
143
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
144
+ });
145
+ return newIndex;
146
+ };
147
+
148
+ var getNextSameIndex = function getNextSameIndex(comps, index) {
149
+ var nextComps = comps.slice(index + 1);
150
+ var newIndex = (0, _lodash.findIndex)(nextComps, function (comp) {
151
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
152
+ });
153
+ return newIndex + index + 1;
154
+ };
155
+
130
156
  var onMenuClick = function onMenuClick(activeComp, operType) {
131
157
  var newComponents = __spreadArrays(components);
132
158
 
133
159
  var index = newComponents.indexOf(activeComp);
134
160
 
135
161
  if (operType === operTypeMap.MOVE_UP) {
136
- var temp = newComponents[index - 1];
137
- newComponents[index - 1] = newComponents[index];
162
+ var newIndex = getLastSameIndex(newComponents, index);
163
+ var temp = newComponents[newIndex];
164
+ newComponents[newIndex] = newComponents[index];
138
165
  newComponents[index] = temp;
139
166
  } else if (operType === operTypeMap.MOVE_DOWN) {
140
- var temp = newComponents[index + 1];
141
- newComponents[index + 1] = newComponents[index];
167
+ var newIndex = getNextSameIndex(newComponents, index);
168
+ var temp = newComponents[newIndex];
169
+ newComponents[newIndex] = newComponents[index];
142
170
  newComponents[index] = temp;
143
171
  } else if (operType === operTypeMap.COPY) {
144
172
  var copyComponent = (0, _coreUtil.copyNode)(newComponents[index]);
@@ -193,7 +221,7 @@ function PageCompList(_a) {
193
221
  }, index !== 0 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
194
222
  className: "menu_item",
195
223
  value: "1"
196
- }, (0, _locale.i18n)('MOVE_UP')), index !== components.length - 1 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
224
+ }, (0, _locale.i18n)('MOVE_UP')), index !== activeComponents.length - 1 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
197
225
  className: "menu_item",
198
226
  value: "2"
199
227
  }, (0, _locale.i18n)('MOVE_DOWN')), /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
@@ -277,14 +305,6 @@ function PageCompList(_a) {
277
305
  })));
278
306
  };
279
307
 
280
- var getActiveComponents = function getActiveComponents() {
281
- var filter = components.filter(function (comp) {
282
- return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
283
- });
284
- return filter;
285
- };
286
-
287
- var activeComponents = getActiveComponents();
288
308
  return /*#__PURE__*/_react["default"].createElement("div", {
289
309
  className: "page-comp-wrap"
290
310
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -481,7 +481,8 @@ function (_super) {
481
481
  style = __assign(__assign({}, style), {
482
482
  textDecorationLine: data.underline.open ? 'underline' : 'none',
483
483
  textDecorationColor: data.underline.textDecorationColor,
484
- textDecorationStyle: data.underline.textDecorationStyle
484
+ textDecorationStyle: data.underline.textDecorationStyle,
485
+ textUnderlineOffset: Math.ceil(style.fontSize * 0.2) + 'px'
485
486
  });
486
487
  }
487
488
 
@@ -14,7 +14,7 @@ exports.dragSource = void 0;
14
14
  exports.ensure = ensure;
15
15
  exports.getColorRgba = void 0;
16
16
  exports.getPageDataMap = getPageDataMap;
17
- exports.navigateTo = exports.importAsync = exports.getUrlParams = void 0;
17
+ exports.nextTick = exports.navigateTo = exports.importAsync = exports.getUrlParams = void 0;
18
18
  exports.pushGA = pushGA;
19
19
  exports.shareFacebook = shareFacebook;
20
20
  exports.shareLinkedin = shareLinkedin;
@@ -474,4 +474,29 @@ function covertKey(data, func) {
474
474
  var newData = (0, _lodash.cloneDeep)(data);
475
475
  func(newData);
476
476
  return JSON.stringify(newData);
477
- }
477
+ }
478
+
479
+ var nextTick = function nextTick(func, interval, count) {
480
+ if (interval === void 0) {
481
+ interval = 100;
482
+ }
483
+
484
+ if (count === void 0) {
485
+ count = 5;
486
+ }
487
+
488
+ try {
489
+ func();
490
+ } catch (error) {
491
+ if (count == 0) {
492
+ console.error('nextTick 失败');
493
+ return;
494
+ }
495
+
496
+ setTimeout(function () {
497
+ nextTick(func, interval, count - 1);
498
+ }, interval);
499
+ }
500
+ };
501
+
502
+ exports.nextTick = nextTick;
@@ -1,5 +1,6 @@
1
1
  .m-color-picker-panel {
2
- position: absolute;
2
+ position: fixed;
3
+ bottom: 5px;
3
4
  z-index: 999;
4
5
 
5
6
  .panel-bg {
@@ -427,46 +427,18 @@ function ImageModal(_a) {
427
427
  }
428
428
  });
429
429
  });
430
- };
431
-
432
- var getPreConfig = function getPreConfig() {
433
- return __awaiter(_this, void 0, void 0, function () {
434
- var wapUrl_1, error_1;
435
- return __generator(this, function (_a) {
436
- switch (_a.label) {
437
- case 0:
438
- _a.trys.push([0, 2,, 3]);
439
-
440
- return [4
441
- /*yield*/
442
- , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/pages/platforminfo")];
430
+ }; // const getPreConfig = async () => {
431
+ // try {
432
+ // const { wapUrl } = await commonFetch(`/designer/v1/${window.magicDesign.MBaseUrl}/pages/platforminfo`);
433
+ // setWapUrl(wapUrl);
434
+ // } catch (error) {
435
+ // console.error(error);
436
+ // }
437
+ // };
443
438
 
444
- case 1:
445
- wapUrl_1 = _a.sent().wapUrl;
446
- setWapUrl(wapUrl_1);
447
- return [3
448
- /*break*/
449
- , 3];
450
-
451
- case 2:
452
- error_1 = _a.sent();
453
- console.error(error_1);
454
- return [3
455
- /*break*/
456
- , 3];
457
-
458
- case 3:
459
- return [2
460
- /*return*/
461
- ];
462
- }
463
- });
464
- });
465
- };
466
439
 
467
440
  (0, _react.useEffect)(function () {
468
- getContentCatgs();
469
- getPreConfig();
441
+ getContentCatgs(); // getPreConfig();
470
442
  }, []);
471
443
 
472
444
  var selectFolder = function selectFolder(id) {
@@ -310,7 +310,32 @@ function (_super) {
310
310
  var _this = _super !== null && _super.apply(this, arguments) || this;
311
311
 
312
312
  _this.state = {};
313
- _this.player = null;
313
+ _this.player = {
314
+ play: function play() {
315
+ if (_this.aliPlayer) {
316
+ _this.aliPlayer.play();
317
+ }
318
+
319
+ if (_this.ytPlayer) {
320
+ _this.ytPlayer.playVideo();
321
+ }
322
+ },
323
+ pause: function pause() {
324
+ if (_this.aliPlayer) {
325
+ _this.aliPlayer.play();
326
+ }
327
+
328
+ if (_this.ytPlayer) {
329
+ _this.ytPlayer.pauseVideo();
330
+ }
331
+ }
332
+ };
333
+ /** 阿里播放器 */
334
+
335
+ _this.aliPlayer = null;
336
+ /** YouTube播放器 */
337
+
338
+ _this.ytPlayer = null;
314
339
  /** 创建视频弹框显示 */
315
340
 
316
341
  _this.createVideoModal = function (videoId) {
@@ -352,7 +377,7 @@ function (_super) {
352
377
 
353
378
  _this.getInit = function () {
354
379
  return __awaiter(_this, void 0, void 0, function () {
355
- var _a;
380
+ var videoId_1, _a;
356
381
 
357
382
  var _this = this;
358
383
 
@@ -372,23 +397,60 @@ function (_super) {
372
397
  _b.label = 2;
373
398
 
374
399
  case 2:
375
- if (!this.props.opts.source) return [3
400
+ if (!!window.YT) return [3
376
401
  /*break*/
377
402
  , 4];
403
+ return [4
404
+ /*yield*/
405
+ , Promise.all([(0, _commonUtil.importAsync)('https://www.youtube.com/iframe_api', 'js')])];
406
+
407
+ case 3:
408
+ _b.sent();
409
+
410
+ _b.label = 4;
411
+
412
+ case 4:
413
+ if (!this.props.opts.source) return [3
414
+ /*break*/
415
+ , 7];
416
+ if (!/youtu/.test(this.props.opts.source)) return [3
417
+ /*break*/
418
+ , 5];
419
+ videoId_1 = this.props.opts.source.split('youtu.be/')[1];
420
+ (0, _commonUtil.nextTick)(function () {
421
+ _this.ytPlayer = new YT.Player('video' + _this.props.videoId, {
422
+ height: '100%',
423
+ width: '100%',
424
+ videoId: videoId_1,
425
+ events: {
426
+ onReady: function onReady() {
427
+ console.log('onReady');
428
+ },
429
+ onStateChange: function onStateChange() {
430
+ console.log('onStateChange');
431
+ }
432
+ }
433
+ });
434
+ }, 500, 10);
435
+ return [3
436
+ /*break*/
437
+ , 7];
438
+
439
+ case 5:
378
440
  _a = this;
379
441
  return [4
380
442
  /*yield*/
381
443
  , createVideo(this.props.videoId, this.props.opts)];
382
444
 
383
- case 3:
384
- _a.player = _b.sent();
385
- this.player.on('ended', function () {
445
+ case 6:
446
+ _a.aliPlayer = _b.sent();
447
+ this.aliPlayer.on('ended', function () {
386
448
  if (!_this.props.opts.loop) {// this.props.onEnd();
387
449
  }
388
450
  });
389
- _b.label = 4;
451
+ _b.label = 7;
390
452
 
391
- case 4:
453
+ case 7:
392
454
  return [2
393
455
  /*return*/
394
456
  ];
@@ -397,13 +459,8 @@ function (_super) {
397
459
  });
398
460
  };
399
461
 
400
- _this.fullPlay = function (type) {
401
- // if (type == 'h5') {
402
- // this.player.fullscreenService.requestFullScreen();
403
- // }
404
- // if (type == 'pc') {
405
- _this.createVideoModal(_this.props.videoId); // }
406
-
462
+ _this.fullPlay = function () {
463
+ _this.createVideoModal(_this.props.videoId);
407
464
  };
408
465
 
409
466
  return _this;
@@ -418,10 +475,10 @@ function (_super) {
418
475
  videoId = _a.videoId,
419
476
  opts = _a.opts,
420
477
  play = _a.play;
421
- console.log('play: ', play);
422
478
  return /*#__PURE__*/_react["default"].createElement("div", {
423
479
  className: "video-container"
424
480
  }, opts.source ? /*#__PURE__*/_react["default"].createElement("div", {
481
+ className: "video-wrap",
425
482
  id: 'video' + videoId
426
483
  }) : null, !play && /*#__PURE__*/_react["default"].createElement("div", {
427
484
  className: "cover-video"
@@ -15,6 +15,11 @@
15
15
  top: 0;
16
16
  background-color: rgba(0, 0, 0, 0);
17
17
  }
18
+
19
+ .video-wrap {
20
+ width: 100%;
21
+ height: 100%;
22
+ }
18
23
  }
19
24
 
20
25
  .pc-video-modal-wrap {
@@ -7,10 +7,6 @@ exports.getDefaultJSON = exports.bannerGroupSourceJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
- var _banner = _interopRequireDefault(require("./imgs/banner.png"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
15
11
  var groupId = (0, _uuid.v4)();
16
12
  return {
@@ -23,8 +19,8 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
23
19
  content: {
24
20
  h5Name: 'name2',
25
21
  pcName: 'name2',
26
- h5ImgSrc: _banner["default"],
27
- pcImgSrc: _banner["default"],
22
+ h5ImgSrc: '',
23
+ pcImgSrc: '',
28
24
  clickUrl: ''
29
25
  },
30
26
  hover: {
@@ -18,8 +18,8 @@ var imagesGroupSourceJSON = function imagesGroupSourceJSON(compId) {
18
18
  open: true,
19
19
  type: 'IMAGE',
20
20
  content: {
21
- h5Name: 'h5Name',
22
- pcName: 'pcName',
21
+ h5Name: 'Image Name',
22
+ pcName: 'Image Name',
23
23
  h5ImgSrc: '',
24
24
  pcImgSrc: '',
25
25
  clickUrl: ''
@@ -208,12 +208,13 @@ function (_super) {
208
208
  });
209
209
  }
210
210
  };
211
+ var dotsSpace = Math.max(data.setting.dots.size, data.setting.dots.hoverSize) + 12 + "px";
211
212
  return /*#__PURE__*/_react["default"].createElement("div", {
212
213
  className: "m-carousel-mobile"
213
214
  }, /*#__PURE__*/_react["default"].createElement("div", {
214
215
  className: "content",
215
216
  style: {
216
- paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '20px' : '0'
217
+ paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
217
218
  }
218
219
  }, /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
219
220
  ref: function ref(slider) {
@@ -85,11 +85,16 @@
85
85
  border-radius: 50%;
86
86
  background: #FFF;
87
87
  cursor: inherit;
88
- margin-right: 1em;
88
+ margin-right: 10px;
89
89
  transition: all .5s;
90
90
 
91
+ &:last-child {
92
+ margin-right: 0;
93
+ }
94
+
91
95
  &.active {
92
96
  width: 2em;
97
+ height: 1em;
93
98
  border-radius: 100px;
94
99
  opacity: 1;
95
100
  }
@@ -205,12 +205,14 @@ function (_super) {
205
205
  fontSize: data.setting.navigation.size,
206
206
  color: data.setting.navigation.color
207
207
  };
208
+ var dotsSpace = Math.max(data.setting.dots.size, data.setting.dots.hoverSize) * 1.25 + 20 + "px";
209
+ var sliderWidth = "calc(100% - " + (data.setting.navigation.size + 20) * 2 + "px)";
208
210
  return /*#__PURE__*/_react["default"].createElement("div", {
209
211
  className: "m-carousel-pc"
210
212
  }, /*#__PURE__*/_react["default"].createElement("div", {
211
213
  className: "content",
212
214
  style: {
213
- paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '30px' : '0'
215
+ paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
214
216
  }
215
217
  }, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
216
218
  className: "carousel-icon-left",
@@ -225,7 +227,11 @@ function (_super) {
225
227
  ref: function ref(slider) {
226
228
  return _this.sliderRef = slider;
227
229
  }
228
- }, settings), data.groupSource.map(function (item) {
230
+ }, settings, {
231
+ style: {
232
+ width: sliderWidth
233
+ }
234
+ }), data.groupSource.map(function (item) {
229
235
  return /*#__PURE__*/_react["default"].createElement("div", {
230
236
  key: item.id,
231
237
  className: "img-wrap"
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .slider-wrap {
21
- width: calc(100% - 72px);
21
+ // width: calc(100% - 72px);
22
22
  margin: 0 auto;
23
23
  line-height: 1;
24
24
 
@@ -101,11 +101,16 @@
101
101
  border-radius: 50%;
102
102
  background: #FFF;
103
103
  cursor: inherit;
104
- margin-right: 1.25em;
104
+ margin-right: 10px;
105
105
  transition: all .5s;
106
106
 
107
+ &:last-child {
108
+ margin-right: 0;
109
+ }
110
+
107
111
  &.active {
108
112
  width: 2.5em;
113
+ height: 1.25em;
109
114
  border-radius: 100px;
110
115
  opacity: 1;
111
116
  }
@@ -59,11 +59,6 @@ var __decorate = void 0 && (void 0).__decorate || function (decorators, target,
59
59
  return c > 3 && r && Object.defineProperty(target, key, r), r;
60
60
  };
61
61
 
62
- // import './index.less';
63
- // less to css 在线地址 https://tool.oschina.net/less
64
- // css 压缩地址 https://www.runoob.com/csspack
65
- var style = '.m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{padding:10px 20px;}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}';
66
-
67
62
  var Text =
68
63
  /** @class */
69
64
  function (_super) {
@@ -80,6 +75,8 @@ function (_super) {
80
75
  nodeData = _b.nodeData,
81
76
  mode = _b.mode,
82
77
  outputType = _b.outputType;
78
+ var groupWrapContainerStyle = window.magicDesign.device === 'pc' ? 'padding: 16px 20px;' : 'padding: 12px 20px;';
79
+ var style = ".m-text{display: flex;flex-direction: column;}.m-text .title-wrap{font-weight:500;font-size:20px;}.m-text .sub-title-text{font-size:15px;color:#b7b7b7;margin-top:10px;}.m-text .group-content-wrap{width:100%;}.m-text .group-content-wrap .group-wrap-container{" + groupWrapContainerStyle + "}.m-text .group-content-wrap .group-wrap{display:flex;flex-direction:column;width:100%;}.m-text .group-content-wrap .group-wrap .group-title{font-size:14px;}.m-text .group-content-wrap.col-1 .group-wrap{width:100%;}.m-text .group-content-wrap.col-2{display:grid;grid-template-columns:50% 50%;}.m-text .group-content-wrap.col-3{display:grid;grid-template-columns:33.3% 33.3% 33.3%;}.m-text .group-content-wrap.mobile{display:block;}";
83
80
  return /*#__PURE__*/_react["default"].createElement("div", {
84
81
  className: "m-text",
85
82
  onClick: this.onComponentClick
@@ -1,7 +1,7 @@
1
1
  .m-text {
2
2
  display: flex;
3
3
  flex-direction: column;
4
-
4
+
5
5
  .title-wrap {
6
6
  font-weight: 500;
7
7
  font-size: 20px;
@@ -17,7 +17,7 @@
17
17
  width: 100%;
18
18
 
19
19
  .group-wrap-container {
20
- padding: 10px 20px;
20
+ padding: 16px 20px;
21
21
  }
22
22
 
23
23
  .group-wrap {
@@ -7,10 +7,6 @@ exports.videoGroupSourceJSON = exports.getDefaultJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
- var _banner = _interopRequireDefault(require("./imgs/banner.png"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
15
11
  var groupId = (0, _uuid.v4)();
16
12
  return {
@@ -24,8 +20,8 @@ var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
24
20
  content: {
25
21
  h5Name: 'name2',
26
22
  pcName: 'name2',
27
- h5ImgSrc: _banner["default"],
28
- pcImgSrc: _banner["default"],
23
+ h5ImgSrc: '',
24
+ pcImgSrc: '',
29
25
  clickUrl: ''
30
26
  },
31
27
  hover: {
@@ -141,8 +137,8 @@ var videoGroupSourceJSON = function videoGroupSourceJSON(parentId) {
141
137
  content: {
142
138
  h5Name: 'name2',
143
139
  pcName: 'name2',
144
- h5ImgSrc: _banner["default"],
145
- pcImgSrc: _banner["default"],
140
+ h5ImgSrc: '',
141
+ pcImgSrc: '',
146
142
  clickUrl: ''
147
143
  },
148
144
  hover: {}
@@ -112,7 +112,7 @@ function (_super) {
112
112
  src: ((0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc) || _defaultImg["default"]
113
113
  }), /*#__PURE__*/_react["default"].createElement("div", {
114
114
  className: "name"
115
- }, (0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc));
115
+ }, (0, _coreUtil.isPc)() ? src.image.content.pcName : src.image.content.h5Name));
116
116
  };
117
117
 
118
118
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -217,7 +217,7 @@ function (_super) {
217
217
  };
218
218
 
219
219
  _this.getSecondConfigName = function () {
220
- var _a, _b, _c, _d, _e;
220
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
221
221
 
222
222
  var selectedNode = _this.state.selectedNode;
223
223
 
@@ -237,6 +237,7 @@ function (_super) {
237
237
  }
238
238
 
239
239
  var groupName = '';
240
+ console.log('...', selectedNode.type, panelProps);
240
241
 
241
242
  switch (selectedNode.type) {
242
243
  case 'IMAGE_GALLERY':
@@ -250,11 +251,19 @@ function (_super) {
250
251
 
251
252
  break;
252
253
 
254
+ case 'CAROUSEL':
255
+ groupName = (0, _coreUtil.isPc)() ? (_g = (_f = panelProps.image) === null || _f === void 0 ? void 0 : _f.content) === null || _g === void 0 ? void 0 : _g.pcName : (_j = (_h = panelProps.image) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j.h5Name;
256
+ break;
257
+
253
258
  case 'MOBILE_NAVIGATION':
254
259
  case 'PC_NAVIGATION':
255
260
  groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
256
261
  break;
257
262
 
263
+ case 'TEXT':
264
+ groupName = panelProps.content.title.text;
265
+ break;
266
+
258
267
  case 'RECOMMEND':
259
268
  groupName = panelProps.groupName.text;
260
269
  break;
@@ -15,6 +15,8 @@ var _immutabilityHelper = _interopRequireDefault(require("immutability-helper"))
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
18
+ var _lodash = require("lodash");
19
+
18
20
  var _common = require("../../../common");
19
21
 
20
22
  var _coreUtil = require("../../../utils/coreUtil");
@@ -78,6 +80,15 @@ function PageCompList(_a) {
78
80
  setHoveredFloor = _e[1];
79
81
 
80
82
  var ref = (0, _react.useRef)();
83
+
84
+ var getActiveComponents = function getActiveComponents() {
85
+ var filter = components.filter(function (comp) {
86
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
87
+ });
88
+ return filter;
89
+ };
90
+
91
+ var activeComponents = getActiveComponents();
81
92
  (0, _react.useEffect)(function () {
82
93
  setComponents(pageData || []);
83
94
  }, [pageData]);
@@ -109,7 +120,6 @@ function PageCompList(_a) {
109
120
  };
110
121
 
111
122
  var onDragEnter = function onDragEnter(e) {
112
- console.log('drag enter');
113
123
  var hoverNodeId = e.currentTarget.dataset.nodeid;
114
124
 
115
125
  if (dragId === hoverNodeId) {
@@ -127,18 +137,36 @@ function PageCompList(_a) {
127
137
  }
128
138
  };
129
139
 
140
+ var getLastSameIndex = function getLastSameIndex(comps, index) {
141
+ var lastComps = comps.slice(0, index);
142
+ var newIndex = (0, _lodash.findLastIndex)(lastComps, function (comp) {
143
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
144
+ });
145
+ return newIndex;
146
+ };
147
+
148
+ var getNextSameIndex = function getNextSameIndex(comps, index) {
149
+ var nextComps = comps.slice(index + 1);
150
+ var newIndex = (0, _lodash.findIndex)(nextComps, function (comp) {
151
+ return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
152
+ });
153
+ return newIndex + index + 1;
154
+ };
155
+
130
156
  var onMenuClick = function onMenuClick(activeComp, operType) {
131
157
  var newComponents = __spreadArrays(components);
132
158
 
133
159
  var index = newComponents.indexOf(activeComp);
134
160
 
135
161
  if (operType === operTypeMap.MOVE_UP) {
136
- var temp = newComponents[index - 1];
137
- newComponents[index - 1] = newComponents[index];
162
+ var newIndex = getLastSameIndex(newComponents, index);
163
+ var temp = newComponents[newIndex];
164
+ newComponents[newIndex] = newComponents[index];
138
165
  newComponents[index] = temp;
139
166
  } else if (operType === operTypeMap.MOVE_DOWN) {
140
- var temp = newComponents[index + 1];
141
- newComponents[index + 1] = newComponents[index];
167
+ var newIndex = getNextSameIndex(newComponents, index);
168
+ var temp = newComponents[newIndex];
169
+ newComponents[newIndex] = newComponents[index];
142
170
  newComponents[index] = temp;
143
171
  } else if (operType === operTypeMap.COPY) {
144
172
  var copyComponent = (0, _coreUtil.copyNode)(newComponents[index]);
@@ -193,7 +221,7 @@ function PageCompList(_a) {
193
221
  }, index !== 0 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
194
222
  className: "menu_item",
195
223
  value: "1"
196
- }, (0, _locale.i18n)('MOVE_UP')), index !== components.length - 1 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
224
+ }, (0, _locale.i18n)('MOVE_UP')), index !== activeComponents.length - 1 && /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
197
225
  className: "menu_item",
198
226
  value: "2"
199
227
  }, (0, _locale.i18n)('MOVE_DOWN')), /*#__PURE__*/_react["default"].createElement(_antd.Menu.Item, {
@@ -277,14 +305,6 @@ function PageCompList(_a) {
277
305
  })));
278
306
  };
279
307
 
280
- var getActiveComponents = function getActiveComponents() {
281
- var filter = components.filter(function (comp) {
282
- return (0, _coreUtil.isActiveFloor)(comp.activeTerminal);
283
- });
284
- return filter;
285
- };
286
-
287
- var activeComponents = getActiveComponents();
288
308
  return /*#__PURE__*/_react["default"].createElement("div", {
289
309
  className: "page-comp-wrap"
290
310
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -481,7 +481,8 @@ function (_super) {
481
481
  style = __assign(__assign({}, style), {
482
482
  textDecorationLine: data.underline.open ? 'underline' : 'none',
483
483
  textDecorationColor: data.underline.textDecorationColor,
484
- textDecorationStyle: data.underline.textDecorationStyle
484
+ textDecorationStyle: data.underline.textDecorationStyle,
485
+ textUnderlineOffset: Math.ceil(style.fontSize * 0.2) + 'px'
485
486
  });
486
487
  }
487
488
 
@@ -14,7 +14,7 @@ exports.dragSource = void 0;
14
14
  exports.ensure = ensure;
15
15
  exports.getColorRgba = void 0;
16
16
  exports.getPageDataMap = getPageDataMap;
17
- exports.navigateTo = exports.importAsync = exports.getUrlParams = void 0;
17
+ exports.nextTick = exports.navigateTo = exports.importAsync = exports.getUrlParams = void 0;
18
18
  exports.pushGA = pushGA;
19
19
  exports.shareFacebook = shareFacebook;
20
20
  exports.shareLinkedin = shareLinkedin;
@@ -474,4 +474,29 @@ function covertKey(data, func) {
474
474
  var newData = (0, _lodash.cloneDeep)(data);
475
475
  func(newData);
476
476
  return JSON.stringify(newData);
477
- }
477
+ }
478
+
479
+ var nextTick = function nextTick(func, interval, count) {
480
+ if (interval === void 0) {
481
+ interval = 100;
482
+ }
483
+
484
+ if (count === void 0) {
485
+ count = 5;
486
+ }
487
+
488
+ try {
489
+ func();
490
+ } catch (error) {
491
+ if (count == 0) {
492
+ console.error('nextTick 失败');
493
+ return;
494
+ }
495
+
496
+ setTimeout(function () {
497
+ nextTick(func, interval, count - 1);
498
+ }, interval);
499
+ }
500
+ };
501
+
502
+ exports.nextTick = nextTick;
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.161",
4
+ "version": "0.0.163",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",