@fonixtree/magic-design 0.0.37 → 0.0.39

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 (96) hide show
  1. package/README.md +320 -0
  2. package/es/assets/fonts/magic-box-iconfont.css +11 -3
  3. package/es/assets/fonts/magic-box-iconfont.css.bak +11 -3
  4. package/es/assets/fonts/magic-box-iconfont.js +1 -1
  5. package/es/assets/fonts/magic-box-iconfont.js.bak +1 -1
  6. package/es/assets/fonts/magic-box-iconfont.ttf +0 -0
  7. package/es/assets/fonts/magic-box-iconfont.woff +0 -0
  8. package/es/assets/fonts/magic-box-iconfont.woff2 +0 -0
  9. package/es/assets/images/layout-icon/layout-navigation-newline.png +0 -0
  10. package/es/assets/images/layout-icon/layout-navigation-tile.png +0 -0
  11. package/es/common/FontStyles/index.js +25 -6
  12. package/es/common/ProductSource/index.less +2 -0
  13. package/es/composite-comp/common/components/ProductItem/index.js +23 -5
  14. package/es/composite-comp/common/components/ProductItem/index.less +46 -11
  15. package/es/composite-comp/common/config-panels/CustomizeConfig/index.js +21 -4
  16. package/es/composite-comp/dito/components/FlashDeal/mobile/index.less +6 -0
  17. package/es/composite-comp/dito/components/MobileNavigation/defaultJSON.js +94 -0
  18. package/es/composite-comp/dito/components/MobileNavigation/index.js +84 -0
  19. package/es/composite-comp/dito/components/MobileNavigation/mobile/index.js +129 -0
  20. package/es/composite-comp/dito/components/MobileNavigation/mobile/index.less +292 -0
  21. package/es/composite-comp/dito/components/Recommend/defaultJSON.js +95 -15
  22. package/es/composite-comp/dito/components/Recommend/index.js +10 -1
  23. package/es/composite-comp/dito/components/Recommend/mobile/index.js +214 -77
  24. package/es/composite-comp/dito/components/Recommend/mobile/index.less +28 -27
  25. package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg1.png +0 -0
  26. package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg2.png +0 -0
  27. package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg3.png +0 -0
  28. package/es/composite-comp/dito/components/Recommend/pc/index.js +653 -0
  29. package/es/composite-comp/dito/components/Recommend/pc/index.less +80 -0
  30. package/es/composite-comp/dito/components/SearchBar/mobile/index.js +187 -4
  31. package/es/composite-comp/dito/components/SearchBar/mobile/index.less +20 -20
  32. package/es/composite-comp/dito/config-panels/MobileNavigationConfig/MobileNavigationConfigGroup/index.js +126 -0
  33. package/es/composite-comp/dito/config-panels/MobileNavigationConfig/index.js +184 -0
  34. package/es/composite-comp/dito/config-panels/RecommendConfig/index.js +115 -44
  35. package/es/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +111 -0
  36. package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +1 -3
  37. package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +89 -59
  38. package/es/constants/component-types.js +9 -3
  39. package/es/constants/index.js +5 -1
  40. package/es/constants/layout.js +31 -3
  41. package/es/core/Designer/ConfigPanel/index.js +5 -1
  42. package/es/locale/en/en.json +8 -1
  43. package/es/locale/es/es.json +12 -4
  44. package/es/locale/id/id.json +8 -1
  45. package/es/meta-comp/components/Button/index.less +1 -0
  46. package/es/meta-comp/components/Image/image/defalut-img.png +0 -0
  47. package/es/meta-comp/config-panels/TextConfig/index.js +1 -0
  48. package/lib/assets/fonts/magic-box-iconfont.css +11 -3
  49. package/lib/assets/fonts/magic-box-iconfont.css.bak +11 -3
  50. package/lib/assets/fonts/magic-box-iconfont.js +1 -1
  51. package/lib/assets/fonts/magic-box-iconfont.js.bak +1 -1
  52. package/lib/assets/fonts/magic-box-iconfont.ttf +0 -0
  53. package/lib/assets/fonts/magic-box-iconfont.woff +0 -0
  54. package/lib/assets/fonts/magic-box-iconfont.woff2 +0 -0
  55. package/lib/assets/images/layout-icon/layout-navigation-newline.png +0 -0
  56. package/lib/assets/images/layout-icon/layout-navigation-tile.png +0 -0
  57. package/lib/common/FontStyles/index.js +25 -6
  58. package/lib/common/ProductSource/index.less +2 -0
  59. package/lib/composite-comp/common/components/ProductItem/index.js +23 -5
  60. package/lib/composite-comp/common/components/ProductItem/index.less +46 -11
  61. package/lib/composite-comp/common/config-panels/CustomizeConfig/index.js +21 -4
  62. package/lib/composite-comp/dito/components/FlashDeal/mobile/index.less +6 -0
  63. package/lib/composite-comp/dito/components/MobileNavigation/defaultJSON.js +94 -0
  64. package/lib/composite-comp/dito/components/MobileNavigation/index.js +84 -0
  65. package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.js +129 -0
  66. package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.less +292 -0
  67. package/lib/composite-comp/dito/components/Recommend/defaultJSON.js +95 -15
  68. package/lib/composite-comp/dito/components/Recommend/index.js +10 -1
  69. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +214 -77
  70. package/lib/composite-comp/dito/components/Recommend/mobile/index.less +28 -27
  71. package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg1.png +0 -0
  72. package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg2.png +0 -0
  73. package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg3.png +0 -0
  74. package/lib/composite-comp/dito/components/Recommend/pc/index.js +653 -0
  75. package/lib/composite-comp/dito/components/Recommend/pc/index.less +80 -0
  76. package/lib/composite-comp/dito/components/SearchBar/mobile/index.js +187 -4
  77. package/lib/composite-comp/dito/components/SearchBar/mobile/index.less +20 -20
  78. package/lib/composite-comp/dito/config-panels/MobileNavigationConfig/MobileNavigationConfigGroup/index.js +126 -0
  79. package/lib/composite-comp/dito/config-panels/MobileNavigationConfig/index.js +184 -0
  80. package/lib/composite-comp/dito/config-panels/RecommendConfig/index.js +115 -44
  81. package/lib/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +111 -0
  82. package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +1 -3
  83. package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +89 -59
  84. package/lib/constants/component-types.js +9 -3
  85. package/lib/constants/index.js +5 -1
  86. package/lib/constants/layout.js +31 -3
  87. package/lib/core/Designer/ConfigPanel/index.js +5 -1
  88. package/lib/locale/en/en.json +8 -1
  89. package/lib/locale/es/es.json +12 -4
  90. package/lib/locale/id/id.json +8 -1
  91. package/lib/meta-comp/components/Button/index.less +1 -0
  92. package/lib/meta-comp/components/Image/image/defalut-img.png +0 -0
  93. package/lib/meta-comp/config-panels/TextConfig/index.js +1 -0
  94. package/package.json +86 -1
  95. package/es/composite-comp/dito/config-panels/RecommendConfig/imgs/layout1.png +0 -0
  96. package/lib/composite-comp/dito/config-panels/RecommendConfig/imgs/layout1.png +0 -0
