@fonixtree/magic-design 0.0.53 → 0.0.55
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/README.md +320 -0
- package/es/common/ImageModal/index.js +27 -22
- package/es/common/ImgArea/components/Crop.js +267 -0
- package/es/common/ImgArea/components/Icons.js +44 -0
- package/es/common/ImgArea/index.js +11 -0
- package/es/common/index.js +8 -0
- package/es/composite-comp/bol/components/Banner/defaultJSON.js +8 -8
- package/es/composite-comp/bol/components/Banner/mobile/index.js +1 -5
- package/es/composite-comp/bol/components/Banner/pc/index.js +1 -5
- package/es/composite-comp/bol/components/Button/defaultJSON.js +2 -2
- package/es/composite-comp/bol/components/Button/index.js +1 -5
- package/es/composite-comp/bol/components/Carousel/defaultJSON.js +12 -16
- package/es/composite-comp/bol/components/Carousel/index.js +1 -6
- package/es/composite-comp/bol/components/ImageGallery/defaultJSON.js +2 -2
- package/es/composite-comp/bol/components/ImageText/defaultJSON.js +17 -17
- package/es/composite-comp/bol/components/ImageText/mobile/index.js +1 -3
- package/es/composite-comp/bol/components/ImageText/pc/index.js +1 -1
- package/es/composite-comp/bol/components/Newsletter/defaultJSON.js +2 -2
- package/es/composite-comp/bol/components/Newsletter/index.js +1 -6
- package/es/composite-comp/bol/components/Tag/defaultJSON.js +2 -2
- package/es/composite-comp/bol/components/Tag/index.js +1 -5
- package/es/composite-comp/bol/components/Text/defaultJSON.js +3 -3
- package/es/composite-comp/bol/components/Text/index.js +1 -5
- package/es/composite-comp/bol/config-panels/TagCompConfig/TagConfigContent/index.js +5 -3
- package/es/composite-comp/bol/config-panels/TagCompConfig/index.js +6 -4
- package/es/composite-comp/common/config-panels/CustomizeConfig/index.js +1 -1
- package/es/composite-comp/dito/components/FlashDeal/defaultJSON.js +5 -2
- package/es/composite-comp/dito/components/FlashDeal/index.js +5 -1
- package/es/composite-comp/dito/components/FlashDeal/mobile/index.less +0 -1
- package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg1.png +0 -0
- package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg2.png +0 -0
- package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg3.png +0 -0
- package/es/composite-comp/dito/components/FlashDeal/pc/index.js +578 -0
- package/es/composite-comp/dito/components/FlashDeal/pc/index.less +121 -0
- package/es/composite-comp/dito/components/MobileNavigation/defaultJSON.js +3 -3
- package/es/composite-comp/dito/components/Recommend/defaultJSON.js +2 -2
- package/es/composite-comp/dito/components/Recommend/index.js +1 -6
- package/es/composite-comp/dito/components/Recommend/pc/index.js +2 -2
- package/es/composite-comp/dito/config-panels/FlashDealConfig/index.js +1 -1
- package/es/core/Designer/index.js +0 -2
- package/es/decorator/compositeDecorator.js +45 -12
- package/es/locale/en/en.json +3 -0
- package/es/locale/es/es.json +3 -0
- package/es/locale/id/id.json +3 -0
- package/es/meta-comp/components/Button/index.js +1 -4
- package/es/meta-comp/components/Button/index.less +1 -1
- package/es/meta-comp/components/Image/index.js +31 -3
- package/es/meta-comp/components/Image/index.less +1 -0
- package/es/meta-comp/components/Text/index.js +1 -4
- package/es/meta-comp/config-panels/ButtonConfig/index.js +2 -2
- package/es/meta-comp/config-panels/ImageConfig/AreaConfigModal/index.js +164 -0
- package/es/meta-comp/config-panels/ImageConfig/AreaConfigModal/index.less +26 -0
- package/es/meta-comp/config-panels/ImageConfig/HotAreaConfig/index.js +130 -0
- package/es/meta-comp/config-panels/ImageConfig/HotAreaConfig/index.less +17 -0
- package/es/meta-comp/config-panels/ImageConfig/index.js +13 -4
- package/lib/common/ImageModal/index.js +27 -22
- package/lib/common/ImgArea/components/Crop.js +267 -0
- package/lib/common/ImgArea/components/Icons.js +44 -0
- package/lib/common/ImgArea/index.js +11 -0
- package/lib/common/index.js +8 -0
- package/lib/composite-comp/bol/components/Banner/defaultJSON.js +8 -8
- package/lib/composite-comp/bol/components/Banner/mobile/index.js +1 -5
- package/lib/composite-comp/bol/components/Banner/pc/index.js +1 -5
- package/lib/composite-comp/bol/components/Button/defaultJSON.js +2 -2
- package/lib/composite-comp/bol/components/Button/index.js +1 -5
- package/lib/composite-comp/bol/components/Carousel/defaultJSON.js +12 -16
- package/lib/composite-comp/bol/components/Carousel/index.js +1 -6
- package/lib/composite-comp/bol/components/ImageGallery/defaultJSON.js +2 -2
- package/lib/composite-comp/bol/components/ImageText/defaultJSON.js +17 -17
- package/lib/composite-comp/bol/components/ImageText/mobile/index.js +1 -3
- package/lib/composite-comp/bol/components/ImageText/pc/index.js +1 -1
- package/lib/composite-comp/bol/components/Newsletter/defaultJSON.js +2 -2
- package/lib/composite-comp/bol/components/Newsletter/index.js +1 -6
- package/lib/composite-comp/bol/components/Tag/defaultJSON.js +2 -2
- package/lib/composite-comp/bol/components/Tag/index.js +1 -5
- package/lib/composite-comp/bol/components/Text/defaultJSON.js +3 -3
- package/lib/composite-comp/bol/components/Text/index.js +1 -5
- package/lib/composite-comp/bol/config-panels/TagCompConfig/TagConfigContent/index.js +5 -3
- package/lib/composite-comp/bol/config-panels/TagCompConfig/index.js +6 -4
- package/lib/composite-comp/common/config-panels/CustomizeConfig/index.js +1 -1
- package/lib/composite-comp/dito/components/FlashDeal/defaultJSON.js +5 -2
- package/lib/composite-comp/dito/components/FlashDeal/index.js +5 -1
- package/lib/composite-comp/dito/components/FlashDeal/mobile/index.less +0 -1
- package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg1.png +0 -0
- package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg2.png +0 -0
- package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg3.png +0 -0
- package/lib/composite-comp/dito/components/FlashDeal/pc/index.js +578 -0
- package/lib/composite-comp/dito/components/FlashDeal/pc/index.less +121 -0
- package/lib/composite-comp/dito/components/MobileNavigation/defaultJSON.js +3 -3
- package/lib/composite-comp/dito/components/Recommend/defaultJSON.js +2 -2
- package/lib/composite-comp/dito/components/Recommend/index.js +1 -6
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +2 -2
- package/lib/composite-comp/dito/config-panels/FlashDealConfig/index.js +1 -1
- package/lib/core/Designer/index.js +0 -2
- package/lib/decorator/compositeDecorator.js +45 -12
- package/lib/locale/en/en.json +3 -0
- package/lib/locale/es/es.json +3 -0
- package/lib/locale/id/id.json +3 -0
- package/lib/meta-comp/components/Button/index.js +1 -4
- package/lib/meta-comp/components/Button/index.less +1 -1
- package/lib/meta-comp/components/Image/index.js +31 -3
- package/lib/meta-comp/components/Image/index.less +1 -0
- package/lib/meta-comp/components/Text/index.js +1 -4
- package/lib/meta-comp/config-panels/ButtonConfig/index.js +2 -2
- package/lib/meta-comp/config-panels/ImageConfig/AreaConfigModal/index.js +164 -0
- package/lib/meta-comp/config-panels/ImageConfig/AreaConfigModal/index.less +26 -0
- package/lib/meta-comp/config-panels/ImageConfig/HotAreaConfig/index.js +130 -0
- package/lib/meta-comp/config-panels/ImageConfig/HotAreaConfig/index.less +17 -0
- package/lib/meta-comp/config-panels/ImageConfig/index.js +13 -4
- package/package.json +90 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
require("./index.less");
|
|
13
|
+
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
|
|
16
|
+
var _coreUtil = require("../../../../utils/coreUtil");
|
|
17
|
+
|
|
18
|
+
var _locale = require("../../../../locale");
|
|
19
|
+
|
|
20
|
+
var _common = require("../../../../common");
|
|
21
|
+
|
|
22
|
+
var _AreaConfigModal = _interopRequireDefault(require("../AreaConfigModal"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
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 index =
|
|
57
|
+
/** @class */
|
|
58
|
+
function (_super) {
|
|
59
|
+
__extends(index, _super);
|
|
60
|
+
|
|
61
|
+
function index() {
|
|
62
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
63
|
+
|
|
64
|
+
_this.state = {
|
|
65
|
+
visible: false
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
_this.onCheckboxChange = function (e) {
|
|
69
|
+
var option = _this.props.option;
|
|
70
|
+
console.log(e.target.checked);
|
|
71
|
+
option.openHotArea = e.target.checked;
|
|
72
|
+
|
|
73
|
+
_this.setState({});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
_this.onAddArea = function () {
|
|
77
|
+
_this.setState({
|
|
78
|
+
visible: true
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
_this.onOk = function (data) {
|
|
83
|
+
if ((0, _coreUtil.isPc)()) {
|
|
84
|
+
_this.props.option.pcAreas = data;
|
|
85
|
+
} else {
|
|
86
|
+
_this.props.option.h5Areas = data;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_this.setState({
|
|
90
|
+
visible: false
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
_this.onCancel = function () {
|
|
95
|
+
_this.setState({
|
|
96
|
+
visible: false
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
index.prototype.render = function () {
|
|
104
|
+
var option = this.props.option;
|
|
105
|
+
var visible = this.state.visible;
|
|
106
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
+
className: "hot_area_wrap"
|
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
109
|
+
className: "area_wrap mb14"
|
|
110
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, (0, _locale.i18n)('CLICKABLE_AREA')), /*#__PURE__*/_react["default"].createElement(_antd.Checkbox, {
|
|
111
|
+
checked: option.openHotArea,
|
|
112
|
+
onChange: this.onCheckboxChange
|
|
113
|
+
})), option.openHotArea && /*#__PURE__*/_react["default"].createElement(_common.Button, {
|
|
114
|
+
icon: "icon-add",
|
|
115
|
+
onClick: this.onAddArea,
|
|
116
|
+
type: "primary"
|
|
117
|
+
}, (0, _locale.i18n)('ADD_AREA')), /*#__PURE__*/_react["default"].createElement(_AreaConfigModal["default"], {
|
|
118
|
+
imgUrl: this.props.imgUrl,
|
|
119
|
+
onCancel: this.onCancel,
|
|
120
|
+
onOk: this.onOk,
|
|
121
|
+
value: (0, _coreUtil.isPc)() ? option.pcAreas : option.h5Areas,
|
|
122
|
+
visible: visible
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return index;
|
|
127
|
+
}(_react.Component);
|
|
128
|
+
|
|
129
|
+
var _default = index;
|
|
130
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
.hot_area_wrap {
|
|
3
|
+
border-bottom: 1px dashed #D2D9E5;
|
|
4
|
+
margin-bottom: 16px;
|
|
5
|
+
padding-bottom: 12px;
|
|
6
|
+
.area_wrap {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
font-family: 'Open Sans';
|
|
11
|
+
font-style: normal;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
color: #232F46;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -11,6 +11,8 @@ var _antd = require("antd");
|
|
|
11
11
|
|
|
12
12
|
require("./index.less");
|
|
13
13
|
|
|
14
|
+
var _HotAreaConfig = _interopRequireDefault(require("./HotAreaConfig"));
|
|
15
|
+
|
|
14
16
|
var _commonUtil = require("../../../utils/commonUtil");
|
|
15
17
|
|
|
16
18
|
var _coreUtil = require("../../../utils/coreUtil");
|
|
@@ -200,8 +202,7 @@ function (_super) {
|
|
|
200
202
|
function ImageConfig() {
|
|
201
203
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
202
204
|
|
|
203
|
-
_this.onClick = function (event) {
|
|
204
|
-
console.log(event);
|
|
205
|
+
_this.onClick = function (event) {// console.log(event);
|
|
205
206
|
};
|
|
206
207
|
|
|
207
208
|
_this.getImg = function (v) {
|
|
@@ -291,6 +292,10 @@ function (_super) {
|
|
|
291
292
|
_this.selfRender();
|
|
292
293
|
};
|
|
293
294
|
|
|
295
|
+
_this.getSelectedImg = function (data) {
|
|
296
|
+
return (0, _coreUtil.isPc)() ? data.content.pcImgSrc : data.content.h5ImgSrc;
|
|
297
|
+
};
|
|
298
|
+
|
|
294
299
|
return _this;
|
|
295
300
|
}
|
|
296
301
|
|
|
@@ -299,13 +304,17 @@ function (_super) {
|
|
|
299
304
|
|
|
300
305
|
var _a = this.props,
|
|
301
306
|
data = _a.data,
|
|
302
|
-
needHover = _a.needHover;
|
|
307
|
+
needHover = _a.needHover;
|
|
308
|
+
var selectImg = this.getSelectedImg(data);
|
|
303
309
|
|
|
304
310
|
var ContentSetting = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_common.ImagePicker, {
|
|
305
311
|
onChange: function onChange(v) {
|
|
306
312
|
_this.getImg(v);
|
|
307
313
|
},
|
|
308
|
-
value:
|
|
314
|
+
value: selectImg
|
|
315
|
+
}), selectImg && /*#__PURE__*/_react["default"].createElement(_HotAreaConfig["default"], {
|
|
316
|
+
imgUrl: selectImg,
|
|
317
|
+
option: data.content
|
|
309
318
|
}), /*#__PURE__*/_react["default"].createElement(_common.Field, {
|
|
310
319
|
title: "URL"
|
|
311
320
|
}, /*#__PURE__*/_react["default"].createElement(_common.UrlPicker, {
|
|
@@ -219,7 +219,6 @@ var modalSize = _const.size;
|
|
|
219
219
|
var Search = _antd.Input.Search;
|
|
220
220
|
var picAccept = '.gif,.jpg,.png';
|
|
221
221
|
var videoAccept = '.AVI,.mov,.rmvb,.rm,.FLV,.mp4,.3GP';
|
|
222
|
-
var pageSize = 24;
|
|
223
222
|
|
|
224
223
|
function ImageModal(_a) {
|
|
225
224
|
var _this = this;
|
|
@@ -256,29 +255,33 @@ function ImageModal(_a) {
|
|
|
256
255
|
pageIndex = _j[0],
|
|
257
256
|
setPageIndex = _j[1];
|
|
258
257
|
|
|
259
|
-
var _k = (0, _react.useState)(
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
var _k = (0, _react.useState)(20),
|
|
259
|
+
pageSize = _k[0],
|
|
260
|
+
setPageSize = _k[1];
|
|
262
261
|
|
|
263
|
-
var _l = (0, _react.useState)(
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
var _l = (0, _react.useState)(false),
|
|
263
|
+
spinning = _l[0],
|
|
264
|
+
setSpinning = _l[1];
|
|
266
265
|
|
|
267
|
-
var _m = (0, _react.useState)(
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
var _m = (0, _react.useState)(''),
|
|
267
|
+
name = _m[0],
|
|
268
|
+
setName = _m[1];
|
|
270
269
|
|
|
271
|
-
var _o = (0, _react.useState)(
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
var _o = (0, _react.useState)([]),
|
|
271
|
+
contentcatgsList = _o[0],
|
|
272
|
+
setContentcatgsList = _o[1];
|
|
274
273
|
|
|
275
|
-
var _p = (0, _react.useState)(
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
var _p = (0, _react.useState)(''),
|
|
275
|
+
searchValue = _p[0],
|
|
276
|
+
setSearchValue = _p[1];
|
|
278
277
|
|
|
279
|
-
var _q = (0, _react.useState)(
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
var _q = (0, _react.useState)([]),
|
|
279
|
+
expandedKeys = _q[0],
|
|
280
|
+
setExpandedKeys = _q[1];
|
|
281
|
+
|
|
282
|
+
var _r = (0, _react.useState)(true),
|
|
283
|
+
autoExpandParent = _r[0],
|
|
284
|
+
setAutoExpandParent = _r[1]; // const currentUser = sessionUtil.getUser() || {};
|
|
282
285
|
// const { _csrf } = currentUser;
|
|
283
286
|
// const headers = {};
|
|
284
287
|
// if (_csrf && _csrf.headerName) {
|
|
@@ -574,11 +577,13 @@ function ImageModal(_a) {
|
|
|
574
577
|
current: pageIndex,
|
|
575
578
|
pageSize: pageSize,
|
|
576
579
|
total: total,
|
|
577
|
-
onChange: function onChange(
|
|
578
|
-
setPageIndex(
|
|
580
|
+
onChange: function onChange(pageIndex, pageSize) {
|
|
581
|
+
setPageIndex(pageIndex);
|
|
582
|
+
setPageSize(pageSize);
|
|
579
583
|
qryImageContents({
|
|
580
584
|
contentCatgId: selectedKeys[0],
|
|
581
|
-
pageIndex:
|
|
585
|
+
pageIndex: pageIndex,
|
|
586
|
+
pageSize: pageSize
|
|
582
587
|
});
|
|
583
588
|
}
|
|
584
589
|
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.coordinateType = void 0;
|
|
9
|
+
|
|
10
|
+
var _interactjs = _interopRequireDefault(require("interactjs"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _ramda = require("ramda");
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _Icons = require("./Icons");
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var __extends = void 0 && (void 0).__extends || function () {
|
|
27
|
+
var _extendStatics = function extendStatics(d, b) {
|
|
28
|
+
_extendStatics = Object.setPrototypeOf || {
|
|
29
|
+
__proto__: []
|
|
30
|
+
} instanceof Array && function (d, b) {
|
|
31
|
+
d.__proto__ = b;
|
|
32
|
+
} || function (d, b) {
|
|
33
|
+
for (var p in b) {
|
|
34
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return _extendStatics(d, b);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return function (d, b) {
|
|
42
|
+
_extendStatics(d, b);
|
|
43
|
+
|
|
44
|
+
function __() {
|
|
45
|
+
this.constructor = d;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
49
|
+
};
|
|
50
|
+
}();
|
|
51
|
+
|
|
52
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
53
|
+
__assign = Object.assign || function (t) {
|
|
54
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
55
|
+
s = arguments[i];
|
|
56
|
+
|
|
57
|
+
for (var p in s) {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return t;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return __assign.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var Crop =
|
|
69
|
+
/** @class */
|
|
70
|
+
function (_super) {
|
|
71
|
+
__extends(Crop, _super);
|
|
72
|
+
|
|
73
|
+
function Crop() {
|
|
74
|
+
var _this = _super !== null && _super.apply(this, arguments) || this; // shouldComponentUpdate(nextProps) {
|
|
75
|
+
// // reduce uncessary update
|
|
76
|
+
// return !equals(nextProps.coordinate.inputVal, this.state.inputVal)||!equals(nextProps.coordinate, this.props.coordinate)
|
|
77
|
+
// || (nextProps.index !== this.props.index)
|
|
78
|
+
// }
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
_this.handleResizeMove = function (e) {
|
|
82
|
+
var _a = _this.props,
|
|
83
|
+
index = _a.index,
|
|
84
|
+
coordinate = _a.coordinate,
|
|
85
|
+
_b = _a.coordinate,
|
|
86
|
+
x = _b.x,
|
|
87
|
+
y = _b.y,
|
|
88
|
+
coordinates = _a.coordinates,
|
|
89
|
+
onResize = _a.onResize,
|
|
90
|
+
onChange = _a.onChange,
|
|
91
|
+
onSave = _a.onSave;
|
|
92
|
+
var _c = e.rect,
|
|
93
|
+
width = _c.width,
|
|
94
|
+
height = _c.height;
|
|
95
|
+
var _d = e.deltaRect,
|
|
96
|
+
left = _d.left,
|
|
97
|
+
top = _d.top; // console.log(x, left, y, top);
|
|
98
|
+
// if (x + left < 0 || y + top < 0 || x + left + width > 500 || y + top + height > 500) {
|
|
99
|
+
// return;
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
var nextCoordinate = __assign(__assign({}, coordinate), {
|
|
103
|
+
x: x + left,
|
|
104
|
+
y: y + top,
|
|
105
|
+
width: width,
|
|
106
|
+
height: height
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
var nextCoordinates = (0, _ramda.update)(index, nextCoordinate)(coordinates);
|
|
110
|
+
|
|
111
|
+
if ((0, _ramda.is)(Function, onResize)) {
|
|
112
|
+
onResize(nextCoordinate, index, nextCoordinates);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if ((0, _ramda.is)(Function, onChange)) {
|
|
116
|
+
onChange(nextCoordinate, index, nextCoordinates);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
_this.handleDragMove = function (e) {
|
|
121
|
+
var _a = _this.props,
|
|
122
|
+
index = _a.index,
|
|
123
|
+
coordinate = _a.coordinate,
|
|
124
|
+
_b = _a.coordinate,
|
|
125
|
+
x = _b.x,
|
|
126
|
+
y = _b.y,
|
|
127
|
+
coordinates = _a.coordinates,
|
|
128
|
+
onDrag = _a.onDrag,
|
|
129
|
+
onChange = _a.onChange;
|
|
130
|
+
var dx = e.dx,
|
|
131
|
+
dy = e.dy;
|
|
132
|
+
|
|
133
|
+
var nextCoordinate = __assign(__assign({}, coordinate), {
|
|
134
|
+
x: x + dx,
|
|
135
|
+
y: y + dy
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
var nextCoordinates = (0, _ramda.update)(index, nextCoordinate)(coordinates);
|
|
139
|
+
|
|
140
|
+
if ((0, _ramda.is)(Function, onDrag)) {
|
|
141
|
+
onDrag(nextCoordinate, index, nextCoordinates);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if ((0, _ramda.is)(Function, onChange)) {
|
|
145
|
+
onChange(nextCoordinate, index, nextCoordinates);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
_this.handleDelete = function () {
|
|
150
|
+
var _a = _this.props,
|
|
151
|
+
index = _a.index,
|
|
152
|
+
coordinate = _a.coordinate,
|
|
153
|
+
onDelete = _a.onDelete,
|
|
154
|
+
coordinates = _a.coordinates;
|
|
155
|
+
var nextCoordinates = (0, _ramda.remove)(index, 1)(coordinates);
|
|
156
|
+
|
|
157
|
+
if ((0, _ramda.is)(Function, onDelete)) {
|
|
158
|
+
onDelete(coordinate, index, nextCoordinates);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
_this.state = {
|
|
163
|
+
inputVal: _this.props.coordinate && _this.props.coordinate.inputVal || ''
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
_this.handleSave = function () {
|
|
167
|
+
var _a = _this.props,
|
|
168
|
+
coordinate = _a.coordinate,
|
|
169
|
+
_b = _a.coordinate,
|
|
170
|
+
x = _b.x,
|
|
171
|
+
y = _b.y,
|
|
172
|
+
coordinates = _a.coordinates,
|
|
173
|
+
index = _a.index,
|
|
174
|
+
onSave = _a.onSave;
|
|
175
|
+
|
|
176
|
+
var nextCoordinate = __assign(__assign({}, coordinate), {
|
|
177
|
+
x: x,
|
|
178
|
+
y: y,
|
|
179
|
+
inputVal: _this.state.inputVal
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
var nextCoordinates = (0, _ramda.update)(index, nextCoordinate)(coordinates);
|
|
183
|
+
onSave && onSave(coordinate, index, nextCoordinates);
|
|
184
|
+
(0, _interactjs["default"])(_this.crop).unset();
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
return _this;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Crop.prototype.componentDidMount = function () {
|
|
191
|
+
(0, _interactjs["default"])(this.crop).draggable({
|
|
192
|
+
modifiers: [_interactjs["default"].modifiers.restrictRect({
|
|
193
|
+
restriction: 'parent'
|
|
194
|
+
})]
|
|
195
|
+
}).resizable({
|
|
196
|
+
edges: {
|
|
197
|
+
left: true,
|
|
198
|
+
right: true,
|
|
199
|
+
bottom: true,
|
|
200
|
+
top: true
|
|
201
|
+
}
|
|
202
|
+
}).on('dragmove', this.handleDragMove).on('resizemove', this.handleResizeMove);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
Crop.prototype.componentWillUnmount = function () {
|
|
206
|
+
(0, _interactjs["default"])(this.crop).unset();
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
Crop.prototype.render = function () {
|
|
210
|
+
var _this = this;
|
|
211
|
+
|
|
212
|
+
var _a = this.props,
|
|
213
|
+
coordinate = _a.coordinate,
|
|
214
|
+
index = _a.index,
|
|
215
|
+
onSave = _a.onSave;
|
|
216
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
217
|
+
ref: function ref(crop) {
|
|
218
|
+
return _this.crop = crop;
|
|
219
|
+
},
|
|
220
|
+
style: Crop.cropStyle(coordinate)
|
|
221
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icons.NumberIcon, {
|
|
222
|
+
number: index + 1
|
|
223
|
+
}), /*#__PURE__*/_react["default"].createElement(_Icons.DeleteIcon, {
|
|
224
|
+
onClick: this.handleDelete
|
|
225
|
+
}));
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
Crop.cropStyle = function (coordinate) {
|
|
229
|
+
var x = coordinate.x,
|
|
230
|
+
y = coordinate.y,
|
|
231
|
+
width = coordinate.width,
|
|
232
|
+
height = coordinate.height;
|
|
233
|
+
return {
|
|
234
|
+
display: 'inline-block',
|
|
235
|
+
position: 'absolute',
|
|
236
|
+
width: width,
|
|
237
|
+
height: height,
|
|
238
|
+
top: y,
|
|
239
|
+
left: x,
|
|
240
|
+
border: '1px dashed #2F54EB',
|
|
241
|
+
background: 'rgba(47, 84, 235, 0.15)'
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
return Crop;
|
|
246
|
+
}(_react.Component);
|
|
247
|
+
|
|
248
|
+
var coordinateType = _propTypes["default"].shape({
|
|
249
|
+
x: _propTypes["default"].number.isRequired,
|
|
250
|
+
y: _propTypes["default"].number.isRequired,
|
|
251
|
+
width: _propTypes["default"].number.isRequired,
|
|
252
|
+
height: _propTypes["default"].number.isRequired
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
exports.coordinateType = coordinateType;
|
|
256
|
+
Crop.propTypes = {
|
|
257
|
+
coordinate: coordinateType.isRequired,
|
|
258
|
+
index: _propTypes["default"].number.isRequired,
|
|
259
|
+
onResize: _propTypes["default"].func,
|
|
260
|
+
onDrag: _propTypes["default"].func,
|
|
261
|
+
onDelete: _propTypes["default"].func,
|
|
262
|
+
onChange: _propTypes["default"].func,
|
|
263
|
+
coordinates: _propTypes["default"].array,
|
|
264
|
+
onSave: _propTypes["default"].func
|
|
265
|
+
};
|
|
266
|
+
var _default = Crop;
|
|
267
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NumberIcon = exports.DeleteIcon = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
|
|
16
|
+
var DeleteIcon = function DeleteIcon(props) {
|
|
17
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
18
|
+
className: "rmc-icon-container"
|
|
19
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
20
|
+
className: "rmc-remove"
|
|
21
|
+
}), /*#__PURE__*/_react["default"].createElement("style", {
|
|
22
|
+
jsx: "true"
|
|
23
|
+
}, "\n .rmc-icon-container {\n width: 15px;\n height: 15px;\n cursor: pointer;\n float: right;\n background:#2F54EB;\n opacity: 0.8;\n }\n .rmc-remove {\n color: white;\n position: absolute;\n margin-top: 6px;\n }\n\n .rmc-remove:hover {\n cursor: pointer;\n }\n\n .rmc-remove:before {\n content: '';\n position: absolute;\n width: 15px;\n height: 1px;\n background-color: currentColor;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n\n .rmc-remove:after {\n content: '';\n position: absolute;\n width: 15px;\n height: 1px;\n background-color: currentColor;\n -webkit-transform: rotate(-45deg);\n transform: rotate(-45deg);\n }\n "));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.DeleteIcon = DeleteIcon;
|
|
27
|
+
|
|
28
|
+
var NumberIcon = function NumberIcon(_a) {
|
|
29
|
+
var number = _a.number;
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
31
|
+
className: "rmc-number"
|
|
32
|
+
}, number, /*#__PURE__*/_react["default"].createElement("style", {
|
|
33
|
+
jsx: "true"
|
|
34
|
+
}, "\n .rmc-number {\n height: 15px;\n width: 15px;\n float: left;\n font-size: 12px;\n background:#2F54EB;\n text-align: center;\n line-height: 15px;\n color: white;\n opacity: 0.8;\n }\n "));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.NumberIcon = NumberIcon;
|
|
38
|
+
var number = _propTypes["default"].number;
|
|
39
|
+
NumberIcon.propTypes = {
|
|
40
|
+
number: number
|
|
41
|
+
};
|
|
42
|
+
NumberIcon.defaultProps = {
|
|
43
|
+
number: ''
|
|
44
|
+
};
|
package/lib/common/index.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "ImagePicker", {
|
|
|
63
63
|
return _ImagePicker["default"];
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "ImgArea", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _ImgArea["default"];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
Object.defineProperty(exports, "LayoutSelector", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function get() {
|
|
@@ -124,4 +130,6 @@ var _ButtonIconLayout = _interopRequireDefault(require("./ButtonIconLayout"));
|
|
|
124
130
|
|
|
125
131
|
var _ProductSource = _interopRequireDefault(require("./ProductSource"));
|
|
126
132
|
|
|
133
|
+
var _ImgArea = _interopRequireDefault(require("./ImgArea"));
|
|
134
|
+
|
|
127
135
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -43,7 +43,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
43
43
|
text: 'Title use, click modify text.',
|
|
44
44
|
specialContent: [],
|
|
45
45
|
content: {
|
|
46
|
-
|
|
46
|
+
sizeType: 'Customize font styles',
|
|
47
47
|
fontFamily: 'Open Sans',
|
|
48
48
|
fontWeight: 700,
|
|
49
49
|
fontSize: 28,
|
|
@@ -65,7 +65,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
65
65
|
specialContent: [],
|
|
66
66
|
text: 'For the text area, you can enter a subtitle or description, the default width is the same as title.',
|
|
67
67
|
content: {
|
|
68
|
-
|
|
68
|
+
sizeType: 'Customize font styles',
|
|
69
69
|
fontFamily: 'Open Sans',
|
|
70
70
|
fontWeight: 400,
|
|
71
71
|
fontSize: 18,
|
|
@@ -86,7 +86,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
86
86
|
backgroundColor: '#2F54EB'
|
|
87
87
|
},
|
|
88
88
|
buttonText: {
|
|
89
|
-
|
|
89
|
+
sizeType: 'Customize font styles',
|
|
90
90
|
fontFamily: 'Open Sans',
|
|
91
91
|
fontWeight: 600,
|
|
92
92
|
fontSize: 14,
|
|
@@ -122,7 +122,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
122
122
|
backgroundColor: '#0d39ed'
|
|
123
123
|
},
|
|
124
124
|
buttonText: {
|
|
125
|
-
|
|
125
|
+
sizeType: 'Customize font styles',
|
|
126
126
|
fontFamily: 'Open Sans',
|
|
127
127
|
fontWeight: 600,
|
|
128
128
|
fontSize: 14,
|
|
@@ -151,7 +151,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
151
151
|
backgroundColor: '#fff'
|
|
152
152
|
},
|
|
153
153
|
buttonText: {
|
|
154
|
-
|
|
154
|
+
sizeType: 'Customize font styles',
|
|
155
155
|
fontFamily: 'Open Sans',
|
|
156
156
|
fontWeight: 600,
|
|
157
157
|
fontSize: 14,
|
|
@@ -187,7 +187,7 @@ var bannerGroupSourceJSON = function bannerGroupSourceJSON() {
|
|
|
187
187
|
backgroundColor: '#E9F0FF'
|
|
188
188
|
},
|
|
189
189
|
buttonText: {
|
|
190
|
-
|
|
190
|
+
sizeType: 'Customize font styles',
|
|
191
191
|
fontFamily: 'Open Sans',
|
|
192
192
|
fontWeight: 600,
|
|
193
193
|
fontSize: 14,
|
|
@@ -254,12 +254,12 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
254
254
|
pc: {
|
|
255
255
|
paddingTop: 0,
|
|
256
256
|
paddingBottom: 0,
|
|
257
|
-
marginBottom:
|
|
257
|
+
marginBottom: window.magicDesign.compSpacing * 1.5
|
|
258
258
|
},
|
|
259
259
|
mobile: {
|
|
260
260
|
paddingTop: 0,
|
|
261
261
|
paddingBottom: 0,
|
|
262
|
-
marginBottom:
|
|
262
|
+
marginBottom: window.magicDesign.compSpacing
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
};
|