@fonixtree/magic-design 0.0.186 → 0.0.188

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 (73) hide show
  1. package/es/composite-comp/bol/components/Banner/mobile/index.js +30 -4
  2. package/es/composite-comp/bol/components/Banner/pc/index.js +30 -4
  3. package/es/composite-comp/bol/components/Button/index.js +27 -1
  4. package/es/composite-comp/bol/components/Carousel/mobile/index.js +35 -5
  5. package/es/composite-comp/bol/components/Carousel/pc/index.js +50 -4
  6. package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +29 -3
  7. package/es/composite-comp/bol/components/ImageGallery/pc/index.js +28 -2
  8. package/es/composite-comp/bol/components/ImageText/mobile/index.js +62 -9
  9. package/es/composite-comp/bol/components/ImageText/pc/index.js +35 -5
  10. package/es/composite-comp/bol/components/Newsletter/index.js +9 -2
  11. package/es/composite-comp/bol/components/Tag/index.js +29 -2
  12. package/es/composite-comp/bol/components/Text/index.js +32 -0
  13. package/es/composite-comp/bol/components/Video/components/ShareBtn/index.js +36 -24
  14. package/es/composite-comp/bol/components/Video/components/VideoTag/index.js +12 -6
  15. package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +10 -0
  16. package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +10 -0
  17. package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +10 -0
  18. package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +10 -0
  19. package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +14 -0
  20. package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +10 -0
  21. package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +10 -0
  22. package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +12 -2
  23. package/es/composite-comp/bol/components/Wallet/mobile/index.js +22 -4
  24. package/es/composite-comp/bol/components/Wallet/pc/index.js +22 -4
  25. package/es/composite-comp/bol/config-panels/BannerConfig/BannerConfigGroup/index.js +26 -0
  26. package/es/composite-comp/bol/config-panels/ImageTextConfig/ImageTextConfigGroup/index.js +18 -0
  27. package/es/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -8
  28. package/es/core/Designer/ConfigPanel/index.js +82 -76
  29. package/es/core/Designer/RenderHtml/index.js +1 -1
  30. package/es/core/Renderer/index.js +5 -1
  31. package/es/decorator/metaDecorator.js +9 -0
  32. package/es/locale/en/en.json +2 -0
  33. package/es/locale/es/es.json +2 -0
  34. package/es/locale/id/id.json +2 -0
  35. package/es/meta-comp/components/Image/image/pcDefImg.png +0 -0
  36. package/es/utils/commonUtil.js +21 -35
  37. package/lib/composite-comp/bol/components/Banner/mobile/index.js +30 -4
  38. package/lib/composite-comp/bol/components/Banner/pc/index.js +30 -4
  39. package/lib/composite-comp/bol/components/Button/index.js +27 -1
  40. package/lib/composite-comp/bol/components/Carousel/mobile/index.js +35 -5
  41. package/lib/composite-comp/bol/components/Carousel/pc/index.js +50 -4
  42. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +29 -3
  43. package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +28 -2
  44. package/lib/composite-comp/bol/components/ImageText/mobile/index.js +62 -9
  45. package/lib/composite-comp/bol/components/ImageText/pc/index.js +35 -5
  46. package/lib/composite-comp/bol/components/Newsletter/index.js +9 -2
  47. package/lib/composite-comp/bol/components/Tag/index.js +29 -2
  48. package/lib/composite-comp/bol/components/Text/index.js +32 -0
  49. package/lib/composite-comp/bol/components/Video/components/ShareBtn/index.js +36 -24
  50. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.js +12 -6
  51. package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +10 -0
  52. package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +10 -0
  53. package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +10 -0
  54. package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +10 -0
  55. package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +14 -0
  56. package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +10 -0
  57. package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +10 -0
  58. package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +12 -2
  59. package/lib/composite-comp/bol/components/Wallet/mobile/index.js +22 -4
  60. package/lib/composite-comp/bol/components/Wallet/pc/index.js +22 -4
  61. package/lib/composite-comp/bol/config-panels/BannerConfig/BannerConfigGroup/index.js +26 -0
  62. package/lib/composite-comp/bol/config-panels/ImageTextConfig/ImageTextConfigGroup/index.js +18 -0
  63. package/lib/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -8
  64. package/lib/core/Designer/ConfigPanel/index.js +82 -76
  65. package/lib/core/Designer/RenderHtml/index.js +1 -1
  66. package/lib/core/Renderer/index.js +5 -1
  67. package/lib/decorator/metaDecorator.js +9 -0
  68. package/lib/locale/en/en.json +2 -0
  69. package/lib/locale/es/es.json +2 -0
  70. package/lib/locale/id/id.json +2 -0
  71. package/lib/meta-comp/components/Image/image/pcDefImg.png +0 -0
  72. package/lib/utils/commonUtil.js +21 -35
  73. package/package.json +1 -1
