@fonixtree/magic-design 1.0.221 → 1.0.223
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.
- package/es/composite-comp/bol/components/Banner/pc/index.less +1 -1
- package/es/composite-comp/common/components/ProductItem/index.less +1 -1
- package/es/composite-comp/dito/components/GroupedImage/pc/index.less +1 -9
- package/es/composite-comp/dito/components/Recommend/pc/index.less +7 -2
- package/es/core/Renderer/index.js +55 -14
- package/lib/composite-comp/bol/components/Banner/pc/index.less +1 -1
- package/lib/composite-comp/common/components/ProductItem/index.less +1 -1
- package/lib/composite-comp/dito/components/GroupedImage/pc/index.less +1 -9
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +7 -2
- package/lib/core/Renderer/index.js +55 -14
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
&.less-than-4 {
|
|
7
7
|
.image-list-wrapper {
|
|
8
|
-
padding-left: 0!important;
|
|
9
8
|
.image-list {
|
|
10
9
|
width: fit-content;
|
|
11
10
|
margin: 0 auto;
|
|
@@ -17,7 +16,6 @@
|
|
|
17
16
|
display: flex;
|
|
18
17
|
align-items: center;
|
|
19
18
|
gap: 16px;
|
|
20
|
-
background: #ffffff;
|
|
21
19
|
// overflow: auto;
|
|
22
20
|
position: relative;
|
|
23
21
|
width: fit-content;
|
|
@@ -48,7 +46,6 @@
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
.image-list-wrapper {
|
|
51
|
-
padding-left: 88px;
|
|
52
49
|
position: relative;
|
|
53
50
|
|
|
54
51
|
.image-list {
|
|
@@ -60,20 +57,15 @@
|
|
|
60
57
|
flex: 1;
|
|
61
58
|
scroll-behavior: smooth;
|
|
62
59
|
-webkit-overflow-scrolling: touch;
|
|
60
|
+
scrollbar-width: none;
|
|
63
61
|
|
|
64
62
|
&::-webkit-scrollbar {
|
|
65
63
|
display: none;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
scrollbar-width: none;
|
|
69
|
-
|
|
70
66
|
.image-item {
|
|
71
67
|
flex-shrink: 0;
|
|
72
68
|
width: 300px;
|
|
73
|
-
|
|
74
|
-
&:last-child {
|
|
75
|
-
margin-right: 40px;
|
|
76
|
-
}
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
.empty-placeholder {
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
.recommend-tab-select-wrap {
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
|
-
height: 50px;
|
|
20
|
-
background: rgb(255 255 255);
|
|
19
|
+
// height: 50px;
|
|
21
20
|
// overflow: auto;
|
|
22
21
|
position: relative;
|
|
23
22
|
width: fit-content;
|
|
@@ -97,6 +96,10 @@
|
|
|
97
96
|
margin: 0;
|
|
98
97
|
}
|
|
99
98
|
|
|
99
|
+
.scrollContainer::-webkit-scrollbar {
|
|
100
|
+
display: none; /* Chrome, Safari, Opera */
|
|
101
|
+
}
|
|
102
|
+
|
|
100
103
|
.scrollContainer {
|
|
101
104
|
display: flex;
|
|
102
105
|
flex-direction: row;
|
|
@@ -104,6 +107,8 @@
|
|
|
104
107
|
flex: 1;
|
|
105
108
|
margin: 0;
|
|
106
109
|
overflow-x: auto;
|
|
110
|
+
scrollbar-width: none; /* Firefox */
|
|
111
|
+
-ms-overflow-style: none; /* IE 和 Edge */
|
|
107
112
|
padding-bottom: 15px;
|
|
108
113
|
|
|
109
114
|
&.pl_100 {
|
|
@@ -102,6 +102,17 @@ var Renderer = function Renderer(props) {
|
|
|
102
102
|
toastState = _e[0],
|
|
103
103
|
setToastState = _e[1];
|
|
104
104
|
|
|
105
|
+
var timerRef = (0, _react.useRef)(null);
|
|
106
|
+
var isMountedRef = (0, _react.useRef)(true); // 使用 useMemo 来稳定 pageData 的引用,避免不必要的重新渲染
|
|
107
|
+
|
|
108
|
+
var pageDataKey = (0, _react.useMemo)(function () {
|
|
109
|
+
if (!pageData || !pageData.childNodes) return ''; // 创建一个稳定的标识符,基于 childNodes 的内容
|
|
110
|
+
|
|
111
|
+
return pageData.childNodes.map(function (node) {
|
|
112
|
+
return node.id + "-" + node.type;
|
|
113
|
+
}).join(',');
|
|
114
|
+
}, [pageData]);
|
|
115
|
+
|
|
105
116
|
if (!noSetWindow) {
|
|
106
117
|
setDesignConfig(props);
|
|
107
118
|
}
|
|
@@ -109,11 +120,21 @@ var Renderer = function Renderer(props) {
|
|
|
109
120
|
window.magicDesignPageData = pageData;
|
|
110
121
|
var pageBackground = window.magicDesign.pageBackground;
|
|
111
122
|
(0, _react.useEffect)(function () {
|
|
112
|
-
|
|
123
|
+
isMountedRef.current = true; // 清除之前的定时器
|
|
124
|
+
|
|
125
|
+
if (timerRef.current) {
|
|
126
|
+
clearTimeout(timerRef.current);
|
|
127
|
+
timerRef.current = null;
|
|
128
|
+
}
|
|
129
|
+
|
|
113
130
|
var filterData = [];
|
|
114
131
|
|
|
115
132
|
if (pageData && pageData.childNodes && pageData.childNodes.length) {
|
|
116
|
-
|
|
133
|
+
filterData = pageData.childNodes.filter(function (node) {
|
|
134
|
+
return (0, _coreUtil.isActiveFloor)(node.activeTerminal);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
var graduallySetFloors_1 = function graduallySetFloors_1(data, step, interval, start) {
|
|
117
138
|
if (step === void 0) {
|
|
118
139
|
step = 5;
|
|
119
140
|
}
|
|
@@ -124,6 +145,11 @@ var Renderer = function Renderer(props) {
|
|
|
124
145
|
|
|
125
146
|
if (start === void 0) {
|
|
126
147
|
start = 0;
|
|
148
|
+
} // 检查组件是否仍然挂载
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if (!isMountedRef.current) {
|
|
152
|
+
return;
|
|
127
153
|
} // 计算这一步应该显示的最终索引
|
|
128
154
|
|
|
129
155
|
|
|
@@ -132,18 +158,29 @@ var Renderer = function Renderer(props) {
|
|
|
132
158
|
setFloors(data.slice(0, end)); // 如果还有更多楼层要显示,设置一个定时器来递归调用此函数
|
|
133
159
|
|
|
134
160
|
if (end < data.length) {
|
|
135
|
-
setTimeout(function () {
|
|
136
|
-
|
|
161
|
+
timerRef.current = setTimeout(function () {
|
|
162
|
+
graduallySetFloors_1(data, step, interval, end);
|
|
137
163
|
}, interval);
|
|
164
|
+
} else {
|
|
165
|
+
timerRef.current = null;
|
|
138
166
|
}
|
|
139
167
|
};
|
|
140
168
|
|
|
141
|
-
filterData
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
169
|
+
graduallySetFloors_1(filterData);
|
|
170
|
+
} else {
|
|
171
|
+
setFloors([]);
|
|
172
|
+
} // 清理函数:清除所有未完成的定时器
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
return function () {
|
|
176
|
+
isMountedRef.current = false;
|
|
177
|
+
|
|
178
|
+
if (timerRef.current) {
|
|
179
|
+
clearTimeout(timerRef.current);
|
|
180
|
+
timerRef.current = null;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}, [pageDataKey]);
|
|
147
184
|
(0, _react.useEffect)(function () {
|
|
148
185
|
setTimeout(function () {
|
|
149
186
|
var _a;
|
|
@@ -238,13 +275,17 @@ var Renderer = function Renderer(props) {
|
|
|
238
275
|
console.error("[MagicBox] Can not find type " + nodeData.type);
|
|
239
276
|
return;
|
|
240
277
|
}
|
|
241
|
-
/** 添加模块需要 给GA使用 */
|
|
242
278
|
|
|
279
|
+
console.log('----nodeData', nodeData, moduleIndex);
|
|
280
|
+
/** 添加模块需要 给GA使用 */
|
|
281
|
+
// 避免直接修改原始 nodeData,创建新对象
|
|
243
282
|
|
|
244
|
-
|
|
283
|
+
var nodeDataWithIndex = __assign(__assign({}, nodeData), {
|
|
284
|
+
moduleIndex: moduleIndex + 1
|
|
285
|
+
});
|
|
245
286
|
|
|
246
|
-
var newInstanceProps = __assign(__assign({},
|
|
247
|
-
nodeData:
|
|
287
|
+
var newInstanceProps = __assign(__assign({}, nodeDataWithIndex), {
|
|
288
|
+
nodeData: nodeDataWithIndex,
|
|
248
289
|
mode: 'renderer',
|
|
249
290
|
outputType: outputType
|
|
250
291
|
});
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
&.less-than-4 {
|
|
7
7
|
.image-list-wrapper {
|
|
8
|
-
padding-left: 0!important;
|
|
9
8
|
.image-list {
|
|
10
9
|
width: fit-content;
|
|
11
10
|
margin: 0 auto;
|
|
@@ -17,7 +16,6 @@
|
|
|
17
16
|
display: flex;
|
|
18
17
|
align-items: center;
|
|
19
18
|
gap: 16px;
|
|
20
|
-
background: #ffffff;
|
|
21
19
|
// overflow: auto;
|
|
22
20
|
position: relative;
|
|
23
21
|
width: fit-content;
|
|
@@ -48,7 +46,6 @@
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
.image-list-wrapper {
|
|
51
|
-
padding-left: 88px;
|
|
52
49
|
position: relative;
|
|
53
50
|
|
|
54
51
|
.image-list {
|
|
@@ -60,20 +57,15 @@
|
|
|
60
57
|
flex: 1;
|
|
61
58
|
scroll-behavior: smooth;
|
|
62
59
|
-webkit-overflow-scrolling: touch;
|
|
60
|
+
scrollbar-width: none;
|
|
63
61
|
|
|
64
62
|
&::-webkit-scrollbar {
|
|
65
63
|
display: none;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
scrollbar-width: none;
|
|
69
|
-
|
|
70
66
|
.image-item {
|
|
71
67
|
flex-shrink: 0;
|
|
72
68
|
width: 300px;
|
|
73
|
-
|
|
74
|
-
&:last-child {
|
|
75
|
-
margin-right: 40px;
|
|
76
|
-
}
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
.empty-placeholder {
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
.recommend-tab-select-wrap {
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
|
-
height: 50px;
|
|
20
|
-
background: rgb(255 255 255);
|
|
19
|
+
// height: 50px;
|
|
21
20
|
// overflow: auto;
|
|
22
21
|
position: relative;
|
|
23
22
|
width: fit-content;
|
|
@@ -97,6 +96,10 @@
|
|
|
97
96
|
margin: 0;
|
|
98
97
|
}
|
|
99
98
|
|
|
99
|
+
.scrollContainer::-webkit-scrollbar {
|
|
100
|
+
display: none; /* Chrome, Safari, Opera */
|
|
101
|
+
}
|
|
102
|
+
|
|
100
103
|
.scrollContainer {
|
|
101
104
|
display: flex;
|
|
102
105
|
flex-direction: row;
|
|
@@ -104,6 +107,8 @@
|
|
|
104
107
|
flex: 1;
|
|
105
108
|
margin: 0;
|
|
106
109
|
overflow-x: auto;
|
|
110
|
+
scrollbar-width: none; /* Firefox */
|
|
111
|
+
-ms-overflow-style: none; /* IE 和 Edge */
|
|
107
112
|
padding-bottom: 15px;
|
|
108
113
|
|
|
109
114
|
&.pl_100 {
|
|
@@ -102,6 +102,17 @@ var Renderer = function Renderer(props) {
|
|
|
102
102
|
toastState = _e[0],
|
|
103
103
|
setToastState = _e[1];
|
|
104
104
|
|
|
105
|
+
var timerRef = (0, _react.useRef)(null);
|
|
106
|
+
var isMountedRef = (0, _react.useRef)(true); // 使用 useMemo 来稳定 pageData 的引用,避免不必要的重新渲染
|
|
107
|
+
|
|
108
|
+
var pageDataKey = (0, _react.useMemo)(function () {
|
|
109
|
+
if (!pageData || !pageData.childNodes) return ''; // 创建一个稳定的标识符,基于 childNodes 的内容
|
|
110
|
+
|
|
111
|
+
return pageData.childNodes.map(function (node) {
|
|
112
|
+
return node.id + "-" + node.type;
|
|
113
|
+
}).join(',');
|
|
114
|
+
}, [pageData]);
|
|
115
|
+
|
|
105
116
|
if (!noSetWindow) {
|
|
106
117
|
setDesignConfig(props);
|
|
107
118
|
}
|
|
@@ -109,11 +120,21 @@ var Renderer = function Renderer(props) {
|
|
|
109
120
|
window.magicDesignPageData = pageData;
|
|
110
121
|
var pageBackground = window.magicDesign.pageBackground;
|
|
111
122
|
(0, _react.useEffect)(function () {
|
|
112
|
-
|
|
123
|
+
isMountedRef.current = true; // 清除之前的定时器
|
|
124
|
+
|
|
125
|
+
if (timerRef.current) {
|
|
126
|
+
clearTimeout(timerRef.current);
|
|
127
|
+
timerRef.current = null;
|
|
128
|
+
}
|
|
129
|
+
|
|
113
130
|
var filterData = [];
|
|
114
131
|
|
|
115
132
|
if (pageData && pageData.childNodes && pageData.childNodes.length) {
|
|
116
|
-
|
|
133
|
+
filterData = pageData.childNodes.filter(function (node) {
|
|
134
|
+
return (0, _coreUtil.isActiveFloor)(node.activeTerminal);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
var graduallySetFloors_1 = function graduallySetFloors_1(data, step, interval, start) {
|
|
117
138
|
if (step === void 0) {
|
|
118
139
|
step = 5;
|
|
119
140
|
}
|
|
@@ -124,6 +145,11 @@ var Renderer = function Renderer(props) {
|
|
|
124
145
|
|
|
125
146
|
if (start === void 0) {
|
|
126
147
|
start = 0;
|
|
148
|
+
} // 检查组件是否仍然挂载
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if (!isMountedRef.current) {
|
|
152
|
+
return;
|
|
127
153
|
} // 计算这一步应该显示的最终索引
|
|
128
154
|
|
|
129
155
|
|
|
@@ -132,18 +158,29 @@ var Renderer = function Renderer(props) {
|
|
|
132
158
|
setFloors(data.slice(0, end)); // 如果还有更多楼层要显示,设置一个定时器来递归调用此函数
|
|
133
159
|
|
|
134
160
|
if (end < data.length) {
|
|
135
|
-
setTimeout(function () {
|
|
136
|
-
|
|
161
|
+
timerRef.current = setTimeout(function () {
|
|
162
|
+
graduallySetFloors_1(data, step, interval, end);
|
|
137
163
|
}, interval);
|
|
164
|
+
} else {
|
|
165
|
+
timerRef.current = null;
|
|
138
166
|
}
|
|
139
167
|
};
|
|
140
168
|
|
|
141
|
-
filterData
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
169
|
+
graduallySetFloors_1(filterData);
|
|
170
|
+
} else {
|
|
171
|
+
setFloors([]);
|
|
172
|
+
} // 清理函数:清除所有未完成的定时器
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
return function () {
|
|
176
|
+
isMountedRef.current = false;
|
|
177
|
+
|
|
178
|
+
if (timerRef.current) {
|
|
179
|
+
clearTimeout(timerRef.current);
|
|
180
|
+
timerRef.current = null;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}, [pageDataKey]);
|
|
147
184
|
(0, _react.useEffect)(function () {
|
|
148
185
|
setTimeout(function () {
|
|
149
186
|
var _a;
|
|
@@ -238,13 +275,17 @@ var Renderer = function Renderer(props) {
|
|
|
238
275
|
console.error("[MagicBox] Can not find type " + nodeData.type);
|
|
239
276
|
return;
|
|
240
277
|
}
|
|
241
|
-
/** 添加模块需要 给GA使用 */
|
|
242
278
|
|
|
279
|
+
console.log('----nodeData', nodeData, moduleIndex);
|
|
280
|
+
/** 添加模块需要 给GA使用 */
|
|
281
|
+
// 避免直接修改原始 nodeData,创建新对象
|
|
243
282
|
|
|
244
|
-
|
|
283
|
+
var nodeDataWithIndex = __assign(__assign({}, nodeData), {
|
|
284
|
+
moduleIndex: moduleIndex + 1
|
|
285
|
+
});
|
|
245
286
|
|
|
246
|
-
var newInstanceProps = __assign(__assign({},
|
|
247
|
-
nodeData:
|
|
287
|
+
var newInstanceProps = __assign(__assign({}, nodeDataWithIndex), {
|
|
288
|
+
nodeData: nodeDataWithIndex,
|
|
248
289
|
mode: 'renderer',
|
|
249
290
|
outputType: outputType
|
|
250
291
|
});
|