@fonixtree/magic-design 0.0.97 → 0.0.99
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/common/LinkModal/FilteredProductModal/index.js +21 -18
- package/es/composite-comp/bol/components/Banner/mobile/index.js +11 -18
- package/es/composite-comp/bol/components/Banner/pc/index.js +10 -10
- package/es/composite-comp/bol/components/ImageText/pc/index.less +2 -0
- package/es/composite-comp/bol/components/Newsletter/index.js +15 -2
- package/es/composite-comp/common/config-panels/SpacingConfig/index.js +14 -1
- package/es/composite-comp/dito/components/PcNavigation/pc/index.js +0 -2
- package/es/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -1
- package/es/composite-comp/dito/config-panels/SearchBarConfig/index.js +2 -1
- package/es/core/Designer/PageCompList/index.js +29 -1
- package/es/core/Designer/QuickMenuBar/index.js +3 -1
- package/es/core/Designer/ViewArea/index.js +3 -4
- package/es/core/Designer/ViewArea/index.less +1 -6
- package/es/core/Renderer/index.js +5 -3
- package/es/decorator/compositeDecorator.js +131 -38
- package/es/decorator/metaDecorator.js +1 -1
- package/es/mobx/Store.js +4 -1
- package/lib/common/LinkModal/FilteredProductModal/index.js +21 -18
- package/lib/composite-comp/bol/components/Banner/mobile/index.js +11 -18
- package/lib/composite-comp/bol/components/Banner/pc/index.js +10 -10
- package/lib/composite-comp/bol/components/ImageText/pc/index.less +2 -0
- package/lib/composite-comp/bol/components/Newsletter/index.js +15 -2
- package/lib/composite-comp/common/config-panels/SpacingConfig/index.js +14 -1
- package/lib/composite-comp/dito/components/PcNavigation/pc/index.js +0 -2
- package/lib/composite-comp/dito/components/SearchBar/defaultJSON.js +2 -1
- package/lib/composite-comp/dito/config-panels/SearchBarConfig/index.js +2 -1
- package/lib/core/Designer/PageCompList/index.js +29 -1
- package/lib/core/Designer/QuickMenuBar/index.js +3 -1
- package/lib/core/Designer/ViewArea/index.js +3 -4
- package/lib/core/Designer/ViewArea/index.less +1 -6
- package/lib/core/Renderer/index.js +5 -3
- package/lib/decorator/compositeDecorator.js +131 -38
- package/lib/decorator/metaDecorator.js +1 -1
- package/lib/mobx/Store.js +4 -1
- package/package.json +1 -1
|
@@ -74,9 +74,8 @@
|
|
|
74
74
|
padding: 24px;
|
|
75
75
|
|
|
76
76
|
.device_border {
|
|
77
|
-
padding: 1px;
|
|
78
|
-
max-width: 1240px;
|
|
79
77
|
width: 100%;
|
|
78
|
+
padding: 1px;
|
|
80
79
|
min-height: 70vh;
|
|
81
80
|
border: 16px solid #FFF;
|
|
82
81
|
border-radius: 12px;
|
|
@@ -84,10 +83,6 @@
|
|
|
84
83
|
height: 100%;
|
|
85
84
|
overflow: scroll;
|
|
86
85
|
box-sizing: content-box;
|
|
87
|
-
|
|
88
|
-
.device_content {
|
|
89
|
-
min-width: 1200px;
|
|
90
|
-
}
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
}
|
|
@@ -41,7 +41,8 @@ var setDesignConfig = function setDesignConfig(props) {
|
|
|
41
41
|
device: device,
|
|
42
42
|
isShop: isShop
|
|
43
43
|
}, config), {
|
|
44
|
-
compSpacing: Number(config.compSpacing)
|
|
44
|
+
compSpacing: Number(config.compSpacing),
|
|
45
|
+
compWidth: Number(config.compWidth)
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
/**
|
|
@@ -51,7 +52,8 @@ var setDesignConfig = function setDesignConfig(props) {
|
|
|
51
52
|
|
|
52
53
|
var Renderer = function Renderer(props) {
|
|
53
54
|
var pageData = props.pageData;
|
|
54
|
-
setDesignConfig(props);
|
|
55
|
+
setDesignConfig(props);
|
|
56
|
+
var pageBackground = window.magicDesign.pageBackground; // 根据楼层展示设备进行过滤
|
|
55
57
|
|
|
56
58
|
var filterCompFloor = function filterCompFloor() {
|
|
57
59
|
var source = [];
|
|
@@ -69,7 +71,7 @@ var Renderer = function Renderer(props) {
|
|
|
69
71
|
className: "render_wrap",
|
|
70
72
|
magic_design: "",
|
|
71
73
|
style: {
|
|
72
|
-
background:
|
|
74
|
+
background: pageBackground
|
|
73
75
|
}
|
|
74
76
|
}, filterCompFloor().map(function (nodeData) {
|
|
75
77
|
var Clazz = _componentTypes.componentMap[nodeData.type];
|
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _mobx = require("../mobx");
|
|
13
13
|
|
|
14
|
+
var _constants = require("../constants");
|
|
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; }
|
|
@@ -58,6 +60,17 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
function compositeDecorator(WrappedComponent) {
|
|
63
|
+
var floorNameStyle = {
|
|
64
|
+
backgroundColor: '#2F54EB',
|
|
65
|
+
height: '18px',
|
|
66
|
+
color: '#FFF',
|
|
67
|
+
fontSize: '10px',
|
|
68
|
+
padding: '0 5px',
|
|
69
|
+
display: 'flex',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
width: 'fit-content'
|
|
72
|
+
};
|
|
73
|
+
|
|
61
74
|
var Wrapper =
|
|
62
75
|
/** @class */
|
|
63
76
|
function (_super) {
|
|
@@ -67,7 +80,8 @@ function compositeDecorator(WrappedComponent) {
|
|
|
67
80
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
68
81
|
|
|
69
82
|
_this.state = {
|
|
70
|
-
clickedFloor: ''
|
|
83
|
+
clickedFloor: '',
|
|
84
|
+
hoveredFloor: ''
|
|
71
85
|
}; // 复合组件点击事件
|
|
72
86
|
|
|
73
87
|
_this.onCompositeCompClick = function (event) {
|
|
@@ -89,48 +103,115 @@ function compositeDecorator(WrappedComponent) {
|
|
|
89
103
|
window.document.dispatchEvent(evt);
|
|
90
104
|
};
|
|
91
105
|
|
|
92
|
-
_this.
|
|
106
|
+
_this.getCompositeStyle = function () {
|
|
107
|
+
var _a;
|
|
108
|
+
|
|
93
109
|
var nodeData = _this.props.nodeData;
|
|
94
|
-
var wrapStyle = {
|
|
95
|
-
border: 'none'
|
|
96
|
-
};
|
|
97
|
-
var _a = window.magicDesign,
|
|
98
|
-
device = _a.device,
|
|
99
|
-
mode = _a.mode;
|
|
100
110
|
var spacing = nodeData.spacing,
|
|
101
|
-
background = nodeData.background;
|
|
111
|
+
background = nodeData.background;
|
|
112
|
+
var _b = window.magicDesign,
|
|
113
|
+
device = _b.device,
|
|
114
|
+
compWidth = _b.compWidth;
|
|
115
|
+
var wrapStyle = {
|
|
116
|
+
border: 'none',
|
|
117
|
+
position: 'relative',
|
|
118
|
+
zIndex: '1',
|
|
119
|
+
margin: '0 auto'
|
|
120
|
+
}; // 复合组件内边距
|
|
121
|
+
|
|
122
|
+
if (spacing && spacing[device]) {
|
|
123
|
+
wrapStyle = __assign(__assign({}, wrapStyle), spacing[device]);
|
|
124
|
+
} // 复合组件背景
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
if (background) {
|
|
128
|
+
if (background.bgType === 'color') {
|
|
129
|
+
wrapStyle.backgroundColor = background.color;
|
|
130
|
+
wrapStyle.opacity = background.opacity ? background.opacity : 1;
|
|
131
|
+
} else {
|
|
132
|
+
wrapStyle.backgroundImage = "url(" + background.image + ")";
|
|
133
|
+
wrapStyle.backgroundPosition = '0px 0px';
|
|
134
|
+
wrapStyle.backgroundSize = 'auto 100%';
|
|
135
|
+
wrapStyle.backgroundRepeat = 'no-repeat';
|
|
136
|
+
}
|
|
137
|
+
} // 复合组件宽度
|
|
138
|
+
// 此处特殊处理一些占满整屏的组件: spacing.pc.fillUp = true时,沾满全屏
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if (device === _constants.deviceTypeMap.PC && compWidth && !((_a = spacing.pc) === null || _a === void 0 ? void 0 : _a.fillUp)) {
|
|
142
|
+
wrapStyle.width = compWidth;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return wrapStyle;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
_this.getMaskStyle = function () {
|
|
149
|
+
var nodeData = _this.props.nodeData;
|
|
150
|
+
var mode = window.magicDesign.mode;
|
|
151
|
+
var _a = _this.state,
|
|
152
|
+
hoveredFloor = _a.hoveredFloor,
|
|
153
|
+
clickedFloor = _a.clickedFloor; // 选中状态
|
|
154
|
+
|
|
155
|
+
var maskStyle = {
|
|
156
|
+
border: '2px solid #2F54EB',
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
inset: '0px',
|
|
159
|
+
zIndex: '0',
|
|
160
|
+
opacity: '0'
|
|
161
|
+
}; // 处理复合组件的hover状态
|
|
102
162
|
|
|
103
163
|
if (mode === 'designer') {
|
|
104
|
-
|
|
105
|
-
|
|
164
|
+
if (clickedFloor !== hoveredFloor && hoveredFloor === nodeData.id) {
|
|
165
|
+
maskStyle.backgroundColor = 'rgba(47, 84, 235, 0.08)';
|
|
166
|
+
maskStyle.opacity = '100%';
|
|
167
|
+
maskStyle.zIndex = '3';
|
|
168
|
+
} // 处理复合组件的选中状态
|
|
106
169
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (nodeData.type != 'BANNER') {
|
|
114
|
-
// 边距
|
|
115
|
-
if (spacing && spacing[device]) {
|
|
116
|
-
wrapStyle = __assign(__assign({}, wrapStyle), spacing[device]);
|
|
117
|
-
} // 背景
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (background) {
|
|
121
|
-
if (background.bgType === 'color') {
|
|
122
|
-
wrapStyle.backgroundColor = background.color;
|
|
123
|
-
wrapStyle.opacity = background.opacity ? background.opacity : 1;
|
|
124
|
-
} else {
|
|
125
|
-
wrapStyle.backgroundImage = "url(" + background.image + ")";
|
|
126
|
-
wrapStyle.backgroundPosition = '0px 0px';
|
|
127
|
-
wrapStyle.backgroundSize = 'auto 100%';
|
|
128
|
-
wrapStyle.backgroundRepeat = 'no-repeat';
|
|
129
|
-
}
|
|
170
|
+
|
|
171
|
+
if (clickedFloor === nodeData.id) {
|
|
172
|
+
maskStyle.backgroundColor = 'transparent';
|
|
173
|
+
maskStyle.opacity = '100%';
|
|
174
|
+
maskStyle.zIndex = '0';
|
|
130
175
|
}
|
|
131
176
|
}
|
|
132
177
|
|
|
133
|
-
return
|
|
178
|
+
return maskStyle;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
_this.getWrapStyle = function () {
|
|
182
|
+
var mode = window.magicDesign.mode;
|
|
183
|
+
var nodeData = _this.props.nodeData;
|
|
184
|
+
var style = {
|
|
185
|
+
position: 'relative',
|
|
186
|
+
zIndex: '1'
|
|
187
|
+
};
|
|
188
|
+
var clickedFloor = _this.state.clickedFloor; // banner 和 recommend 在选中状态需要加padding,让选中的外边框展示出来
|
|
189
|
+
|
|
190
|
+
if (mode === 'designer' && clickedFloor === nodeData.id && ['BANNER', 'RECOMMEND'].includes(nodeData.type)) {
|
|
191
|
+
style.padding = '2px';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return style;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
_this.onMouseEnter = function () {
|
|
198
|
+
if (window.magicDesign.mode === 'renderer') {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
_mobx.store.setState({
|
|
203
|
+
hoveredFloor: _this.props.nodeData.id
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
_this.onMouseLeave = function () {
|
|
208
|
+
if (window.magicDesign.mode === 'renderer') {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
_mobx.store.setState({
|
|
213
|
+
hoveredFloor: ''
|
|
214
|
+
});
|
|
134
215
|
};
|
|
135
216
|
|
|
136
217
|
return _this;
|
|
@@ -141,7 +222,8 @@ function compositeDecorator(WrappedComponent) {
|
|
|
141
222
|
|
|
142
223
|
this.distroy = (0, _mobx.autorun)(function () {
|
|
143
224
|
_this.setState({
|
|
144
|
-
clickedFloor: _mobx.store.clickedFloor
|
|
225
|
+
clickedFloor: _mobx.store.clickedFloor,
|
|
226
|
+
hoveredFloor: _mobx.store.hoveredFloor
|
|
145
227
|
});
|
|
146
228
|
});
|
|
147
229
|
};
|
|
@@ -151,11 +233,22 @@ function compositeDecorator(WrappedComponent) {
|
|
|
151
233
|
};
|
|
152
234
|
|
|
153
235
|
Wrapper.prototype.render = function () {
|
|
236
|
+
var nodeData = this.props.nodeData;
|
|
237
|
+
var clickedFloor = this.state.clickedFloor;
|
|
154
238
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
155
239
|
className: "composite_wrap",
|
|
156
240
|
onClick: this.onCompositeCompClick,
|
|
157
|
-
|
|
158
|
-
|
|
241
|
+
onMouseEnter: this.onMouseEnter,
|
|
242
|
+
onMouseLeave: this.onMouseLeave,
|
|
243
|
+
style: this.getCompositeStyle()
|
|
244
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
245
|
+
className: "composite_mask",
|
|
246
|
+
style: this.getMaskStyle()
|
|
247
|
+
}, clickedFloor !== nodeData.id && /*#__PURE__*/_react["default"].createElement("span", {
|
|
248
|
+
style: floorNameStyle
|
|
249
|
+
}, _constants.compInfoMap[nodeData.type].name)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
250
|
+
style: this.getWrapStyle()
|
|
251
|
+
}, /*#__PURE__*/_react["default"].createElement(WrappedComponent, this.props)));
|
|
159
252
|
};
|
|
160
253
|
|
|
161
254
|
Wrapper.getDefaultJSON = WrappedComponent.getDefaultJSON;
|
|
@@ -182,7 +182,7 @@ function metaDecorator(WrappedComponent) {
|
|
|
182
182
|
|
|
183
183
|
if (rest.data.type === 'TEXT') {
|
|
184
184
|
var width = window.magicDesign.device === 'pc' ? rest.data.content.pcWidth : rest.data.content.width;
|
|
185
|
-
newStyle.width = (width || 100) + "%";
|
|
185
|
+
newStyle.width = (Math.min(width, 100) || 100) + "%";
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
return newStyle;
|
package/lib/mobx/Store.js
CHANGED
|
@@ -14,7 +14,7 @@ var _storeUtil = require("../utils/storeUtil");
|
|
|
14
14
|
var debug = require('debug')('worker:mobx');
|
|
15
15
|
|
|
16
16
|
var CACHE_KEY = 'STORE';
|
|
17
|
-
var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'textSelection', 'MPageData'];
|
|
17
|
+
var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'hoveredFloor', 'textSelection', 'MPageData'];
|
|
18
18
|
|
|
19
19
|
var Store =
|
|
20
20
|
/** @class */
|
|
@@ -30,6 +30,8 @@ function () {
|
|
|
30
30
|
|
|
31
31
|
this.clickedFloor = ''; // 点击的楼层Id
|
|
32
32
|
|
|
33
|
+
this.hoveredFloor = ''; // hover的复合组件Id
|
|
34
|
+
|
|
33
35
|
this.textSelection = null; // 文本元组件选中区域
|
|
34
36
|
|
|
35
37
|
this.MPageData = []; // 楼层数据
|
|
@@ -43,6 +45,7 @@ function () {
|
|
|
43
45
|
clickedMeta: _mobx.observable,
|
|
44
46
|
clickedGroup: _mobx.observable,
|
|
45
47
|
clickedFloor: _mobx.observable,
|
|
48
|
+
hoveredFloor: _mobx.observable,
|
|
46
49
|
CarouselStore: _mobx.observable,
|
|
47
50
|
setState: _mobx.action.bound
|
|
48
51
|
});
|