@@ -7,8 +7,6 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- require("./index.less");
11
-
12
10
  var _components = require("../../../../../meta-comp/components");
13
11
 
14
12
  var _constants = require("../../../../../constants");
@@ -17,6 +15,10 @@ var _commonUtil = require("../../../../../utils/commonUtil");
17
15
 
18
16
  var _currencyUtil = require("../../../../../utils/currencyUtil");
19
17
 
18
+ var _ConfigPanel = require("../../../../../core/Designer/ConfigPanel");
19
+
20
+ require("./index.less");
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
23
 
22
24
  var __extends = void 0 && (void 0).__extends || function () {
@@ -284,6 +286,10 @@ function (_super) {
284
286
  var _this = this;
285
287
 
286
288
  var data = this.props.data;
289
+ var GAData = {
290
+ moduleId: data.id,
291
+ moduleName: data.moduleIndex + '.' + data.type
292
+ };
287
293
  var colNum = data.customize.pcRowNum;
288
294
  return /*#__PURE__*/_react["default"].createElement("div", {
289
295
  className: "m-Wallet-pc"
@@ -316,19 +322,31 @@ function (_super) {
316
322
  }
317
323
  }, item.image.open && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
318
324
  className: "image",
319
- data: item.hover.open && item.hover.image.open && _this.state["hover_" + item.id] ? item.hover.image : item.image // maxHeight={MOBILE_IMG_SIZE[colNum].maxH}
325
+ data: item.hover.open && item.hover.image.open && _this.state["hover_" + item.id] ? item.hover.image : item.image,
326
+ GAData: __assign(__assign({}, GAData), {
327
+ groupId: item.id,
328
+ groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
329
+ }) // maxHeight={MOBILE_IMG_SIZE[colNum].maxH}
320
330
  ,
321
331
  maxWidth: "100%"
322
332
  }), /*#__PURE__*/_react["default"].createElement("div", {
323
333
  className: "text-content"
324
334
  }, item.title.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
325
335
  className: "title",
326
- data: item.hover.open && item.hover.title.open && _this.state["hover_" + item.id] ? item.hover.title : item.title
336
+ data: item.hover.open && item.hover.title.open && _this.state["hover_" + item.id] ? item.hover.title : item.title,
337
+ GAData: __assign(__assign({}, GAData), {
338
+ groupId: item.id,
339
+ groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
340
+ })
327
341
  }), item.amount.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
328
342
  className: "amount",
329
343
  data: __assign(__assign({}, item.hover.open && item.hover.amount.open && _this.state["hover_" + item.id] ? item.hover.amount : item.amount), {
330
344
  text: _amount
331
345
  }),
346
+ GAData: __assign(__assign({}, GAData), {
347
+ groupId: item.id,
348
+ groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
349
+ }),
332
350
  readonly: true
333
351
  })));
334
352
  })));
@@ -23,6 +23,8 @@ var _locale = require("../../../../../locale");
23
23
 
24
24
  var _decorator = require("../../../../../decorator");
25
25
 
26
+ var _defaultImg = _interopRequireDefault(require("../../../../../common/GroupList/defaultImg.png"));
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
29
 
28
30
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
@@ -95,10 +97,31 @@ function (_super) {
95
97
  _this.setState({});
96
98
  };
97
99
 
