@fonixtree/magic-design 1.0.219 → 1.0.221

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 (49) hide show
  1. package/es/common/LinkModal/index.js +3 -23
  2. package/es/common/PictureModal/index.js +1 -1
  3. package/es/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +13 -8
  4. package/es/composite-comp/bol/components/Banner/pc/index.less +6 -6
  5. package/es/composite-comp/common/components/ProductItem/index.js +22 -27
  6. package/es/composite-comp/dito/components/GroupedImage/defaultJSON.js +7 -8
  7. package/es/composite-comp/dito/components/GroupedImage/pc/index.js +243 -26
  8. package/es/composite-comp/dito/components/GroupedImage/pc/index.less +79 -10
  9. package/es/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.less +3 -1
  10. package/es/composite-comp/dito/components/Recommend/pc/index.js +28 -25
  11. package/es/composite-comp/dito/components/Recommend/pc/index.less +10 -2
  12. package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +127 -29
  13. package/es/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
  14. package/es/composite-comp/dito/second-config-panels/MenuNavigationSecondConfig/index.js +1 -1
  15. package/es/constants/index.js +1 -1
  16. package/es/core/Designer/ConfigPanel/index.js +217 -4
  17. package/es/core/Designer/ConfigPanel/index.less +39 -0
  18. package/es/core/Renderer/index.js +0 -1
  19. package/es/meta-comp/components/Image/index.js +15 -11
  20. package/es/meta-comp/config-panels/ButtonConfig/index.js +4 -0
  21. package/es/meta-comp/config-panels/ImageConfig/index.js +25 -8
  22. package/es/meta-comp/config-panels/TextConfig/index.js +1 -1
  23. package/es/mobx/Store.js +4 -1
  24. package/es/utils/coreUtil.js +3 -3
  25. package/lib/common/LinkModal/index.js +3 -23
  26. package/lib/common/PictureModal/index.js +1 -1
  27. package/lib/composite-comp/bol/components/Banner/pc/components/SwiperBannerPc.js +13 -8
  28. package/lib/composite-comp/bol/components/Banner/pc/index.less +6 -6
  29. package/lib/composite-comp/common/components/ProductItem/index.js +22 -27
  30. package/lib/composite-comp/dito/components/GroupedImage/defaultJSON.js +7 -8
  31. package/lib/composite-comp/dito/components/GroupedImage/pc/index.js +243 -26
  32. package/lib/composite-comp/dito/components/GroupedImage/pc/index.less +79 -10
  33. package/lib/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.less +3 -1
  34. package/lib/composite-comp/dito/components/Recommend/pc/index.js +28 -25
  35. package/lib/composite-comp/dito/components/Recommend/pc/index.less +10 -2
  36. package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.js +127 -29
  37. package/lib/composite-comp/dito/second-config-panels/GroupedImageSecondConfig/index.less +21 -0
  38. package/lib/composite-comp/dito/second-config-panels/MenuNavigationSecondConfig/index.js +1 -1
  39. package/lib/constants/index.js +1 -1
  40. package/lib/core/Designer/ConfigPanel/index.js +217 -4
  41. package/lib/core/Designer/ConfigPanel/index.less +39 -0
  42. package/lib/core/Renderer/index.js +0 -1
  43. package/lib/meta-comp/components/Image/index.js +15 -11
  44. package/lib/meta-comp/config-panels/ButtonConfig/index.js +4 -0
  45. package/lib/meta-comp/config-panels/ImageConfig/index.js +25 -8
  46. package/lib/meta-comp/config-panels/TextConfig/index.js +1 -1
  47. package/lib/mobx/Store.js +4 -1
  48. package/lib/utils/coreUtil.js +3 -3
  49. package/package.json +1 -1
@@ -107,22 +107,22 @@ function (_super) {
107
107
  };
108
108
 
