@fonixtree/magic-design 0.0.171 → 0.0.173

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/es/common/ColorPicker/index.less +1 -2
  2. package/es/composite-comp/bol/components/Banner/mobile/index.less +7 -0
  3. package/es/composite-comp/bol/components/Banner/pc/index.less +7 -0
  4. package/es/composite-comp/bol/components/Video/components/ShareBtn/index.js +4 -2
  5. package/es/composite-comp/bol/second-config-panels/TextSecondConfig/TextContentConfigContent/index.js +7 -3
  6. package/es/composite-comp/bol/second-config-panels/TextSecondConfig/index.js +4 -3
  7. package/es/core/Designer/ConfigPanel/index.js +3 -2
  8. package/es/core/Designer/ConfigPanel/index.less +8 -4
  9. package/es/core/Designer/index.js +1 -0
  10. package/es/meta-comp/components/Button/editable.js +9 -0
  11. package/es/meta-comp/components/Text/index.js +3 -0
  12. package/es/meta-comp/config-panels/ButtonConfig/index.js +8 -0
  13. package/es/meta-comp/config-panels/TextConfig/TextLabel/index.js +92 -0
  14. package/es/meta-comp/config-panels/TextConfig/TextLabel/index.less +25 -0
  15. package/es/meta-comp/config-panels/TextConfig/index.js +192 -176
  16. package/es/utils/coreUtil.js +1 -0
  17. package/lib/common/ColorPicker/index.less +1 -2
  18. package/lib/composite-comp/bol/components/Banner/mobile/index.less +7 -0
  19. package/lib/composite-comp/bol/components/Banner/pc/index.less +7 -0
  20. package/lib/composite-comp/bol/components/Video/components/ShareBtn/index.js +4 -2
  21. package/lib/composite-comp/bol/second-config-panels/TextSecondConfig/TextContentConfigContent/index.js +7 -3
  22. package/lib/composite-comp/bol/second-config-panels/TextSecondConfig/index.js +4 -3
  23. package/lib/core/Designer/ConfigPanel/index.js +3 -2
  24. package/lib/core/Designer/ConfigPanel/index.less +8 -4
  25. package/lib/core/Designer/index.js +1 -0
  26. package/lib/meta-comp/components/Button/editable.js +9 -0
  27. package/lib/meta-comp/components/Text/index.js +3 -0
  28. package/lib/meta-comp/config-panels/ButtonConfig/index.js +8 -0
  29. package/lib/meta-comp/config-panels/TextConfig/TextLabel/index.js +92 -0
  30. package/lib/meta-comp/config-panels/TextConfig/TextLabel/index.less +25 -0
  31. package/lib/meta-comp/config-panels/TextConfig/index.js +192 -176
  32. package/lib/utils/coreUtil.js +1 -0
  33. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  .m-color-picker-panel {
2
- position: fixed;
3
- bottom: 5px;
4
2
  z-index: 999;
3
+ position: absolute;
5
4
 
6
5
  .panel-bg {
7
6
  position: fixed;
@@ -14,6 +14,13 @@
14
14
  // right: 20px;
15
15
  // }
16
16
 
17
+ .ant-carousel {
18
+ .slick-track {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+ }
23
+
17
24
  .carouselItem {
18
25
  // height: 386px;
19
26
  position: relative;
@@ -1,6 +1,13 @@
1
1
  .m-banner-pc {
2
2
  position: relative;
3
3
 
4
+ .ant-carousel {
5
+ .slick-track {
6
+ display: flex;
7
+ align-items: center;
8
+ }
9
+ }
10
+
4
11
  .swiper-ban {
5
12
  position: absolute;
6
13
  width: 100%;
@@ -73,7 +73,9 @@ function (_super) {
73
73
  var _a = this.props,
74
74
  pc = _a.pc,
75
75
  padding = _a.padding,
76
- data = _a.data;
76
+ data = _a.data,
77
+ _b = _a.shareUrl,
78
+ shareUrl = _b === void 0 ? window.location.href : _b;
77
79
  var show = this.state.show;
78
80
  return /*#__PURE__*/_react["default"].createElement("div", {
79
81
  className: (0, _classnames["default"])('video-share-btn', {
@@ -125,7 +127,7 @@ function (_super) {
125
127
  className: "share-img",
126
128
  onClick: function onClick(e) {
127
129
  e.stopPropagation();
128
- (0, _commonUtil.copy2ClipBoard)(data.url);
130
+ (0, _commonUtil.copy2ClipBoard)(shareUrl);
129
131
 
130
132
  _this.setState({
131
133
  show: false
@@ -63,7 +63,9 @@ function (_super) {
63
63
  }
64
64
 
65
65
  AComponent.prototype.render = function () {
66
- var source = this.props.source;
66
+ var _a = this.props,
67
+ source = _a.source,
68
+ outputType = _a.outputType;
67
69
  return /*#__PURE__*/_react["default"].createElement("div", {
68
70
  className: "recommend_content"
69
71
  }, /*#__PURE__*/_react["default"].createElement(_common.Collapse, {
@@ -73,14 +75,16 @@ function (_super) {
73
75
  key: '1',
74
76
  name: (0, _locale.i18n)('TITLE'),
75
77
  value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
76
- data: source.title
78
+ data: source.title,
79
+ outputType: outputType
77
80
  }),
78
81
  metaOption: source.title
79
82
  }, {
80
83
  key: '2',
81
84
  name: (0, _locale.i18n)('TEXT'),
82
85
  value: /*#__PURE__*/_react["default"].createElement(_TextConfig["default"], {
83
- data: source.text
86
+ data: source.text,
87
+ outputType: outputType
84
88
  }),
85
89
  metaOption: source.text
86
90
  }],
@@ -43,8 +43,6 @@ var __extends = void 0 && (void 0).__extends || function () {
43
43
  };
44
44
  }();
45
45
 
46
- var debug = require('debug')('worker:TextSecondConfig');
47
-
48
46
  var TextSecondConfig =
49
47
  /** @class */
50
48
  function (_super) {
@@ -65,7 +63,9 @@ function (_super) {
65
63
  }
66
64
 
67
65
  TextSecondConfig.prototype.render = function () {
68
- var panelProps = this.props.panelProps;
66
+ var _a = this.props,
67
+ panelProps = _a.panelProps,
68
+ outputType = _a.outputType;
69
69
  return /*#__PURE__*/_react["default"].createElement("div", {
70
70
  className: "recommend_second_conf_wrap"
71
71
  }, /*#__PURE__*/_react["default"].createElement(_common.Collapse, {
@@ -75,6 +75,7 @@ function (_super) {
75
75
  key: 'content',
76
76
  name: (0, _locale.i18n)('CONTENT'),
77
77
  value: /*#__PURE__*/_react["default"].createElement(_TextContentConfigContent["default"], {
78
+ outputType: outputType,
78
79
  source: panelProps.content
79
80
  })
80
81
  }],
@@ -199,6 +199,7 @@ function (_super) {
199
199
 
200
200
  _this.getSecondConfigInstance = function () {
201
201
  var selectedNode = _this.state.selectedNode;
202
+ var outputType = _this.props.outputType;
202
203
  var Clazz = _componentTypes.secondConfigPanelMap[selectedNode === null || selectedNode === void 0 ? void 0 : selectedNode.type];
203
204
  var panelProps = (0, _commonUtil.ensure)(function () {
204
205
  return selectedNode === null || selectedNode === void 0 ? void 0 : selectedNode.groupSource.find(function (src) {
@@ -208,7 +209,8 @@ function (_super) {
208
209
 
209
210
  if (panelProps) {
210
211
  var instance = Clazz ? /*#__PURE__*/_react["default"].createElement(Clazz, {
211
- panelProps: panelProps
212
+ panelProps: panelProps,
213
+ outputType: outputType
212
214
  }) : null;
213
215
  return instance;
214
216
  }
@@ -237,7 +239,6 @@ function (_super) {
237
239
  }
238
240
 
239
241
  var groupName = '';
240
- console.log('...', selectedNode.type, panelProps);
241
242
 
242
243
  switch (selectedNode.type) {
243
244
  case 'IMAGE_GALLERY':
@@ -2,11 +2,11 @@
2
2
  width: 354px;
3
3
  background: #ffffff;
4
4
  height: 100vh;
5
- overflow: scroll;
5
+ // overflow: scroll;
6
6
  transition-property: transform;
7
7
  transition-duration: .3s;
8
8
  transition-timing-function: ease;
9
- left: -354px;
9
+ left: 0;
10
10
  z-index: 200;
11
11
  // position: fixed;
12
12
  position: absolute;
@@ -20,6 +20,8 @@
20
20
  .first_config_wrap {
21
21
  height: 100%;
22
22
  padding: 24px;
23
+ max-height: 100vh;
24
+ overflow: auto;
23
25
 
24
26
  .config_header {
25
27
  font-size: 26px;
@@ -48,9 +50,11 @@
48
50
 
49
51
  .sec_config_wrap {
50
52
  position: absolute;
53
+ max-height: 100vh;
54
+ overflow: auto;
51
55
  width: 354px;
52
- left: -354px;
53
- bottom: 0;
56
+ left: 0;
57
+ // bottom: 0;
54
58
  top: 0;
55
59
  background-color: #FFF;
56
60
  padding: 24px;
@@ -732,6 +732,7 @@ function (_super) {
732
732
  ref: this.configRef,
733
733
  device: device,
734
734
  onClose: this.onPropsPanelClose,
735
+ outputType: this.props.outputType,
735
736
  pageData: MPageData
736
737
  }), /*#__PURE__*/_react["default"].createElement(_ViewArea["default"] // ref={this.viewAreaRef}
737
738
  , {
@@ -73,6 +73,13 @@ function (_super) {
73
73
 
74
74
  _this.preData = '';
75
75
  _this.preDevice = '';
76
+
77
+ _this.triggerButtonConfigRender = function () {
78
+ window.document.dispatchEvent(new Event('button-render', {
79
+ bubbles: false
80
+ }));
81
+ };
82
+
76
83
  return _this;
77
84
  }
78
85
 
@@ -102,6 +109,8 @@ function (_super) {
102
109
  _this.preData = JSON.stringify(__assign(__assign({}, JSON.parse(_this.preData)), {
103
110
  text: text
104
111
  }));
112
+
113
+ _this.triggerButtonConfigRender();
105
114
  },
106
115
  suppressContentEditableWarning: true
107
116
  }, data.text);
@@ -162,6 +162,9 @@ var initSelectionEvent = function initSelectionEvent() {
162
162
 
163
163
  if (findSelectionTarget) {
164
164
  var range = window.getSelection().getRangeAt(0);
165
+ /** 记录当前选中的范围 给label使用 */
166
+
167
+ window._currentRange = window.getSelection().getRangeAt(0);
165
168
  var startOffset = range.startOffset,
166
169
  endOffset = range.endOffset,
167
170
  startContainer_1 = range.startContainer,
@@ -101,6 +101,14 @@ function (_super) {
101
101
  return _this;
102
102
  }
103
103
 
104
+ ButtonConfig.prototype.componentDidMount = function () {
105
+ window.document.addEventListener('button-render', this.selfRender);
106
+ };
107
+
108
+ ButtonConfig.prototype.componentWillUnmount = function () {
109
+ window.document.removeEventListener('button-render', this.selfRender);
110
+ };
111
+
104
112
  ButtonConfig.prototype.render = function () {
105
113
  var _this = this;
106
114
 
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _coreUtil = require("../../../../utils/coreUtil");
11
+
12
+ require("./index.less");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ var __extends = void 0 && (void 0).__extends || function () {
17
+ var _extendStatics = function extendStatics(d, b) {
18
+ _extendStatics = Object.setPrototypeOf || {
19
+ __proto__: []
20
+ } instanceof Array && function (d, b) {
21
+ d.__proto__ = b;
22
+ } || function (d, b) {
23
+ for (var p in b) {
24
+ if (b.hasOwnProperty(p)) d[p] = b[p];
25
+ }
26
+ };
27
+
28
+ return _extendStatics(d, b);
29
+ };
30
+
31
+ return function (d, b) {
32
+ _extendStatics(d, b);
33
+
34
+ function __() {
35
+ this.constructor = d;
36
+ }
37
+
38
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39
+ };
40
+ }();
41
+
42
+ var AComponent =
43
+ /** @class */
44
+ function (_super) {
45
+ __extends(AComponent, _super);
46
+
47
+ function AComponent() {
48
+ var _this = _super !== null && _super.apply(this, arguments) || this;
49
+
50
+ _this.state = {};
51
+
52
+ _this.onLabelAdd = function (label) {
53
+ var startOffset = (window._currentRange || {}).startOffset;
54
+ var text = _this.props.data.text;
55
+
56
+ if (startOffset) {
57
+ _this.props.data.text = text.slice(0, startOffset) + label + text.slice(startOffset);
58
+ } else {
59
+ _this.props.data.text = text + label;
60
+ }
61
+
62
+ (0, _coreUtil.renderPreview)();
63
+ };
64
+
65
+ return _this;
66
+ }
67
+
68
+ AComponent.prototype.render = function () {
69
+ var _this = this;
70
+
71
+ var list = window.magicDesign.labelList || [];
72
+ return /*#__PURE__*/_react["default"].createElement("div", {
73
+ className: "text-label-content"
74
+ }, /*#__PURE__*/_react["default"].createElement("div", {
75
+ className: "label-wrap"
76
+ }, list.map(function (item) {
77
+ return /*#__PURE__*/_react["default"].createElement("span", {
78
+ key: item.value,
79
+ className: "label-item",
80
+ onClick: function onClick() {
81
+ _this.onLabelAdd('${' + item.value + '}');
82
+ }
83
+ }, item.name);
84
+ })));
85
+ };
86
+
87
+ AComponent.defaultProps = {};
88
+ return AComponent;
89
+ }(_react["default"].Component);
90
+
91
+ var _default = AComponent;
92
+ exports["default"] = _default;
@@ -0,0 +1,25 @@
1
+ .text-label-content {
2
+ background-color: #f5f6f7;
3
+
4
+ .label-wrap {
5
+ display: flex;
6
+ align-items: center;
7
+ flex-wrap: wrap;
8
+
9
+ .label-item {
10
+ padding: 5px 11px;
11
+ font-size: 14px;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ border-radius: 5px;
16
+ background-color: #fff;
17
+ margin: 8px;
18
+ cursor: pointer;
19
+
20
+ &:hover {
21
+ background-color: #f6f6f7;
22
+ }
23
+ }
24
+ }
25
+ }