@@ -0,0 +1,653 @@
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 _macy = _interopRequireDefault(require("macy"));
11
+
12
+ require("./index.less");
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _mobx = require("../../../../../mobx");
17
+
18
+ var _ProductItem = _interopRequireDefault(require("../../../../common/components/ProductItem"));
19
+
20
+ var _components = require("../../../../../meta-comp/components");
21
+
22
+ var _storeUtil = require("../../../../../utils/storeUtil");
23
+
24
+ var _commonUtil = require("../../../../../utils/commonUtil");
25
+
26
+ var _coreUtil = require("../../../../../utils/coreUtil");
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
+
30
+ var __extends = void 0 && (void 0).__extends || function () {
31
+ var _extendStatics = function extendStatics(d, b) {
32
+ _extendStatics = Object.setPrototypeOf || {
33
+ __proto__: []
34
+ } instanceof Array && function (d, b) {
35
+ d.__proto__ = b;
36
+ } || function (d, b) {
37
+ for (var p in b) {
38
+ if (b.hasOwnProperty(p)) d[p] = b[p];
39
+ }
40
+ };
41
+
42
+ return _extendStatics(d, b);
43
+ };
44
+
45
+ return function (d, b) {
46
+ _extendStatics(d, b);
47
+
48
+ function __() {
49
+ this.constructor = d;
50
+ }
51
+
52
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
53
+ };
54
+ }();
55
+
56
+ var __assign = void 0 && (void 0).__assign || function () {
57
+ __assign = Object.assign || function (t) {
58
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
59
+ s = arguments[i];
60
+
61
+ for (var p in s) {
62
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
63
+ }
64
+ }
65
+
66
+ return t;
67
+ };
68
+
69
+ return __assign.apply(this, arguments);
70
+ };
71
+
72
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
73
+ function adopt(value) {
74
+ return value instanceof P ? value : new P(function (resolve) {
75
+ resolve(value);
76
+ });
77
+ }
78
+
79
+ return new (P || (P = Promise))(function (resolve, reject) {
80
+ function fulfilled(value) {
81
+ try {
82
+ step(generator.next(value));
83
+ } catch (e) {
84
+ reject(e);
85
+ }
86
+ }
87
+
88
+ function rejected(value) {
89
+ try {
90
+ step(generator["throw"](value));
91
+ } catch (e) {
92
+ reject(e);
93
+ }
94
+ }
95
+
96
+ function step(result) {
97
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
98
+ }
99
+
100
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
101
+ });
102
+ };
103
+
104
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
105
+ var _ = {
106
+ label: 0,
107
+ sent: function sent() {
108
+ if (t[0] & 1) throw t[1];
109
+ return t[1];
110
+ },
111
+ trys: [],
112
+ ops: []
113
+ },
114
+ f,
115
+ y,
116
+ t,
117
+ g;
118
+ return g = {
119
+ next: verb(0),
120
+ "throw": verb(1),
121
+ "return": verb(2)
122
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
123
+ return this;
124
+ }), g;
125
+
126
+ function verb(n) {
127
+ return function (v) {
128
+ return step([n, v]);
129
+ };
130
+ }
131
+
132
+ function step(op) {
133
+ if (f) throw new TypeError("Generator is already executing.");
134
+
135
+ while (_) {
136
+ try {
137
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
138
+ if (y = 0, t) op = [op[0] & 2, t.value];
139
+
140
+ switch (op[0]) {
141
+ case 0:
142
+ case 1:
143
+ t = op;
144
+ break;
145
+
146
+ case 4:
147
+ _.label++;
148
+ return {
149
+ value: op[1],
150
+ done: false
151
+ };
152
+
153
+ case 5:
154
+ _.label++;
155
+ y = op[1];
156
+ op = [0];
157
+ continue;
158
+
159
+ case 7:
160
+ op = _.ops.pop();
161
+
162
+ _.trys.pop();
163
+
164
+ continue;
165
+
166
+ default:
167
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
168
+ _ = 0;
169
+ continue;
170
+ }
171
+
172
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
173
+ _.label = op[1];
174
+ break;
175
+ }
176
+
177
+ if (op[0] === 6 && _.label < t[1]) {
178
+ _.label = t[1];
179
+ t = op;
180
+ break;
181
+ }
182
+
183
+ if (t && _.label < t[2]) {
184
+ _.label = t[2];
185
+
186
+ _.ops.push(op);
187
+
188
+ break;
189
+ }
190
+
191
+ if (t[2]) _.ops.pop();
192
+
193
+ _.trys.pop();
194
+
195
+ continue;
196
+ }
197
+
198
+ op = body.call(thisArg, _);
199
+ } catch (e) {
200
+ op = [6, e];
201
+ y = 0;
202
+ } finally {
203
+ f = t = 0;
204
+ }
205
+ }
206
+
207
+ if (op[0] & 5) throw op[1];
208
+ return {
209
+ value: op[0] ? op[1] : void 0,
210
+ done: true
211
+ };
212
+ }
213
+ };
214
+
215
+ var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
216
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
217
+ s += arguments[i].length;
218
+ }
219
+
220
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) {
221
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
222
+ r[k] = a[j];
223
+ }
224
+ }
225
+
226
+ return r;
227
+ };
228
+
229
+ var LAYOUT_IMAGE_SIZE = {
230
+ layout1: {
231
+ w: 180,
232
+ h: 180
233
+ },
234
+ layout2: {
235
+ w: 160,
236
+ h: 160
237
+ },
238
+ layout3: {
239
+ w: 180,
240
+ h: 180
241
+ }
242
+ };
243
+
244
+ var RecommendMobile =
245
+ /** @class */
246
+ function (_super) {
247
+ __extends(RecommendMobile, _super);
248
+
249
+ function RecommendMobile() {
250
+ var _this = _super !== null && _super.apply(this, arguments) || this;
251
+
252
+ _this.preData = {};
253
+ _this.preLayout = '';
254
+ _this._cache = (0, _coreUtil.isDesignMode)() ? {} : (0, _commonUtil.ensure)(function () {
255
+ return (0, _storeUtil.getMagicStore)("recommend_" + _this.props.panelProps.id);
256
+ }, {});
257
+ _this.state = __assign({
258
+ tabIndex: 0,
259
+ tabLeft: 0,
260
+ tabWidth: 0,
261
+ groupSource: [],
262
+ hideTabs: false
263
+ }, _this._cache);
264
+
265
+ _this.initTab = function (index, hideTabs) {
266
+ var selectedTabDom = document.querySelector(".tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
267
+ var tabLeft = 0;
268
+ var tabWidth = 0;
269
+
270
+ if (selectedTabDom && !hideTabs) {
271
+ tabLeft = selectedTabDom.offsetLeft;
272
+ tabWidth = selectedTabDom.offsetWidth;
273
+ }
274
+
275
+ _this.setState({
276
+ tabLeft: tabLeft,
277
+ tabWidth: tabWidth
278
+ });
279
+ };
280
+
281
+ _this.getTabBarActiveColor = function (_panelProps) {
282
+ var tabIndex = _this.state.tabIndex;
283
+ return (0, _commonUtil.ensure)(function () {
284
+ return _panelProps.groupSource[tabIndex].hover.groupName.content.color;
285
+ }, '#1890ff');
286
+ };
287
+
288
+ _this.getProductList = function (index) {
289
+ return __awaiter(_this, void 0, void 0, function () {
290
+ var panelProps, groupSource, recommendId, cache, _a, _b, sourceType, _c, prodIds, _d, intelligentType, _e, intelligentValue, _f, maxProdNum, newData, res, res, e_1, _cache;
291
+
292
+ var _g, _h, _j;
293
+
294
+ var _this = this;
295
+
296
+ return __generator(this, function (_k) {
297
+ switch (_k.label) {
298
+ case 0:
299
+ panelProps = this.props.panelProps;
300
+ groupSource = this.state.groupSource;
301
+ recommendId = panelProps.id;
302
+
303
+ if (!(0, _coreUtil.isDesignMode)()) {
304
+ cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
305
+
306
+ if (cache) {
307
+ if ("products" + index in cache) {
308
+ this.setState((_g = {}, _g["products" + index] = cache["products" + index], _g), function () {
309
+ _this.resetLayout();
310
+ });
311
+ /** 如果数据未过期 */
312
+
313
+ if (cache.endTime > Date.now()) return [2
314
+ /*return*/
315
+ ];
316
+ }
317
+ }
318
+ }
319
+
320
+ _a = groupSource[index] || {}, _b = _a.sourceType, sourceType = _b === void 0 ? '' : _b, _c = _a.prodIds, prodIds = _c === void 0 ? '' : _c, _d = _a.intelligentType, intelligentType = _d === void 0 ? '' : _d, _e = _a.intelligentValue, intelligentValue = _e === void 0 ? [] : _e, _f = _a.maxProdNum, maxProdNum = _f === void 0 ? 10 : _f;
321
+ newData = [];
322
+ _k.label = 1;
323
+
324
+ case 1:
325
+ _k.trys.push([1, 7,, 8]);
326
+
327
+ if (!(sourceType === 'select')) return [3
328
+ /*break*/
329
+ , 3];
330
+
331
+ if (!prodIds) {
332
+ return [2
333
+ /*return*/
334
+ ];
335
+ }
336
+
337
+ return [4
338
+ /*yield*/
339
+ , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/products", {
340
+ products: prodIds,
341
+ state: 'A'
342
+ }, 'GET')];
343
+
344
+ case 2:
345
+ res = _k.sent();
346
+ newData = __spreadArrays(res.list);
347
+ return [3
348
+ /*break*/
349
+ , 6];
350
+
351
+ case 3:
352
+ if (!(sourceType === 'recommend')) return [3
353
+ /*break*/
354
+ , 5];
355
+ return [4
356
+ /*yield*/
357
+ , (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/offers", {
358
+ pageIndex: 1,
359
+ pageSize: maxProdNum,
360
+ sortType: '1',
361
+ intelligentType: intelligentType,
362
+ intelligentValue: intelligentValue.join(','),
363
+ aggregation: false
364
+ }, 'POST')];
365
+
366
+ case 4:
367
+ res = _k.sent();
368
+ newData = __spreadArrays(res.pageInfo.list);
369
+ return [3
370
+ /*break*/
371
+ , 6];
372
+
373
+ case 5:
374
+ newData = [];
375
+ _k.label = 6;
376
+
377
+ case 6:
378
+ return [3
379
+ /*break*/
380
+ , 8];
381
+
382
+ case 7:
383
+ e_1 = _k.sent();
384
+ newData = [];
385
+ return [3
386
+ /*break*/
387
+ , 8];
388
+
389
+ case 8:
390
+ if (!(0, _coreUtil.isDesignMode)()) {
391
+ _cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
392
+ (0, _storeUtil.setMagicStore)("recommend_" + recommendId, __assign(__assign({}, _cache), (_h = {}, _h["products" + index] = newData, _h.endTime = Date.now() + 3 * 60 * 1000, _h)));
393
+ }
394
+
395
+ this.setState((_j = {}, _j["products" + index] = newData, _j), function () {
396
+ _this.resetLayout();
397
+ });
398
+ return [2
399
+ /*return*/
400
+ ];
401
+ }
402
+ });
403
+ });
404
+ };
405
+
406
+ _this.resetLayout = function () {
407
+ var customize = _this.props.panelProps.customize;
408
+ if (customize.layout.pcLayout !== 'layout1') return;
409
+ setTimeout(function () {
410
+ if (document.querySelector('.macyContainer')) {
411
+ _this.getMacy('.macyContainer', customize.pcRowNum);
412
+ }
413
+ });
414
+ };
415
+
416
+ _this.getMacy = function (container, columns) {
417
+ var masonryNew = new _macy["default"]({
418
+ container: container,
419
+ trueOrder: false,
420
+ waitForImages: false,
421
+ useOwnImageLoader: false,
422
+ margin: {
423
+ x: 12,
424
+ y: 12
425
+ },
426
+ columns: columns
427
+ });
428
+ masonryNew.runOnImageLoad(function () {
429
+ masonryNew.recalculate(true);
430
+ }, true);
431
+ };
432
+
433
+ _this.getBackgroundStyle = function () {
434
+ var panelProps = _this.props.panelProps;
435
+ var bgStyle = {};
436
+
437
+ if (panelProps.background.bgType === 'color') {
438
+ bgStyle = {
439
+ backgroundColor: (0, _commonUtil.getColorRgba)(panelProps.background.color || '#fff', panelProps.background.opacity / 100 || 1)
440
+ };
441
+ } else {
442
+ bgStyle = {
443
+ background: "url(" + panelProps.background.image + ") no-repeat center",
444
+ backgroundSize: '100%'
445
+ };
446
+ }
447
+
448
+ return bgStyle;
449
+ };
450
+
451
+ _this.onTabClick = function (e, index) {
452
+ var tabIndex = _this.state.tabIndex;
453
+ if (tabIndex === index) return;
454
+ e.currentTarget.scrollIntoView(false);
455
+
456
+ _this.setState({
457
+ tabIndex: index
458
+ }, function () {
459
+ _this.resetLayout();
460
+
461
+ _this.initTab(index);
462
+ });
463
+
464
+ _this.getProductList(index);
465
+ };
466
+
467
+ return _this;
468
+ }
469
+
470
+ RecommendMobile.prototype.componentDidMount = function () {
471
+ var _this = this;
472
+
473
+ var panelProps = this.props.panelProps;
474
+ var source = [];
475
+ panelProps.groupSource.map(function (m) {
476
+ var show = m.image.open || m.groupName.open;
477
+ if (show) source.push(m);
478
+ });
479
+ this.setState({
480
+ groupSource: source
481
+ }, function () {
482
+ _this.initTab(0);
483
+
484
+ _this.getProductList(0);
485
+ });
486
+ };
487
+
488
+ RecommendMobile.prototype.componentWillReceiveProps = function () {
489
+ var _this = this;
490
+
491
+ var tabIndex = this.state.tabIndex;
492
+ var panelProps = this.props.panelProps;
493
+ var source = [];
494
+ var hideTabs = false;
495
+ panelProps.groupSource.map(function (m) {
496
+ var show = m.image.open || m.groupName.open;
497
+ if (show) source.push(m);
498
+ });
499
+
500
+ if (source.length === 0 && panelProps.groupSource.length > 0) {
501
+ source.push(panelProps.groupSource[0]);
502
+ hideTabs = true;
503
+ }
504
+
505
+ this.setState({
506
+ groupSource: source
507
+ }, function () {
508
+ var groupSource = _this.state.groupSource;
509
+
510
+ if (JSON.stringify(groupSource) === _this.preData) {
511
+ return;
512
+ }
513
+
514
+ _this.preData = JSON.stringify(groupSource);
515
+ var newTabIndex = tabIndex;
516
+ if (tabIndex >= source.length) newTabIndex = 0;
517
+
518
+ _this.initTab(newTabIndex, hideTabs);
519
+
520
+ _this.getProductList(newTabIndex);
521
+
522
+ _this.setState({
523
+ tabIndex: newTabIndex,
524
+ hideTabs: hideTabs
525
+ });
526
+ });
527
+ var curLayout = panelProps.customize.layout.pcLayout;
528
+
529
+ if (curLayout !== this.preLayout) {
530
+ this.resetLayout();
531
+ }
532
+
533
+ this.preLayout = curLayout;
534
+ };
535
+
536
+ RecommendMobile.prototype.render = function () {
537
+ var _this = this;
538
+
539
+ var panelProps = this.props.panelProps;
540
+ var _a = this.state,
541
+ tabIndex = _a.tabIndex,
542
+ tabLeft = _a.tabLeft,
543
+ tabWidth = _a.tabWidth,
544
+ groupSource = _a.groupSource,
545
+ hideTabs = _a.hideTabs;
546
+ var bgStyle = this.getBackgroundStyle();
547
+ var products = this.state["products" + tabIndex] || [];
548
+ var isDivide = groupSource.length <= 3;
549
+ var layout = panelProps.customize.layout.pcLayout;
550
+
551
+ var _seeAll = (0, _commonUtil.ensure)(function () {
552
+ return groupSource[tabIndex].seeAll;
553
+ }, '');
554
+
555
+ var imgHeight = (0, _commonUtil.ensure)(function () {
556
+ return LAYOUT_IMAGE_SIZE[layout].h;
557
+ }, 140);
558
+ var imgWidth = (0, _commonUtil.ensure)(function () {
559
+ return LAYOUT_IMAGE_SIZE[layout].w;
560
+ }, 140);
561
+ return /*#__PURE__*/_react["default"].createElement("div", {
562
+ className: "m-recommend-pc",
563
+ style: bgStyle
564
+ }, !hideTabs && /*#__PURE__*/_react["default"].createElement("div", {
565
+ className: "tab-select-wrap"
566
+ }, groupSource.map(function (tab, index) {
567
+ var _image = index == tabIndex && tab.hover.open && tab.hover.image.open ? tab.hover.image : tab.image;
568
+
569
+ var _groupName = index == tabIndex && tab.hover.open && tab.hover.groupName.open ? tab.hover.groupName : tab.groupName;
570
+
571
+ return /*#__PURE__*/_react["default"].createElement("div", {
572
+ key: tab.id,
573
+ className: "tabTitle",
574
+ onClick: function onClick(e) {
575
+ _this.onTabClick(e, index);
576
+
577
+ _mobx.store.setState({
578
+ clickedGroup: tab.id,
579
+ clickedFloor: _mobx.store.getFloorIdByGroupId(tab.id)
580
+ });
581
+ },
582
+ style: {
583
+ flex: ~~isDivide
584
+ }
585
+ }, tab.image.open && _image && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
586
+ data: _image
587
+ }), tab.groupName.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
588
+ data: _groupName,
589
+ onTextInput: function onTextInput(text) {
590
+ tab.hover.groupName.text = text;
591
+ tab.groupName.text = text;
592
+ }
593
+ }));
594
+ }), /*#__PURE__*/_react["default"].createElement("div", {
595
+ className: "active-line",
596
+ style: {
597
+ width: tabWidth,
598
+ transform: "translateX(" + tabLeft + "px)",
599
+ background: this.getTabBarActiveColor(panelProps)
600
+ }
601
+ })), layout === 'layout1' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
602
+ key: "macyContainer",
603
+ className: "macyContainer"
604
+ }, products.map(function (item) {
605
+ return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
606
+ key: item.productId,
607
+ data: item,
608
+ fixHeight: true,
609
+ imgHeight: imgHeight,
610
+ imgWidth: imgWidth,
611
+ onItemClick: function onItemClick() {
612
+ return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId + "?productId=" + (item.sppProductId || item.productId || ''));
613
+ },
614
+ panelProps: panelProps.content,
615
+ showProgress: false
616
+ });
617
+ })), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
618
+ className: "btnSeeAll",
619
+ data: _seeAll
620
+ })) : /*#__PURE__*/_react["default"].createElement("div", {
621
+ key: "scrollContainer",
622
+ className: (0, _classnames["default"])('scrollContainer', {
623
+ pl_100: layout === 'layout3'
624
+ })
625
+ }, products.map(function (item) {
626
+ return /*#__PURE__*/_react["default"].createElement("div", {
627
+ className: "productCard"
628
+ }, /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
629
+ key: "scroll_" + item.productId,
630
+ data: item,
631
+ fixHeight: true,
632
+ imgHeight: imgHeight,
633
+ imgWidth: imgWidth,
634
+ onItemClick: function onItemClick() {
635
+ return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId + "?productId=" + (item.sppProductId || item.productId || ''));
636
+ },
637
+ panelProps: panelProps.content,
638
+ showProgress: false
639
+ }));
640
+ }), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
641
+ className: "btnSeeAll",
642
+ data: _seeAll
643
+ })));
644
+ };
645
+
646
+ RecommendMobile.defaultProps = {
647
+ panelProps: {}
648
+ };
649
+ return RecommendMobile;
650
+ }(_react["default"].Component);
651
+
652
+ var _default = RecommendMobile;
653
+ exports["default"] = _default;