109
109
  ProductItem.prototype.render = function () {
110
- var _a, _b, _c, _d, _e, _f, _g;
111
-
112
- var _h = this.props,
113
- data = _h.data,
114
- type = _h.type,
115
- panelProps = _h.panelProps,
116
- onItemClick = _h.onItemClick,
117
- showProName = _h.showProName,
118
- showProgress = _h.showProgress,
119
- fixHeight = _h.fixHeight,
120
- layout = _h.layout,
121
- imgHeight = _h.imgHeight,
122
- imgWidth = _h.imgWidth,
123
- unknownPrice = _h.unknownPrice,
124
- hideLabels = _h.hideLabels,
125
- rest = __rest(_h, ["data", "type", "panelProps", "onItemClick", "showProName", "showProgress", "fixHeight", "layout", "imgHeight", "imgWidth", "unknownPrice", "hideLabels"]);
110
+ var _a, _b, _c, _d, _e, _f;
111
+
112
+ var _g = this.props,
113
+ data = _g.data,
114
+ type = _g.type,
115
+ panelProps = _g.panelProps,
116
+ onItemClick = _g.onItemClick,
117
+ showProName = _g.showProName,
118
+ showProgress = _g.showProgress,
119
+ fixHeight = _g.fixHeight,
120
+ layout = _g.layout,
121
+ imgHeight = _g.imgHeight,
122
+ imgWidth = _g.imgWidth,
123
+ unknownPrice = _g.unknownPrice,
124
+ hideLabels = _g.hideLabels,
125
+ rest = __rest(_g, ["data", "type", "panelProps", "onItemClick", "showProName", "showProgress", "fixHeight", "layout", "imgHeight", "imgWidth", "unknownPrice", "hideLabels"]);
126
126
 
127
127
  var promotions = (0, _businessUtil.getPromotionList)(data);
128
128
  var price = (0, _currencyUtil.formatCurrency)(data.salesPrice);
@@ -198,10 +198,8 @@ function (_super) {
198
198
  })) || [];
199
199
  var prodLabels = ((_b = data.labels) === null || _b === void 0 ? void 0 : _b.filter(function (f) {
200
200
  return f.position === '6';
201
- })) || [];
202
- var priceLabels = ((_c = data.labels) === null || _c === void 0 ? void 0 : _c.filter(function (f) {
203
- return f.position === '7';
204
- })) || []; // ad 卡片
201
+ })) || []; // const priceLabels = data.labels?.filter(f => f.position === '7') || [];
202
+ // ad 卡片
205
203
 
206
204
  if (data.type === 'ad') {
207
205
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -289,14 +287,11 @@ function (_super) {
289
287
  text: _price
290
288
  }),
291
289
  readonly: true
292
- }), priceLabels.length > 0 && !hideLabels && /*#__PURE__*/_react["default"].createElement(_ImageLabel["default"], {
293
- labels: priceLabels,
294
- small: true
295
290
  })), panelProps.salesPrice.open && (!!discount || oldPrice) && /*#__PURE__*/_react["default"].createElement("div", {
296
291
  className: "price-sold-wrap"
297
292
  }, /*#__PURE__*/_react["default"].createElement("div", {
298
293
  className: "old-price-wrap"
299
- }, !!discount && ((_d = panelProps.discountLabel) === null || _d === void 0 ? void 0 : _d.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
294
+ }, !!discount && ((_c = panelProps.discountLabel) === null || _c === void 0 ? void 0 : _c.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
300
295
  className: "discount",
301
296
  data: __assign(__assign({}, panelProps.discountLabel), {
302
297
  text: "-" + discount + "%"
@@ -311,9 +306,9 @@ function (_super) {
311
306
  style: {
312
307
  color: panelProps.salesPrice.content.color
313
308
  }
314
- })), type !== 'groupBuy' && !showProgress && data.salesCnt > 0 && data.displaySalesCntFlag === 'Y' && ((_e = panelProps.sold) === null || _e === void 0 ? void 0 : _e.open) && /*#__PURE__*/_react["default"].createElement("div", {
309
+ })), type !== 'groupBuy' && !showProgress && data.salesCnt > 0 && data.displaySalesCntFlag === 'Y' && ((_d = panelProps.sold) === null || _d === void 0 ? void 0 : _d.open) && /*#__PURE__*/_react["default"].createElement("div", {
315
310
  className: "sold-count"
316
- }, (0, _commonUtil.convertCount)(data.salesCnt), " sold"))), showProgress && ((_f = panelProps.salesProgressVisible) === null || _f === void 0 ? void 0 : _f.open) && /*#__PURE__*/_react["default"].createElement("div", {
311
+ }, (0, _commonUtil.convertCount)(data.salesCnt), " sold"))), showProgress && ((_e = panelProps.salesProgressVisible) === null || _e === void 0 ? void 0 : _e.open) && /*#__PURE__*/_react["default"].createElement("div", {
317
312
  className: "progress-wrap"
318
313
  }, /*#__PURE__*/_react["default"].createElement("span", {
319
314
  className: "text"
@@ -323,7 +318,7 @@ function (_super) {
323
318
  className: "progress",
324
319
  style: {
325
320
  width: salePercent + "%",
326
- backgroundColor: (_g = panelProps.salesProgressVisible) === null || _g === void 0 ? void 0 : _g.color
321
+ backgroundColor: (_f = panelProps.salesProgressVisible) === null || _f === void 0 ? void 0 : _f.color
327
322
  }
328
323
  })))));
