@fonixtree/magic-design 0.0.62 → 0.0.63

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.
@@ -94,19 +94,7 @@ function (_super) {
94
94
  return;
95
95
  }
96
96
 
97
- var activeItem = source.find(function (src) {
98
- return src.active;
99
- });
100
-
101
- if (activeItem) {
102
- actives.push(activeItem.key);
103
-
104
- _this.setState({
105
- activeKey: actives
106
- });
107
-
108
- return;
109
- } else if (type === 'switch') {
97
+ if (type === 'switch') {
110
98
  var first = source.find(function (src) {
111
99
  var _a;
112
100
 
@@ -120,6 +108,13 @@ function (_super) {
120
108
 
121
109
  actives.push(((_b = first.metaOption) === null || _b === void 0 ? void 0 : _b.id) || first.key);
122
110
  }
111
+ } else if (type === 'triangle' && _mobx.store.clickedMeta && !_mobx.store.clickedGroup) {
112
+ var activeItem = source.find(function (src) {
113
+ var _a, _b;
114
+
115
+ return JSON.stringify(((_b = (_a = src.value) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.panelProps) || '').includes(_mobx.store.clickedMeta);
116
+ });
117
+ actives.push(activeItem === null || activeItem === void 0 ? void 0 : activeItem.key);
123
118
  } else {
124
119
  var first = source.find(function (src) {
125
120
  var _a;
@@ -152,16 +152,13 @@ exports.recommendGroupSourceJSON = recommendGroupSourceJSON;
152
152
 
153
153
  var getDefaultJSON = function getDefaultJSON() {
154
154
  var groupId = (0, _uuid.v4)();
155
- var contentId = (0, _uuid.v4)();
156
155
  return {
157
156
  id: groupId,
158
157
  type: 'RECOMMEND',
159
158
  groupSource: [recommendGroupSourceJSON(groupId, '', 'Tab1'), recommendGroupSourceJSON(groupId, '', 'Tab2')],
160
159
  content: {
161
- id: contentId,
162
160
  label: {
163
161
  id: (0, _uuid.v4)(),
164
- contentId: contentId,
165
162
  open: true,
166
163
  type: 'BUTTON',
167
164
  text: 'Button',
@@ -204,7 +201,6 @@ var getDefaultJSON = function getDefaultJSON() {
204
201
  },
205
202
  productName: {
206
203
  id: (0, _uuid.v4)(),
207
- contentId: contentId,
208
204
  open: true,
209
205
  type: 'Text',
210
206
  specialContent: [],
@@ -228,7 +224,6 @@ var getDefaultJSON = function getDefaultJSON() {
228
224
  },
229
225
  activityPrice: {
230
226
  id: (0, _uuid.v4)(),
231
- contentId: contentId,
232
227
  open: true,
233
228
  type: 'Text',
234
229
  specialContent: [],
@@ -252,7 +247,6 @@ var getDefaultJSON = function getDefaultJSON() {
252
247
  },
253
248
  salesPrice: {
254
249
  id: (0, _uuid.v4)(),
255
- contentId: contentId,
256
250
  open: true,
257
251
  type: 'Text',
258
252
  specialContent: [],
@@ -25,8 +25,6 @@ var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
25
25
 
26
26
  var _locale = require("../../../../locale");
27
27
 
28
- var _mobx = require("../../../../mobx");
29
-
30
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
29
 
32
30
  var __extends = void 0 && (void 0).__extends || function () {
@@ -81,10 +79,6 @@ function (_super) {
81
79
  _this.selfRender();
82
80
  };
83
81
 
84
- _this.getIsContentActive = function (content) {
85
- return JSON.stringify(content).includes(_mobx.store.clickedMetaParent);
86
- };
87
-
88
82
  return _this;
89
83
  }
90
84
 
@@ -106,8 +100,7 @@ function (_super) {
106
100
  name: (0, _locale.i18n)('CONTENT'),
107
101
  value: /*#__PURE__*/_react["default"].createElement(_RecommendConfigContent["default"], {
108
102
  panelProps: data.content
109
- }),
110
- active: this.getIsContentActive(data.content)
103
+ })
111
104
  }, {
112
105
  key: '3',
113
106
  name: (0, _locale.i18n)('SPACING'),
@@ -83,19 +83,19 @@ function (_super) {
83
83
  _this.setState({
84
84
  clickedGroup: _mobx.store.clickedGroup,
85
85
  selectedNode: selectedNode
86
- }); // 展开以及面板
86
+ }); // 展开一级面板
87
87
 
88
88
 
89
89
  if (selectedNode) {
90
90
  _this.openConfig();
91
91
  } else {
92
92
  _this.closeConfig();
93
- } // 展开首期二级面板
93
+ } // 展开二级面板
94
94
 
95
95
 
96
- if (!_mobx.store.clickedGroup) {
96
+ if (!_mobx.store.clickedGroup && _this.preClickedGroup) {
97
97
  _this.closeSecConfig();
98
- } else if (_mobx.store.clickedGroup !== _this.preClickedGroup) {
98
+ } else if (Boolean(_mobx.store.clickedGroup) != Boolean(_this.preClickedGroup)) {
99
99
  _this.openSecConfig();
100
100
  }
101
101
 
@@ -294,7 +294,9 @@ function (_super) {
294
294
  };
295
295
 
296
296
  ConfigPanel.prototype.componentWillReceiveProps = function (nextProps) {
297
- this.resetState(nextProps, _mobx.store.clickedFloor);
297
+ if (JSON.stringify(this.props) !== JSON.stringify(nextProps)) {
298
+ this.resetState(nextProps, _mobx.store.clickedFloor);
299
+ }
298
300
  };
299
301
 
300
302
  ConfigPanel.prototype.componentWillUnmount = function () {
@@ -11,6 +11,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
+ var _mobx = require("../../../mobx");
15
+
14
16
  var _Button = _interopRequireDefault(require("../../../common/Button"));
15
17
 
16
18
  var _Iconfont = _interopRequireDefault(require("../../../common/Iconfont"));
@@ -80,9 +82,13 @@ function (_super) {
80
82
  var _this = _super !== null && _super.apply(this, arguments) || this;
81
83
 
82
84
  _this.onBtnClick = function (event) {
83
- var code = event.currentTarget.dataset.code; // if (code === quickMenuCode.SAVE || code === quickMenuCode.PUBLISH) {
84
- // store.setState({ clickedFloor: '' });
85
- // }
85
+ var code = event.currentTarget.dataset.code; // 保存和发布时需要清空组件和元组件的选中状态,否则截图中会看到选中状态
86
+
87
+ if (code === _constants.quickMenuCode.SAVE || code === _constants.quickMenuCode.PUBLISH) {
88
+ _mobx.store.setState({
89
+ clickedFloor: ''
90
+ });
91
+ }
86
92
 
87
93
  if (_this.props.device === _constants.deviceTypeMap.PC) {}
88
94
 
@@ -69,7 +69,7 @@ function metaDecorator(WrappedComponent) {
69
69
  }; // 元组件点击事件
70
70
 
71
71
  _this.onMetaClick = function (event) {
72
- var _a, _b, _c;
72
+ var _a, _b;
73
73
 
74
74
  if (window.magicDesign.mode === 'renderer') {
75
75
  return;
@@ -79,8 +79,7 @@ function metaDecorator(WrappedComponent) {
79
79
  event.preventDefault();
80
80
  event.stopPropagation();
81
81
  var parentId = (_a = _this.props.data) === null || _a === void 0 ? void 0 : _a.parentId;
82
- var conentId = (_b = _this.props.data) === null || _b === void 0 ? void 0 : _b.contentId;
83
- var metaId = (_c = _this.props.data) === null || _c === void 0 ? void 0 : _c.id;
82
+ var metaId = (_b = _this.props.data) === null || _b === void 0 ? void 0 : _b.id;
84
83
  var floorId = null; // group中的元组件
85
84
 
86
85
  if (parentId) {
@@ -93,8 +92,7 @@ function metaDecorator(WrappedComponent) {
93
92
  _mobx.store.setState({
94
93
  clickedMeta: metaId,
95
94
  clickedGroup: parentId,
96
- clickedFloor: floorId,
97
- clickedMetaParent: conentId
95
+ clickedFloor: floorId
98
96
  });
99
97
  };
100
98
 
package/es/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', 'clickedMetaParent', 'clickedFloor', 'textSelection', 'MPageData'];
17
+ var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'textSelection', 'MPageData'];
18
18
 
19
19
  var Store =
20
20
  /** @class */
@@ -28,8 +28,6 @@ function () {
28
28
 
29
29
  this.clickedGroup = ''; // 点击的元组的上一层Id,即groupSourceId(元组件在Group中)
30
30
 
31
- this.clickedMetaParent = ''; // 点击的元组的上一层Id(元组件不在Group中,Recommend组件)
32
-
33
31
  this.clickedFloor = ''; // 点击的楼层Id
34
32
 
35
33
  this.textSelection = null; // 文本元组件选中区域
@@ -44,7 +42,6 @@ function () {
44
42
  hoveredMeta: _mobx.observable,
45
43
  clickedMeta: _mobx.observable,
46
44
  clickedGroup: _mobx.observable,
47
- clickedMetaParent: _mobx.observable,
48
45
  clickedFloor: _mobx.observable,
49
46
  CarouselStore: _mobx.observable,
50
47
  setState: _mobx.action.bound
@@ -94,19 +94,7 @@ function (_super) {
94
94
  return;
95
95
  }
96
96
 
97
- var activeItem = source.find(function (src) {
98
- return src.active;
99
- });
100
-
101
- if (activeItem) {
102
- actives.push(activeItem.key);
103
-
104
- _this.setState({
105
- activeKey: actives
106
- });
107
-
108
- return;
109
- } else if (type === 'switch') {
97
+ if (type === 'switch') {
110
98
  var first = source.find(function (src) {
111
99
  var _a;
112
100
 
@@ -120,6 +108,13 @@ function (_super) {
120
108
 
121
109
  actives.push(((_b = first.metaOption) === null || _b === void 0 ? void 0 : _b.id) || first.key);
122
110
  }
111
+ } else if (type === 'triangle' && _mobx.store.clickedMeta && !_mobx.store.clickedGroup) {
112
+ var activeItem = source.find(function (src) {
113
+ var _a, _b;
114
+
115
+ return JSON.stringify(((_b = (_a = src.value) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.panelProps) || '').includes(_mobx.store.clickedMeta);
116
+ });
117
+ actives.push(activeItem === null || activeItem === void 0 ? void 0 : activeItem.key);
123
118
  } else {
124
119
  var first = source.find(function (src) {
125
120
  var _a;
@@ -152,16 +152,13 @@ exports.recommendGroupSourceJSON = recommendGroupSourceJSON;
152
152
 
153
153
  var getDefaultJSON = function getDefaultJSON() {
154
154
  var groupId = (0, _uuid.v4)();
155
- var contentId = (0, _uuid.v4)();
156
155
  return {
157
156
  id: groupId,
158
157
  type: 'RECOMMEND',
159
158
  groupSource: [recommendGroupSourceJSON(groupId, '', 'Tab1'), recommendGroupSourceJSON(groupId, '', 'Tab2')],
160
159
  content: {
161
- id: contentId,
162
160
  label: {
163
161
  id: (0, _uuid.v4)(),
164
- contentId: contentId,
165
162
  open: true,
166
163
  type: 'BUTTON',
167
164
  text: 'Button',
@@ -204,7 +201,6 @@ var getDefaultJSON = function getDefaultJSON() {
204
201
  },
205
202
  productName: {
206
203
  id: (0, _uuid.v4)(),
207
- contentId: contentId,
208
204
  open: true,
209
205
  type: 'Text',
210
206
  specialContent: [],
@@ -228,7 +224,6 @@ var getDefaultJSON = function getDefaultJSON() {
228
224
  },
229
225
  activityPrice: {
230
226
  id: (0, _uuid.v4)(),
231
- contentId: contentId,
232
227
  open: true,
233
228
  type: 'Text',
234
229
  specialContent: [],
@@ -252,7 +247,6 @@ var getDefaultJSON = function getDefaultJSON() {
252
247
  },
253
248
  salesPrice: {
254
249
  id: (0, _uuid.v4)(),
255
- contentId: contentId,
256
250
  open: true,
257
251
  type: 'Text',
258
252
  specialContent: [],
@@ -25,8 +25,6 @@ var _Collapse = _interopRequireDefault(require("../../../../common/Collapse"));
25
25
 
26
26
  var _locale = require("../../../../locale");
27
27
 
28
- var _mobx = require("../../../../mobx");
29
-
30
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
29
 
32
30
  var __extends = void 0 && (void 0).__extends || function () {
@@ -81,10 +79,6 @@ function (_super) {
81
79
  _this.selfRender();
82
80
  };
83
81
 
84
- _this.getIsContentActive = function (content) {
85
- return JSON.stringify(content).includes(_mobx.store.clickedMetaParent);
86
- };
87
-
88
82
  return _this;
89
83
  }
90
84
 
@@ -106,8 +100,7 @@ function (_super) {
106
100
  name: (0, _locale.i18n)('CONTENT'),
107
101
  value: /*#__PURE__*/_react["default"].createElement(_RecommendConfigContent["default"], {
108
102
  panelProps: data.content
109
- }),
110
- active: this.getIsContentActive(data.content)
103
+ })
111
104
  }, {
112
105
  key: '3',
113
106
  name: (0, _locale.i18n)('SPACING'),
@@ -83,19 +83,19 @@ function (_super) {
83
83
  _this.setState({
84
84
  clickedGroup: _mobx.store.clickedGroup,
85
85
  selectedNode: selectedNode
86
- }); // 展开以及面板
86
+ }); // 展开一级面板
87
87
 
88
88
 
89
89
  if (selectedNode) {
90
90
  _this.openConfig();
91
91
  } else {
92
92
  _this.closeConfig();
93
- } // 展开首期二级面板
93
+ } // 展开二级面板
94
94
 
95
95
 
96
- if (!_mobx.store.clickedGroup) {
96
+ if (!_mobx.store.clickedGroup && _this.preClickedGroup) {
97
97
  _this.closeSecConfig();
98
- } else if (_mobx.store.clickedGroup !== _this.preClickedGroup) {
98
+ } else if (Boolean(_mobx.store.clickedGroup) != Boolean(_this.preClickedGroup)) {
99
99
  _this.openSecConfig();
100
100
  }
101
101
 
@@ -294,7 +294,9 @@ function (_super) {
294
294
  };
295
295
 
296
296
  ConfigPanel.prototype.componentWillReceiveProps = function (nextProps) {
297
- this.resetState(nextProps, _mobx.store.clickedFloor);
297
+ if (JSON.stringify(this.props) !== JSON.stringify(nextProps)) {
298
+ this.resetState(nextProps, _mobx.store.clickedFloor);
299
+ }
298
300
  };
299
301
 
300
302
  ConfigPanel.prototype.componentWillUnmount = function () {
@@ -11,6 +11,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
+ var _mobx = require("../../../mobx");
15
+
14
16
  var _Button = _interopRequireDefault(require("../../../common/Button"));
15
17
 
16
18
  var _Iconfont = _interopRequireDefault(require("../../../common/Iconfont"));
@@ -80,9 +82,13 @@ function (_super) {
80
82
  var _this = _super !== null && _super.apply(this, arguments) || this;
81
83
 
82
84
  _this.onBtnClick = function (event) {
83
- var code = event.currentTarget.dataset.code; // if (code === quickMenuCode.SAVE || code === quickMenuCode.PUBLISH) {
84
- // store.setState({ clickedFloor: '' });
85
- // }
85
+ var code = event.currentTarget.dataset.code; // 保存和发布时需要清空组件和元组件的选中状态,否则截图中会看到选中状态
86
+
87
+ if (code === _constants.quickMenuCode.SAVE || code === _constants.quickMenuCode.PUBLISH) {
88
+ _mobx.store.setState({
89
+ clickedFloor: ''
90
+ });
91
+ }
86
92
 
87
93
  if (_this.props.device === _constants.deviceTypeMap.PC) {}
88
94
 
@@ -69,7 +69,7 @@ function metaDecorator(WrappedComponent) {
69
69
  }; // 元组件点击事件
70
70
 
71
71
  _this.onMetaClick = function (event) {
72
- var _a, _b, _c;
72
+ var _a, _b;
73
73
 
74
74
  if (window.magicDesign.mode === 'renderer') {
75
75
  return;
@@ -79,8 +79,7 @@ function metaDecorator(WrappedComponent) {
79
79
  event.preventDefault();
80
80
  event.stopPropagation();
81
81
  var parentId = (_a = _this.props.data) === null || _a === void 0 ? void 0 : _a.parentId;
82
- var conentId = (_b = _this.props.data) === null || _b === void 0 ? void 0 : _b.contentId;
83
- var metaId = (_c = _this.props.data) === null || _c === void 0 ? void 0 : _c.id;
82
+ var metaId = (_b = _this.props.data) === null || _b === void 0 ? void 0 : _b.id;
84
83
  var floorId = null; // group中的元组件
85
84
 
86
85
  if (parentId) {
@@ -93,8 +92,7 @@ function metaDecorator(WrappedComponent) {
93
92
  _mobx.store.setState({
94
93
  clickedMeta: metaId,
95
94
  clickedGroup: parentId,
96
- clickedFloor: floorId,
97
- clickedMetaParent: conentId
95
+ clickedFloor: floorId
98
96
  });
99
97
  };
100
98
 
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', 'clickedMetaParent', 'clickedFloor', 'textSelection', 'MPageData'];
17
+ var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'textSelection', 'MPageData'];
18
18
 
19
19
  var Store =
20
20
  /** @class */
@@ -28,8 +28,6 @@ function () {
28
28
 
29
29
  this.clickedGroup = ''; // 点击的元组的上一层Id,即groupSourceId(元组件在Group中)
30
30
 
31
- this.clickedMetaParent = ''; // 点击的元组的上一层Id(元组件不在Group中,Recommend组件)
32
-
33
31
  this.clickedFloor = ''; // 点击的楼层Id
34
32
 
35
33
  this.textSelection = null; // 文本元组件选中区域
@@ -44,7 +42,6 @@ function () {
44
42
  hoveredMeta: _mobx.observable,
45
43
  clickedMeta: _mobx.observable,
46
44
  clickedGroup: _mobx.observable,
47
- clickedMetaParent: _mobx.observable,
48
45
  clickedFloor: _mobx.observable,
49
46
  CarouselStore: _mobx.observable,
50
47
  setState: _mobx.action.bound
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.62",
4
+ "version": "0.0.63",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",