100
+ _this.renderCard = function (src) {
101
+ var name = '';
102
+
103
+ if ((0, _coreUtil.isPc)()) {
104
+ name = src.image.content.pcImgSrc ? src.image.content.pcName : (0, _locale.i18n)('BANNER_GROUP_NAME');
105
+ } else {
106
+ name = src.image.content.h5ImgSrc ? src.image.content.h5Name : (0, _locale.i18n)('BANNER_GROUP_NAME');
107
+ }
108
+
109
+ return /*#__PURE__*/_react["default"].createElement("div", {
110
+ className: "card_wrap"
111
+ }, /*#__PURE__*/_react["default"].createElement("img", {
112
+ alt: "",
113
+ src: ((0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc) || _defaultImg["default"]
114
+ }), /*#__PURE__*/_react["default"].createElement("div", {
115
+ className: "name"
116
+ }, name));
117
+ };
118
+
98
119
  return _this;
99
120
  }
100
121
 
101
122
  AComponent.prototype.render = function () {
123
+ var _this = this;
124
+
102
125
  var source = this.props.source;
103
126
  return /*#__PURE__*/_react["default"].createElement("div", {
104
127
  className: "banner_group"
@@ -108,6 +131,9 @@ function (_super) {
108
131
  className: "notice"
109
132
  }, notice) : /*#__PURE__*/_react["default"].createElement(_GroupList["default"], {
110
133
  onClickItem: this.onClickItem,
134
+ renderCard: function renderCard(v) {
135
+ return _this.renderCard(v);
136
+ },
111
137
  reRender: this.reRender,
112
138
  source: source
113
139
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -21,6 +21,8 @@ var _locale = require("../../../../../locale");
21
21
 
22
22
  var _decorator = require("../../../../../decorator");
23
23
 
24
+ var _defaultImg = _interopRequireDefault(require("../../../../../common/GroupList/defaultImg.png"));
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
27
 
26
28
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
@@ -95,10 +97,23 @@ function (_super) {
95
97
  _this.setState({});
96
98
  };
97
99
 
100
+ _this.renderCard = function (src) {
101
+ return /*#__PURE__*/_react["default"].createElement("div", {
102
+ className: "card_wrap"
103
+ }, /*#__PURE__*/_react["default"].createElement("img", {
104
+ alt: "",
105
+ src: ((0, _coreUtil.isPc)() ? src.image.content.pcImgSrc : src.image.content.h5ImgSrc) || _defaultImg["default"]
106
+ }), /*#__PURE__*/_react["default"].createElement("div", {
107
+ className: "name"
108
+ }, src.title.open ? src.title.text : (0, _locale.i18n)('IMAGE_AND_TEXT_NAME')));
109
+ };
110
+
98
111
  return _this;
99
112
  }
100
113
 
101
114
  ImageTextConfigGroup.prototype.render = function () {
115
+ var _this = this;
116
+
102
117
  var source = this.props.source;
103
118
  return /*#__PURE__*/_react["default"].createElement("div", {
104
119
  className: "banner_group"
@@ -108,6 +123,9 @@ function (_super) {
108
123
  className: "notice"
109
124
  }, notice) : /*#__PURE__*/_react["default"].createElement(_GroupList["default"], {
110
125
  onClickItem: this.onClickItem,
126
+ renderCard: function renderCard(v) {
127
+ return _this.renderCard(v);
128
+ },
111
129
  reRender: this.reRender,
112
130
  source: source
113
131
  })), /*#__PURE__*/_react["default"].createElement("div", {
@@ -7,12 +7,6 @@ exports.getDefaultJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
- var _xtLogo = _interopRequireDefault(require("./imgs/xt-logo.png"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- // import { ButtonMetaType } from '../../../meta-comp/config-panels/ButtonConfig';
15
- // import { TextMetaType } from '../../../meta-comp/config-panels/TextConfig';
16
10
  var getDefaultJSON = function getDefaultJSON() {
17
11
  return {
18
12
  id: (0, _uuid.v4)(),
@@ -25,8 +19,8 @@ var getDefaultJSON = function getDefaultJSON() {
25
19
  content: {
26
20
  h5Name: 'name2',
27
21
  pcName: 'name2',
28
- h5ImgSrc: _xtLogo["default"],
29
- pcImgSrc: _xtLogo["default"],
22
+ h5ImgSrc: '',
23
+ pcImgSrc: '',
30
24
  clickUrl: ''
31
25
  },
32
26
  hover: {
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = void 0;
8
+ exports.getSecondConfigName = exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
@@ -23,10 +23,10 @@ var _componentTypes = require("../../../constants/component-types");
23
23
 
24
24
  var _mobx = require("../../../mobx");
25
25
 
26
- require("./index.less");
27
-
28
26
  var _locale = require("../../../locale");
29
27
 
28
+ require("./index.less");
29
+
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
31
 
32
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -59,6 +59,81 @@ var __extends = void 0 && (void 0).__extends || function () {
59
59
  };
60
60
  }();
61
61
 
62
+ var getSecondConfigName = function getSecondConfigName(selectedNode, clickedGroup) {
63
+ var _a, _b, _c, _d;
64
+
65
+ if (!selectedNode || !selectedNode.groupSource) {
66
+ return;
67
+ }
68
+
69
+ var panelProps = selectedNode.groupSource.find(function (src) {
70
+ return src.id === clickedGroup;
71
+ });
72
+ var panelIndex = selectedNode.groupSource.findIndex(function (src) {
73
+ return src.id === clickedGroup;
74
+ });
75
+
76
+ if (!panelProps) {
77
+ return;
78
+ }
79
+
80
+ var groupName = '';
81
+
82
+ switch (selectedNode.type) {
83
+ case 'IMAGE_GALLERY':
84
+ case 'WALLET':
85
+ case 'BANNER':
86
+ groupName = ''; // if (!groupName) {
87
+ // groupName = isPc() ? panelProps.image?.content?.pcName : panelProps.image?.content?.h5Name;
88
+ // }
89
+
90
+ if ((0, _coreUtil.isPc)()) {
91
+ groupName = panelProps.image.content.pcImgSrc ? panelProps.image.content.pcName : (0, _locale.i18n)('BANNER_GROUP_NAME');
92
+ } else {
93
+ groupName = panelProps.image.content.h5ImgSrc ? panelProps.image.content.h5Name : (0, _locale.i18n)('BANNER_GROUP_NAME');
94
+ }
95
+
96
+ break;
97
+
98
+ case 'CAROUSEL':
99
+ groupName = (0, _coreUtil.isPc)() ? (_b = (_a = panelProps.image) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.pcName : (_d = (_c = panelProps.image) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.h5Name;
100
+ break;
101
+
102
+ case 'MOBILE_NAVIGATION':
103
+ case 'PC_NAVIGATION':
104
+ groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
105
+ break;
106
+
107
+ case 'IMAGE_TEXT':
108
+ groupName = panelProps.title.open ? panelProps.title.text : (0, _locale.i18n)('IMAGE_AND_TEXT_NAME');
109
+ break;
110
+
111
+ case 'TEXT':
112
+ groupName = panelProps.title.text;
113
+ break;
114
+
115
+ case 'RECOMMEND':
116
+ groupName = panelProps.groupName.text;
117
+ break;
118
+
119
+ case 'BUTTON':
120
+ groupName = panelProps.button.text;
121
+ break;
122
+
123
+ case 'VIDEO':
124
+ groupName = 'Video' + (panelIndex + 1);
125
+ break;
126
+
127
+ case 'TAG':
128
+ groupName = panelProps.button.text;
129
+ break;
130
+ }
131
+
132
+ return groupName || 'Group Name';
133
+ };
134
+
135
+ exports.getSecondConfigName = getSecondConfigName;
136
+
62
137
  var ConfigPanel =
63
138
  /** @class */
64
139
  function (_super) {
@@ -218,77 +293,6 @@ function (_super) {
218
293
  return null;
219
294
  };
220
295
 
221
- _this.getSecondConfigName = function () {
222
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
223
-
224
- var selectedNode = _this.state.selectedNode;
225
-
226
- if (!selectedNode || !selectedNode.groupSource) {
227
- return;
228
- }
229
-
230
- var panelProps = selectedNode.groupSource.find(function (src) {
231
- return src.id === _this.state.clickedGroup;
232
- });
233
- var panelIndex = selectedNode.groupSource.findIndex(function (src) {
234
- return src.id === _this.state.clickedGroup;
235
- });
236
-
237
- if (!panelProps) {
238
- return;
239
- }
240
-
241
- var groupName = '';
242
-
243
- switch (selectedNode.type) {
244
- case 'IMAGE_GALLERY':
245
- case 'WALLET':
246
- case 'BANNER':
247
- groupName = (_a = panelProps.title) === null || _a === void 0 ? void 0 : _a.text;
248
-
249
- if (!groupName) {
250
- groupName = (0, _coreUtil.isPc)() ? (_c = (_b = panelProps.image) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.pcName : (_e = (_d = panelProps.image) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.h5Name;
251
- }
252
-
253
- break;
254
-
255
- case 'CAROUSEL':
256
- 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;
257
- break;
258
-
259
- case 'MOBILE_NAVIGATION':
260
- case 'PC_NAVIGATION':
261
- groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
262
- break;
263
-
264
- case 'IMAGE_TEXT':
265
- groupName = panelProps.title.text;
266
- break;
267
-
268
- case 'TEXT':
269
- groupName = panelProps.title.text;
270
- break;
271
-
272
- case 'RECOMMEND':
273
- groupName = panelProps.groupName.text;
274
- break;
275
-
276
- case 'BUTTON':
277
- groupName = panelProps.button.text;
278
- break;
279
-
280
- case 'VIDEO':
281
- groupName = 'Video' + (panelIndex + 1);
282
- break;
283
-
284
- case 'TAG':
285
- groupName = panelProps.button.text;
286
- break;
287
- }
288
-
289
- return groupName || 'Group Name';
290
- };
291
-
292
296
  _this.onSecConfigBack = function () {
293
297
  _mobx.store.setState({
294
298
  clickedGroup: null
@@ -336,7 +340,9 @@ function (_super) {
336
340
  var _a, _b;
337
341
 
338
342
  var device = this.props.device;
339
- var selectedNode = this.state.selectedNode;
343
+ var _c = this.state,
344
+ selectedNode = _c.selectedNode,
345
+ clickedGroup = _c.clickedGroup;
340
346
  return /*#__PURE__*/_react["default"].createElement("div", {
341
347
  className: "config_wrap"
342
348
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -368,7 +374,7 @@ function (_super) {
368
374
  type: "icon"
369
375
  })), /*#__PURE__*/_react["default"].createElement("div", {
370
376
  className: "title"
371
- }, this.getSecondConfigName())), this.getSecondConfigInstance()));
377
+ }, getSecondConfigName(selectedNode, clickedGroup))), this.getSecondConfigInstance()));
372
378
  };
373
379
 
374
380
  return ConfigPanel;
@@ -58,7 +58,7 @@ function (_super) {
58
58
  _this.setState({
59
59
  renderProps: renderProps
60
60
  }, function () {
61
- document.querySelector('#render-html-wrap > div').style = 'max-width:800px';
61
+ document.querySelector('#render-html-wrap > div').style = 'max-width:600px';
62
62
  var html = document.querySelector('#render-html-wrap').innerHTML;
63
63
  resolve(html.replace(/url\("((\S|\s)*)"\)/g, 'url($1)'));
64
64
 
@@ -98,13 +98,17 @@ var Renderer = function Renderer(props) {
98
98
  background: pageBackground,
99
99
  overflow: 'auto'
100
100
  }
101
- }, filterCompFloor().map(function (nodeData) {
101
+ }, filterCompFloor().map(function (nodeData, moduleIndex) {
102
102
  var Clazz = _componentTypes.componentMap[nodeData.type];
103
103
 
104
104
  if (!Clazz) {
105
105
  console.error("[MagicBox] Can not find type " + nodeData.type);
106
106
  return;
107
107
  }
108
+ /** 添加模块需要 给GA使用 */
109
+
110
+
111
+ nodeData.moduleIndex = moduleIndex + 1;
108
112
 
109
113
  var newInstanceProps = __assign(__assign({}, nodeData), {
110
114
  nodeData: nodeData,
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _mobx = require("../mobx");
13
13
 
14
+ var _commonUtil = require("../utils/commonUtil");
15
+
14
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
17
 
16
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -88,6 +90,13 @@ function metaDecorator(WrappedComponent) {
88
90
  var _a, _b;
89
91
 
90
92
  if (window.magicDesign.mode === 'renderer') {
93
+ var _c = _this.props,
94
+ data = _c.data,
95
+ GAData = _c.GAData;
96
+ (0, _commonUtil.pushGA)(__assign(__assign({}, GAData), {
97
+ elementId: data.id,
98
+ elementName: data.text
99
+ }));
91
100
  return;
92
101
  } // 组织冒泡
93
102
 
@@ -1,4 +1,6 @@
1
1
  {
2
+ "IMAGE_AND_TEXT_NAME": "Image and Text Name",
3
+ "BANNER_GROUP_NAME": "Banner Group Name",
2
4
  "VIDEO": "Video",
3
5
  "BACK": "Back",
4
6
  "VIDEO_HEIGHT": "Video Height",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "IMAGE_AND_TEXT_NAME": "Image and Text Name",
3
+ "BANNER_GROUP_NAME": "Banner Group Name",
2
4
  "VIDEO": "Video",
3
5
  "BACK": "Back",
4
6
  "VIDEO_HEIGHT": "Video Height",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "IMAGE_AND_TEXT_NAME": "Image and Text Name",
3
+ "BANNER_GROUP_NAME": "Banner Group Name",
2
4
  "VIDEO": "Video",
3
5
  "BACK": "Back",
4
6
  "VIDEO_HEIGHT": "Video Height",
@@ -30,22 +30,6 @@ var _qs = _interopRequireDefault(require("qs"));
30
30
 
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
32
32
 
33
- var __assign = void 0 && (void 0).__assign || function () {
34
- __assign = Object.assign || function (t) {
35
- for (var s, i = 1, n = arguments.length; i < n; i++) {
36
- s = arguments[i];
37
-
38
- for (var p in s) {
39
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
40
- }
41
- }
42
-
43
- return t;
44
- };
45
-
46
- return __assign.apply(this, arguments);
47
- };
48
-
49
33
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
50
34
  function adopt(value) {
51
35
  return value instanceof P ? value : new P(function (resolve) {
@@ -595,25 +579,27 @@ function getPageDataMap() {
595
579
  /** GA上报 */
596
580
 
597
581
 
598
- function pushGA(data) {
599
- // setInterval(() => {
600
- var random = ~~(Math.random() * 10);
601
- window.gtag('event', 'designer_click', __assign({
602
- pageName: '页面名称' + random,
603
- moduleName: '模块名称' + random,
604
- moduleId: '模块id' + random,
605
- groupName: '组名称' + random,
606
- groupId: '组id' + random,
607
- elementName: '元素名称' + random,
608
- elementId: '元素id' + random,
609
- pageId: '页面id' + random,
610
- pageId_moduleId: 'pageId_moduleId' + random,
611
- pageId_moduleId_groupId: 'pageId_moduleId_groupId' + random,
612
- pageId_moduleId_groupId_elementId: 'pageId_moduleId_groupId_elementId' + random,
613
- pageName_moduleName: 'pageName_moduleName' + random,
614
- pageName_moduleName_groupName: 'pageName_moduleName_groupName' + random,
615
- pageName_moduleName_groupName_elementNam: 'pageName_moduleName_groupName_elementNam' + random
616
- }, data)); // }, 1000);
582
+ function pushGA(data, eventName) {
583
+ if (eventName === void 0) {
584
+ eventName = 'designer_click';
585
+ }
586
+
587
+ if (window.magicDesign.mode == 'renderer') {
588
+ var pageId = window.magicDesign.pageId || '';
589
+ var pageName = window.magicDesign.pageName || '';
590
+ var eventData = {
591
+ pageId: pageId,
592
+ pageName: pageName,
593
+ moduleId: data.moduleId,
594
+ moduleName: data.moduleName,
595
+ groupId: data.groupId,
596
+ groupName: data.groupName,
597
+ elementId: data.elementId,
598
+ elementName: data.elementName
599
+ };
600
+ console.log('GA push', eventName, eventData);
601
+ window.gtag('event', eventName, eventData);
602
+ }
617
603
  }
618
604
  /** react key 计算 */
619
605
 
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.186",
4
+ "version": "0.0.188",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",