329
324
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.groupedImageGroupSourceJSON = exports.getDefaultJSON = void 0;
6
+ exports.groupedImageGroupSourceJSON = exports.getDefaultJSON = exports.createImageMeta = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
@@ -82,6 +82,8 @@ var createImageMeta = function createImageMeta(parentId) {
82
82
  };
83
83
  };
84
84
 
85
+ exports.createImageMeta = createImageMeta;
86
+
85
87
  var groupedImageGroupSourceJSON = function groupedImageGroupSourceJSON(parentId, text) {
86
88
  var groupId = (0, _uuid.v4)();
87
89
  var baseImage = createImageMeta(groupId);
@@ -91,11 +93,8 @@ var groupedImageGroupSourceJSON = function groupedImageGroupSourceJSON(parentId,
91
93
  parentId: parentId,
92
94
  image: baseImage,
93
95
  groupName: baseGroupName,
94
- title: createTextMeta(groupId, 'Group Title', '#CE1126', 16, 700),
95
- image1: createImageMeta(groupId),
96
- image2: createImageMeta(groupId),
97
- image3: createImageMeta(groupId),
98
- image4: createImageMeta(groupId),
96
+ title: createTextMeta(groupId, 'Group Title', '#CE1126', '16px', 700),
97
+ images: [createImageMeta(groupId), createImageMeta(groupId), createImageMeta(groupId), createImageMeta(groupId)],
99
98
  hover: {
100
99
  open: true,
101
100
  image: __assign(__assign({}, createImageMeta(groupId)), {
@@ -122,14 +121,14 @@ var getDefaultJSON = function getDefaultJSON() {
122
121
  paddingBottom: 0,
123
122
  paddingLeft: 0,
124
123
  paddingRight: 0,
125
- marginBottom: window.magicDesign.compSpacing * 1.5
124
+ marginBottom: window.magicDesign.compSpacing ? window.magicDesign.compSpacing * 1.5 : 48
126
125
  },
127
126
  mobile: {
128
127
  paddingTop: 0,
129
128
  paddingBottom: 0,
130
129
  paddingLeft: 0,
131
130
  paddingRight: 0,
132
- marginBottom: window.magicDesign.compSpacing
131
+ marginBottom: window.magicDesign.compSpacing || 32
133
132
  }
134
133
  },
135
134
  customize: {
@@ -17,6 +17,12 @@ var _commonUtil = require("../../../../../utils/commonUtil");
17
17
 
18
18
  var _mobx = require("../../../../../mobx");
19
19
 
20
+ var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
21
+
22
+ var _lodash = _interopRequireDefault(require("lodash.throttle"));
23
+
24
+ var _coreUtil = require("../../../../../utils/coreUtil");
25
+
20
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
27
 
22
28
  var __extends = void 0 && (void 0).__extends || function () {
@@ -53,11 +59,84 @@ function (_super) {
53
59
  function GroupedImagePc() {
54
60
  var _this = _super !== null && _super.apply(this, arguments) || this;
55
61
 
62
+ _this.scrollRef = /*#__PURE__*/_react["default"].createRef();
63
+ _this.preGroupSource = '';
56
64
  _this.state = {
57
65
  tabIndex: 0,
58
66
  tabLeft: 0,
59
67
  tabWidth: 0,
60
- groupSource: []
68
+ groupSource: [],
69
+ scrollToLeftDisabled: true,
70
+ scrollToRightDisabled: true
71
+ }; // 数据迁移:将旧的image1-4迁移到images数组
72
+
73
+ _this.migrateData = function (groupSource) {
74
+ groupSource.forEach(function (group) {
75
+ // 如果存在旧的image1-4字段且没有images数组,进行迁移
76
+ if (!group.images && (group.image1 || group.image2 || group.image3 || group.image4)) {
77
+ group.images = [];
78
+ [group.image1, group.image2, group.image3, group.image4].forEach(function (img) {
79
+ if (img) {
80
+ group.images.push(img);
81
+ }
82
+ }); // 删除旧字段
83
+
84
+ delete group.image1;
85
+ delete group.image2;
86
+ delete group.image3;
87
+ delete group.image4;
88
+ } // 确保images数组存在
89
+
90
+
91
+ if (!group.images) {
92
+ group.images = [];
93
+ }
94
+ });
95
+ };
96
+
97
+ _this.initScroll = function (resetPosition) {
98
+ if (resetPosition === void 0) {
99
+ resetPosition = false;
100
+ }
101
+
102
+ setTimeout(function () {
103
+ var scrollDom = _this.scrollRef.current;
104
+
105
+ if (scrollDom) {
106
+ // 如果需要重置位置,将滚动条重置到最左边
107
+ if (resetPosition) {
108
+ // 先禁用滚动监听,避免触发状态更新
109
+ scrollDom.onscroll = null; // 使用requestAnimationFrame延迟一帧,让tab切换的视觉效果先完成
110
+
111
+ requestAnimationFrame(function () {
112
+ if (scrollDom) {
113
+ // 使用scrollTo并设置behavior为'auto',覆盖CSS的scroll-behavior: smooth
114
+ // 这样重置时不会有明显的滚动动画效果
115
+ scrollDom.scrollTo({
116
+ left: 0,
117
+ behavior: 'auto'
118
+ });
119
+ }
120
+ });
121
+ }
122
+
123
+ _this.setScrollDisabled(scrollDom);
124
+
125
+ scrollDom.onscroll = (0, _lodash["default"])(function () {
126
+ _this.setScrollDisabled(scrollDom);
127
+ }, 100);
128
+ }
129
+ }, 0);
130
+ };
131
+
132
+ _this.setScrollDisabled = function (scrollDom) {
133
+ var scrollToLeftDisabled = scrollDom.scrollLeft === 0;
134
+ var scrollToRightDisabled = scrollDom.clientWidth + scrollDom.scrollLeft >= scrollDom.scrollWidth - 1;
135
+
136
+ _this.setState({
137
+ scrollToLeftDisabled: scrollToLeftDisabled,
138
+ scrollToRightDisabled: scrollToRightDisabled
139
+ });
61
140
  };
62
141
 
63
142
  _this.initTab = function (index) {
@@ -81,19 +160,81 @@ function (_super) {
81
160
  tabIndex = _a.tabIndex,
82
161
  groupSource = _a.groupSource;
83
162
  if (tabIndex === index) return;
84
- var tab = groupSource[index];
163
+ var tab = groupSource[index]; // 在切换tab之前,立即重置滚动位置到最左边,避免滚动效果
164
+
165
+ var scrollDom = _this.scrollRef.current;
166
+
167
+ if (scrollDom) {
168
+ scrollDom.onscroll = null; // 先禁用滚动监听
169
+
170
+ scrollDom.scrollLeft = 0; // 立即重置,不使用任何动画
171
+ } // 先更新本地状态,确保tabIndex立即更新
172
+
85
173
 
86
174
  _this.setState({
87
175
  tabIndex: index
88
176
  }, function () {
89
- _this.initTab(index);
90
- });
177
+ _this.initTab(index); // 重新初始化滚动(不重置位置,因为已经重置过了)
178
+
179
+
180
+ _this.initScroll(false);
181
+ }); // 然后更新store状态,触发props更新
182
+ // 使用setTimeout确保本地状态先更新完成
183
+
184
+
185
+ setTimeout(function () {
186
+ if (tab) {
187
+ _mobx.store.setState({
188
+ clickedGroup: tab.id,
189
+ clickedFloor: _mobx.store.getFloorIdByGroupId(tab.id)
190
+ });
191
+ }
192
+ }, 0);
193
+ };
194
+
195
+ _this.scrollToRight = function () {
196
+ var scrollDom = _this.scrollRef.current;
197
+
198
+ if (scrollDom) {
199
+ var _a = _this.state,
200
+ tabIndex = _a.tabIndex,
201
+ groupSource = _a.groupSource;
202
+ var current = groupSource[tabIndex] || {};
203
+ var images = current.images || []; // 如果当前tab的图片可以滚动,则滚动图片
204
+
205
+ if (scrollDom.clientWidth + scrollDom.scrollLeft < scrollDom.scrollWidth - 1) {
206
+ scrollDom.scrollTo({
207
+ left: scrollDom.scrollLeft + scrollDom.clientWidth,
208
+ behavior: 'smooth'
209
+ });
210
+ } else {
211
+ // 否则切换到下一个tab
212
+ var nextTabIndex = (tabIndex + 1) % groupSource.length;
213
+
214
+ _this.onTabClick(null, nextTabIndex);
215
+ }
216
+ }
217
+ };
218
+
219
+ _this.scrollToLeft = function () {
220
+ var scrollDom = _this.scrollRef.current;
91
221
 
92
- if (tab) {
93
- _mobx.store.setState({
94
- clickedGroup: tab.id,
95
- clickedFloor: _mobx.store.getFloorIdByGroupId(tab.id)
96
- });
222
+ if (scrollDom) {
223
+ var _a = _this.state,
224
+ tabIndex = _a.tabIndex,
225
+ groupSource = _a.groupSource; // 如果当前tab的图片可以向左滚动,则滚动图片
226
+
227
+ if (scrollDom.scrollLeft > 0) {
228
+ scrollDom.scrollTo({
229
+ left: scrollDom.scrollLeft - scrollDom.clientWidth,
230
+ behavior: 'smooth'
231
+ });
232
+ } else {
233
+ // 否则切换到上一个tab
234
+ var prevTabIndex = (tabIndex - 1 + groupSource.length) % groupSource.length;
235
+
236
+ _this.onTabClick(null, prevTabIndex);
237
+ }
97
238
  }
98
239
  };
99
240
 
@@ -103,16 +244,22 @@ function (_super) {
103
244
  GroupedImagePc.prototype.componentDidMount = function () {
104
245
  var _this = this;
105
246
 
106
- var panelProps = this.props.panelProps;
247
+ var panelProps = this.props.panelProps; // 数据迁移
248
+
249
+ this.migrateData(panelProps.groupSource);
107
250
  var source = [];
108
251
  panelProps.groupSource.forEach(function (m) {
109
252
  var show = m.image.open || m.groupName.open;
110
253
  if (show) source.push(m);
111
254
  });
255
+ var groupSource = source.length > 0 ? source : panelProps.groupSource;
256
+ this.preGroupSource = JSON.stringify(groupSource);
112
257
  this.setState({
113
- groupSource: source.length > 0 ? source : panelProps.groupSource
258
+ groupSource: groupSource
114
259
  }, function () {
115
260
  _this.initTab(0);
261
+
262
+ _this.initScroll();
116
263
  });
117
264
  };
118
265
 
@@ -120,25 +267,39 @@ function (_super) {
120
267
  var _this = this;
121
268
 
122
269
  var tabIndex = this.state.tabIndex;
123
- var panelProps = nextProps.panelProps;
270
+ var panelProps = nextProps.panelProps; // 数据迁移
271
+
272
+ this.migrateData(panelProps.groupSource);
124
273
  var source = [];
125
274
  panelProps.groupSource.forEach(function (m) {
126
275
  var show = m.image.open || m.groupName.open;
127
276
  if (show) source.push(m);
128
277
  });
129
278
  var groupSource = source.length > 0 ? source : panelProps.groupSource;
130
- this.setState({
131
- groupSource: groupSource
132
- }, function () {
133
- var newTabIndex = tabIndex;
134
- if (tabIndex >= groupSource.length) newTabIndex = 0;
279
+ var groupSourceStr = JSON.stringify(groupSource); // 只有当groupSource真正变化时才更新状态
280
+
281
+ if (groupSourceStr !== this.preGroupSource) {
282
+ this.preGroupSource = groupSourceStr;
283
+ this.setState({
284
+ groupSource: groupSource
285
+ }, function () {
286
+ // 使用当前的tabIndex,确保获取最新状态
287
+ var currentTabIndex = _this.state.tabIndex;
288
+ var newTabIndex = currentTabIndex;
289
+ if (currentTabIndex >= groupSource.length) newTabIndex = 0;
135
290
 
136
- _this.initTab(newTabIndex);
291
+ _this.initTab(newTabIndex);
137
292
 
138
- _this.setState({
139
- tabIndex: newTabIndex
293
+ _this.initScroll(); // 只有当tabIndex需要调整时才更新
294
+
295
+
296
+ if (newTabIndex !== currentTabIndex) {
297
+ _this.setState({
298
+ tabIndex: newTabIndex
299
+ });
300
+ }
140
301
  });
141
- });
302
+ }
142
303
  };
143
304
 
144
305
  GroupedImagePc.prototype.render = function () {
@@ -148,15 +309,20 @@ function (_super) {
148
309
  tabIndex = _a.tabIndex,
149
310
  tabLeft = _a.tabLeft,
150
311
  tabWidth = _a.tabWidth,
151
- groupSource = _a.groupSource;
312
+ groupSource = _a.groupSource,
313
+ scrollToLeftDisabled = _a.scrollToLeftDisabled,
314
+ scrollToRightDisabled = _a.scrollToRightDisabled;
152
315
  var current = groupSource[tabIndex] || {};
316
+ var images = current.images || [];
153
317
 
154
318
  var _image = current.hover && current.hover.open && current.hover.image.open ? current.hover.image : current.image;
155
319
 
156
320
  var _groupName = current.hover && current.hover.open && current.hover.groupName.open ? current.hover.groupName : current.groupName;
157
321
 
158
322
  return /*#__PURE__*/_react["default"].createElement("div", {
159
- className: "m-grouped-image-pc"
323
+ className: (0, _classnames["default"])('m-grouped-image-pc', {
324
+ 'less-than-4': images.length <= 4
325
+ })
160
326
  }, /*#__PURE__*/_react["default"].createElement("div", {
161
327
  className: "tab-select-wrap"
162
328
  }, groupSource.map(function (tab, index) {
@@ -176,17 +342,68 @@ function (_super) {
176
342
  className: "title",
177
343
  data: current.title
178
344
  }), /*#__PURE__*/_react["default"].createElement("div", {
179
- className: "image-list"
180
- }, [current.image1, current.image2, current.image3, current.image4].map(function (img, idx) {
345
+ className: "image-list-wrapper"
346
+ }, images.length > 0 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
347
+ className: "image-list",
348
+ ref: this.scrollRef
349
+ }, images.map(function (img, idx) {
181
350
  if (!img || !img.open) return null;
182
351
  return /*#__PURE__*/_react["default"].createElement("div", {
183
352
  key: (0, _commonUtil.ensure)(function () {
184
353
  return img.id;
185
354
  }, idx),
186
- className: "image-item"
355
+ className: "image-item",
356
+ onClick: function onClick(e) {
357
+ // 只在设计模式下才触发联动
358
+ if (!(0, _coreUtil.isDesignMode)()) {
359
+ return;
360
+ } // 点击图片时,联动到第三级属性面板
361
+
362
+
363
+ e.stopPropagation();
364
+ e.preventDefault(); // 获取当前tab的group id和楼层id
365
+
366
+ var panelProps = _this.props.panelProps;
367
+ var currentGroupId = current.id; // panelProps.id 就是楼层ID
368
+
369
+ var floorId = panelProps.id; // 一次性设置所有需要的状态,确保联动正常
370
+
371
+ _mobx.store.setState({
372
+ clickedGroup: currentGroupId,
373
+ clickedFloor: floorId,
374
+ clickedImage: img.id
375
+ });
376
+ },
377
+ style: {
378
+ cursor: (0, _coreUtil.isDesignMode)() ? 'pointer' : 'default'
379
+ }
187
380
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
188
381
  data: img
189
382
  }));
383
+ }))), images.length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
384
+ className: "image-list"
385
+ }, /*#__PURE__*/_react["default"].createElement("div", {
386
+ className: "empty-placeholder"
387
+ }, "No images")))), /*#__PURE__*/_react["default"].createElement("div", {
388
+ className: "arrow-icon-wrapper"
389
+ }, /*#__PURE__*/_react["default"].createElement("div", {
390
+ className: (0, _classnames["default"])('arrow-icon', 'left', {
391
+ disabled: scrollToLeftDisabled && tabIndex === 0 && groupSource.length <= 1
392
+ }),
393
+ onClick: this.scrollToLeft
394
+ }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
395
+ color: "#fff",
396
+ size: 16,
397
+ type: "icon-outlined-left"
398
+ })), /*#__PURE__*/_react["default"].createElement("div", {
399
+ className: (0, _classnames["default"])('arrow-icon', 'right', {
400
+ disabled: scrollToRightDisabled && tabIndex === groupSource.length - 1 && groupSource.length <= 1
401
+ }),
402
+ onClick: this.scrollToRight
403
+ }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
404
+ color: "#fff",
405
+ size: 16,
406
+ type: "icon-outlined-right"
190
407
  }))));
191
408
  };
192
409
 
@@ -3,12 +3,22 @@
3
3
  flex-direction: column;
4
4
  position: relative;
5
5
 
6
+ &.less-than-4 {
7
+ .image-list-wrapper {
8
+ padding-left: 0!important;
9
+ .image-list {
10
+ width: fit-content;
11
+ margin: 0 auto;
12
+ }
13
+ }
14
+ }
15
+
6
16
  .tab-select-wrap {
7
17
  display: flex;
8
18
  align-items: center;
9
- height: 50px;
19
+ gap: 16px;
10
20
  background: #ffffff;
11
- overflow: auto;
21
+ // overflow: auto;
12
22
  position: relative;
13
23
  width: fit-content;
14
24
  margin: 0 auto 15px;
@@ -19,14 +29,13 @@
19
29
  text-align: center;
20
30
  padding: 0; // 无缝衔接:去掉左右间距
21
31
  width: fit-content;
22
- height: 100%;
23
32
  justify-content: center;
24
33
  white-space: nowrap;
25
34
  flex-direction: column;
26
35
  cursor: pointer;
27
36
 
28
37
  img {
29
- height: 50px;
38
+ max-height: 50px;
30
39
  margin-bottom: 2px;
31
40
  }
32
41
  }
@@ -38,15 +47,75 @@
38
47
  margin-bottom: 16px;
39
48
  }
40
49
 
41
- .image-list {
50
+ .image-list-wrapper {
51
+ padding-left: 88px;
52
+ position: relative;
53
+
54
+ .image-list {
55
+ display: flex;
56
+ flex-direction: row;
57
+ gap: 16px;
58
+ overflow-x: auto;
59
+ overflow-y: hidden;
60
+ flex: 1;
61
+ scroll-behavior: smooth;
62
+ -webkit-overflow-scrolling: touch;
63
+
64
+ &::-webkit-scrollbar {
65
+ display: none;
66
+ }
67
+
68
+ scrollbar-width: none;
69
+
70
+ .image-item {
71
+ flex-shrink: 0;
72
+ width: 300px;
73
+
74
+ &:last-child {
75
+ margin-right: 40px;
76
+ }
77
+ }
78
+
79
+ .empty-placeholder {
80
+ width: 100%;
81
+ text-align: center;
82
+ color: #999;
83
+ padding: 40px 0;
84
+ font-size: 14px;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ .arrow-icon-wrapper {
91
+ display: flex;
92
+ justify-content: end;
93
+ padding: 24px 0;
94
+ padding-right: 75px;
95
+
96
+ .arrow-icon {
42
97
  display: flex;
43
- flex-direction: row;
98
+ align-items: center;
44
99
  justify-content: center;
45
- gap: 16px;
100
+ width: 40px;
101
+ height: 40px;
102
+ background: #CE1126;
103
+ border-radius: 100px;
104
+ cursor: pointer;
105
+ flex-shrink: 0;
106
+ z-index: 1;
46
107
 
47
- .image-item {
48
- flex: 1;
49
- max-width: 23%;
108
+ &.left {
109
+ margin-right: 16px;
110
+ }
111
+
112
+ &.right {
113
+ // margin-left: 15px;
114
+ }
115
+
116
+ &.disabled {
117
+ cursor: not-allowed;
118
+ opacity: 0.5;
50
119
  }
51
120
  }
52
121
  }
@@ -4,10 +4,12 @@
4
4
  height: 100%;
5
5
  display: flex;
6
6
  justify-content: center;
7
+ max-height: 65px;
8
+
7
9
  // overflow: hidden;
8
10
  &>img {
9
11
  width: 100%;
10
- height: 100%;
12
+ // height: 100%;
11
13
  // object-fit: contain;
12
14
  transition: all .2s linear;
13
15
  vertical-align: initial;