@fonixtree/magic-design 0.0.55 → 0.0.56
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.
|
@@ -0,0 +1,210 @@
|
|
|
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.MultiCrops = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _ramda = require("ramda");
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _shortid = _interopRequireDefault(require("shortid"));
|
|
17
|
+
|
|
18
|
+
var _Crop = _interopRequireWildcard(require("./Crop"));
|
|
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
|
+
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); }
|
|
27
|
+
|
|
28
|
+
var __extends = void 0 && (void 0).__extends || function () {
|
|
29
|
+
var _extendStatics = function extendStatics(d, b) {
|
|
30
|
+
_extendStatics = Object.setPrototypeOf || {
|
|
31
|
+
__proto__: []
|
|
32
|
+
} instanceof Array && function (d, b) {
|
|
33
|
+
d.__proto__ = b;
|
|
34
|
+
} || function (d, b) {
|
|
35
|
+
for (var p in b) {
|
|
36
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return _extendStatics(d, b);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return function (d, b) {
|
|
44
|
+
_extendStatics(d, b);
|
|
45
|
+
|
|
46
|
+
function __() {
|
|
47
|
+
this.constructor = d;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51
|
+
};
|
|
52
|
+
}();
|
|
53
|
+
|
|
54
|
+
var isValidPoint = function isValidPoint(point) {
|
|
55
|
+
if (point === void 0) {
|
|
56
|
+
point = {};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var strictNumber = function strictNumber(number) {
|
|
60
|
+
return (0, _ramda.both)((0, _ramda.is)(Number), (0, _ramda.complement)((0, _ramda.equals)(NaN)))(number);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return strictNumber(point.x) && strictNumber(point.y);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var MultiCrops =
|
|
67
|
+
/** @class */
|
|
68
|
+
function (_super) {
|
|
69
|
+
__extends(MultiCrops, _super);
|
|
70
|
+
|
|
71
|
+
function MultiCrops() {
|
|
72
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
73
|
+
|
|
74
|
+
_this.drawingIndex = -1;
|
|
75
|
+
_this.pointA = {};
|
|
76
|
+
_this.id = _shortid["default"].generate();
|
|
77
|
+
|
|
78
|
+
_this.renderCrops = function (props) {
|
|
79
|
+
var indexedMap = (0, _ramda.addIndex)(_ramda.map);
|
|
80
|
+
return indexedMap(function (coor, index) {
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement(_Crop["default"] // improve performance when delet crop in middle array
|
|
82
|
+
, _extends({
|
|
83
|
+
key: coor.id || index,
|
|
84
|
+
index: index,
|
|
85
|
+
coordinate: coor
|
|
86
|
+
}, props));
|
|
87
|
+
})(props.coordinates);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
_this.getCursorPosition = function (e) {
|
|
91
|
+
var _a = _this.container.getBoundingClientRect(),
|
|
92
|
+
left = _a.left,
|
|
93
|
+
top = _a.top;
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
x: e.clientX - left,
|
|
97
|
+
y: e.clientY - top
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_this.handleMouseDown = function (e) {
|
|
102
|
+
var coordinates = _this.props.coordinates;
|
|
103
|
+
|
|
104
|
+
if (e.target === _this.img || e.target === _this.container) {
|
|
105
|
+
var _a = _this.getCursorPosition(e),
|
|
106
|
+
x = _a.x,
|
|
107
|
+
y = _a.y;
|
|
108
|
+
|
|
109
|
+
_this.drawingIndex = coordinates.length;
|
|
110
|
+
_this.pointA = {
|
|
111
|
+
x: x,
|
|
112
|
+
y: y
|
|
113
|
+
};
|
|
114
|
+
_this.id = _shortid["default"].generate();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
_this.handleMouseMove = function (e) {
|
|
119
|
+
var _a = _this.props,
|
|
120
|
+
onDraw = _a.onDraw,
|
|
121
|
+
onChange = _a.onChange,
|
|
122
|
+
coordinates = _a.coordinates;
|
|
123
|
+
var pointA = _this.pointA;
|
|
124
|
+
|
|
125
|
+
if (isValidPoint(pointA)) {
|
|
126
|
+
var pointB = _this.getCursorPosition(e); // get the drawing coordinate
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
var coordinate = {
|
|
130
|
+
x: Math.min(pointA.x, pointB.x),
|
|
131
|
+
y: Math.min(pointA.y, pointB.y),
|
|
132
|
+
width: Math.abs(pointA.x - pointB.x),
|
|
133
|
+
height: Math.abs(pointA.y - pointB.y),
|
|
134
|
+
id: _this.id
|
|
135
|
+
};
|
|
136
|
+
var nextCoordinates = (0, _ramda.clone)(coordinates);
|
|
137
|
+
nextCoordinates[_this.drawingIndex] = coordinate;
|
|
138
|
+
|
|
139
|
+
if ((0, _ramda.is)(Function, onDraw)) {
|
|
140
|
+
onDraw(coordinate, _this.drawingIndex, nextCoordinates);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if ((0, _ramda.is)(Function, onChange)) {
|
|
144
|
+
onChange(coordinate, _this.drawingIndex, nextCoordinates);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
_this.handlMouseUp = function () {
|
|
150
|
+
_this.pointA = {};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return _this;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
MultiCrops.prototype.render = function () {
|
|
157
|
+
var _this = this;
|
|
158
|
+
|
|
159
|
+
var _a = this.props,
|
|
160
|
+
src = _a.src,
|
|
161
|
+
width = _a.width,
|
|
162
|
+
height = _a.height,
|
|
163
|
+
onLoad = _a.onLoad; // const { clicked } = this.state
|
|
164
|
+
|
|
165
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
|
+
style: {
|
|
167
|
+
display: 'inline-block',
|
|
168
|
+
position: 'relative',
|
|
169
|
+
width: '600px'
|
|
170
|
+
},
|
|
171
|
+
onMouseDown: this.handleMouseDown,
|
|
172
|
+
onMouseMove: this.handleMouseMove,
|
|
173
|
+
onMouseUp: this.handlMouseUp,
|
|
174
|
+
ref: function ref(container) {
|
|
175
|
+
return _this.container = container;
|
|
176
|
+
}
|
|
177
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
178
|
+
ref: function ref(img) {
|
|
179
|
+
return _this.img = img;
|
|
180
|
+
},
|
|
181
|
+
src: src,
|
|
182
|
+
width: width,
|
|
183
|
+
height: height,
|
|
184
|
+
onLoad: onLoad,
|
|
185
|
+
alt: "",
|
|
186
|
+
draggable: false
|
|
187
|
+
}), this.renderCrops(this.props));
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return MultiCrops;
|
|
191
|
+
}(_react.Component);
|
|
192
|
+
|
|
193
|
+
exports.MultiCrops = MultiCrops;
|
|
194
|
+
var string = _propTypes["default"].string,
|
|
195
|
+
arrayOf = _propTypes["default"].arrayOf,
|
|
196
|
+
number = _propTypes["default"].number,
|
|
197
|
+
func = _propTypes["default"].func;
|
|
198
|
+
MultiCrops.propTypes = {
|
|
199
|
+
coordinates: arrayOf(_Crop.coordinateType),
|
|
200
|
+
src: string,
|
|
201
|
+
width: number,
|
|
202
|
+
height: number,
|
|
203
|
+
onDraw: func,
|
|
204
|
+
onChange: func,
|
|
205
|
+
onLoad: func
|
|
206
|
+
};
|
|
207
|
+
MultiCrops.defaultProps = {
|
|
208
|
+
coordinates: [],
|
|
209
|
+
src: ''
|
|
210
|
+
};
|
|
@@ -0,0 +1,210 @@
|
|
|
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.MultiCrops = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _ramda = require("ramda");
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _shortid = _interopRequireDefault(require("shortid"));
|
|
17
|
+
|
|
18
|
+
var _Crop = _interopRequireWildcard(require("./Crop"));
|
|
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
|
+
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); }
|
|
27
|
+
|
|
28
|
+
var __extends = void 0 && (void 0).__extends || function () {
|
|
29
|
+
var _extendStatics = function extendStatics(d, b) {
|
|
30
|
+
_extendStatics = Object.setPrototypeOf || {
|
|
31
|
+
__proto__: []
|
|
32
|
+
} instanceof Array && function (d, b) {
|
|
33
|
+
d.__proto__ = b;
|
|
34
|
+
} || function (d, b) {
|
|
35
|
+
for (var p in b) {
|
|
36
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return _extendStatics(d, b);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return function (d, b) {
|
|
44
|
+
_extendStatics(d, b);
|
|
45
|
+
|
|
46
|
+
function __() {
|
|
47
|
+
this.constructor = d;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51
|
+
};
|
|
52
|
+
}();
|
|
53
|
+
|
|
54
|
+
var isValidPoint = function isValidPoint(point) {
|
|
55
|
+
if (point === void 0) {
|
|
56
|
+
point = {};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var strictNumber = function strictNumber(number) {
|
|
60
|
+
return (0, _ramda.both)((0, _ramda.is)(Number), (0, _ramda.complement)((0, _ramda.equals)(NaN)))(number);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return strictNumber(point.x) && strictNumber(point.y);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var MultiCrops =
|
|
67
|
+
/** @class */
|
|
68
|
+
function (_super) {
|
|
69
|
+
__extends(MultiCrops, _super);
|
|
70
|
+
|
|
71
|
+
function MultiCrops() {
|
|
72
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
73
|
+
|
|
74
|
+
_this.drawingIndex = -1;
|
|
75
|
+
_this.pointA = {};
|
|
76
|
+
_this.id = _shortid["default"].generate();
|
|
77
|
+
|
|
78
|
+
_this.renderCrops = function (props) {
|
|
79
|
+
var indexedMap = (0, _ramda.addIndex)(_ramda.map);
|
|
80
|
+
return indexedMap(function (coor, index) {
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement(_Crop["default"] // improve performance when delet crop in middle array
|
|
82
|
+
, _extends({
|
|
83
|
+
key: coor.id || index,
|
|
84
|
+
index: index,
|
|
85
|
+
coordinate: coor
|
|
86
|
+
}, props));
|
|
87
|
+
})(props.coordinates);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
_this.getCursorPosition = function (e) {
|
|
91
|
+
var _a = _this.container.getBoundingClientRect(),
|
|
92
|
+
left = _a.left,
|
|
93
|
+
top = _a.top;
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
x: e.clientX - left,
|
|
97
|
+
y: e.clientY - top
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_this.handleMouseDown = function (e) {
|
|
102
|
+
var coordinates = _this.props.coordinates;
|
|
103
|
+
|
|
104
|
+
if (e.target === _this.img || e.target === _this.container) {
|
|
105
|
+
var _a = _this.getCursorPosition(e),
|
|
106
|
+
x = _a.x,
|
|
107
|
+
y = _a.y;
|
|
108
|
+
|
|
109
|
+
_this.drawingIndex = coordinates.length;
|
|
110
|
+
_this.pointA = {
|
|
111
|
+
x: x,
|
|
112
|
+
y: y
|
|
113
|
+
};
|
|
114
|
+
_this.id = _shortid["default"].generate();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
_this.handleMouseMove = function (e) {
|
|
119
|
+
var _a = _this.props,
|
|
120
|
+
onDraw = _a.onDraw,
|
|
121
|
+
onChange = _a.onChange,
|
|
122
|
+
coordinates = _a.coordinates;
|
|
123
|
+
var pointA = _this.pointA;
|
|
124
|
+
|
|
125
|
+
if (isValidPoint(pointA)) {
|
|
126
|
+
var pointB = _this.getCursorPosition(e); // get the drawing coordinate
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
var coordinate = {
|
|
130
|
+
x: Math.min(pointA.x, pointB.x),
|
|
131
|
+
y: Math.min(pointA.y, pointB.y),
|
|
132
|
+
width: Math.abs(pointA.x - pointB.x),
|
|
133
|
+
height: Math.abs(pointA.y - pointB.y),
|
|
134
|
+
id: _this.id
|
|
135
|
+
};
|
|
136
|
+
var nextCoordinates = (0, _ramda.clone)(coordinates);
|
|
137
|
+
nextCoordinates[_this.drawingIndex] = coordinate;
|
|
138
|
+
|
|
139
|
+
if ((0, _ramda.is)(Function, onDraw)) {
|
|
140
|
+
onDraw(coordinate, _this.drawingIndex, nextCoordinates);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if ((0, _ramda.is)(Function, onChange)) {
|
|
144
|
+
onChange(coordinate, _this.drawingIndex, nextCoordinates);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
_this.handlMouseUp = function () {
|
|
150
|
+
_this.pointA = {};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return _this;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
MultiCrops.prototype.render = function () {
|
|
157
|
+
var _this = this;
|
|
158
|
+
|
|
159
|
+
var _a = this.props,
|
|
160
|
+
src = _a.src,
|
|
161
|
+
width = _a.width,
|
|
162
|
+
height = _a.height,
|
|
163
|
+
onLoad = _a.onLoad; // const { clicked } = this.state
|
|
164
|
+
|
|
165
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
|
+
style: {
|
|
167
|
+
display: 'inline-block',
|
|
168
|
+
position: 'relative',
|
|
169
|
+
width: '600px'
|
|
170
|
+
},
|
|
171
|
+
onMouseDown: this.handleMouseDown,
|
|
172
|
+
onMouseMove: this.handleMouseMove,
|
|
173
|
+
onMouseUp: this.handlMouseUp,
|
|
174
|
+
ref: function ref(container) {
|
|
175
|
+
return _this.container = container;
|
|
176
|
+
}
|
|
177
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
178
|
+
ref: function ref(img) {
|
|
179
|
+
return _this.img = img;
|
|
180
|
+
},
|
|
181
|
+
src: src,
|
|
182
|
+
width: width,
|
|
183
|
+
height: height,
|
|
184
|
+
onLoad: onLoad,
|
|
185
|
+
alt: "",
|
|
186
|
+
draggable: false
|
|
187
|
+
}), this.renderCrops(this.props));
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return MultiCrops;
|
|
191
|
+
}(_react.Component);
|
|
192
|
+
|
|
193
|
+
exports.MultiCrops = MultiCrops;
|
|
194
|
+
var string = _propTypes["default"].string,
|
|
195
|
+
arrayOf = _propTypes["default"].arrayOf,
|
|
196
|
+
number = _propTypes["default"].number,
|
|
197
|
+
func = _propTypes["default"].func;
|
|
198
|
+
MultiCrops.propTypes = {
|
|
199
|
+
coordinates: arrayOf(_Crop.coordinateType),
|
|
200
|
+
src: string,
|
|
201
|
+
width: number,
|
|
202
|
+
height: number,
|
|
203
|
+
onDraw: func,
|
|
204
|
+
onChange: func,
|
|
205
|
+
onLoad: func
|
|
206
|
+
};
|
|
207
|
+
MultiCrops.defaultProps = {
|
|
208
|
+
coordinates: [],
|
|
209
|
+
src: ''
|
|
210
|
+
};
|
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.
|
|
4
|
+
"version": "0.0.56",
|
|
5
5
|
"description": "Magic Design",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -36,91 +36,6 @@
|
|
|
36
36
|
"shortid": "^2.2.16",
|
|
37
37
|
"slick-carousel": "^1.8.1"
|
|
38
38
|
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@babel/core": "^7.16.0",
|
|
41
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
|
|
42
|
-
"@rollup/plugin-babel": "^5.3.1",
|
|
43
|
-
"@rollup/plugin-commonjs": "^22.0.0",
|
|
44
|
-
"@rollup/plugin-image": "^2.1.1",
|
|
45
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
46
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
47
|
-
"@svgr/webpack": "^5.5.0",
|
|
48
|
-
"@types/axios": "^0.14.0",
|
|
49
|
-
"@types/lodash": "^4.14.182",
|
|
50
|
-
"@types/node": "^17.0.36",
|
|
51
|
-
"@types/react": "^18.0.9",
|
|
52
|
-
"@types/react-color": "^3.0.6",
|
|
53
|
-
"@types/react-dom": "^18.0.5",
|
|
54
|
-
"@types/uuid": "^8.3.4",
|
|
55
|
-
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
56
|
-
"add": "^2.0.6",
|
|
57
|
-
"babel-loader": "^8.2.3",
|
|
58
|
-
"babel-plugin-named-asset-import": "^0.3.8",
|
|
59
|
-
"babel-preset-react-app": "^10.0.1",
|
|
60
|
-
"bfj": "^7.0.2",
|
|
61
|
-
"browserslist": "^4.18.1",
|
|
62
|
-
"camelcase": "^6.2.1",
|
|
63
|
-
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
64
|
-
"child_process": "^1.0.2",
|
|
65
|
-
"classnames": "^2.3.1",
|
|
66
|
-
"css-loader": "^6.5.1",
|
|
67
|
-
"css-minimizer-webpack-plugin": "^3.2.0",
|
|
68
|
-
"dotenv": "^10.0.0",
|
|
69
|
-
"dotenv-expand": "^5.1.0",
|
|
70
|
-
"eslint": "7",
|
|
71
|
-
"eslint-config-next": "^12.1.6",
|
|
72
|
-
"eslint-config-react-app": "^7.0.1",
|
|
73
|
-
"eslint-webpack-plugin": "^3.1.1",
|
|
74
|
-
"extract-zip": "^2.0.1",
|
|
75
|
-
"file-loader": "^6.2.0",
|
|
76
|
-
"fs-extra": "^10.0.0",
|
|
77
|
-
"gulp": "4.0.2",
|
|
78
|
-
"gulp-less": "5.0.0",
|
|
79
|
-
"gulp-postcss": "9.0.1",
|
|
80
|
-
"gulp-rename": "2.0.0",
|
|
81
|
-
"html-webpack-plugin": "^5.5.0",
|
|
82
|
-
"http-proxy-middleware": "^2.0.6",
|
|
83
|
-
"identity-obj-proxy": "^3.0.0",
|
|
84
|
-
"less": "3.13.1",
|
|
85
|
-
"less-loader": "^11.0.0",
|
|
86
|
-
"mini-css-extract-plugin": "^2.4.5",
|
|
87
|
-
"mv": "^2.1.1",
|
|
88
|
-
"ora": "^4.1.1",
|
|
89
|
-
"postcss": "^8.4.4",
|
|
90
|
-
"postcss-flexbugs-fixes": "^5.0.2",
|
|
91
|
-
"postcss-less": "6.0.0",
|
|
92
|
-
"postcss-loader": "^6.2.1",
|
|
93
|
-
"postcss-normalize": "^10.0.1",
|
|
94
|
-
"postcss-preset-env": "^7.0.1",
|
|
95
|
-
"postcss-px-to-viewport": "^1.1.1",
|
|
96
|
-
"postcss-selector-namespace": "^3.0.1",
|
|
97
|
-
"prompts": "^2.4.2",
|
|
98
|
-
"rc-tools": "^9.6.1-alpha.1",
|
|
99
|
-
"react": "^16.11.0",
|
|
100
|
-
"react-app-polyfill": "^3.0.0",
|
|
101
|
-
"react-dev-utils": "^12.0.1",
|
|
102
|
-
"react-dom": "^16.11.0",
|
|
103
|
-
"react-refresh": "^0.11.0",
|
|
104
|
-
"resolve": "^1.20.0",
|
|
105
|
-
"resolve-url-loader": "^4.0.0",
|
|
106
|
-
"rollup-plugin-dts": "^4.2.2",
|
|
107
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
108
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
109
|
-
"rollup-plugin-styles": "^4.0.0",
|
|
110
|
-
"rollup-plugin-typescript2": "^0.32.1",
|
|
111
|
-
"sass-loader": "^12.3.0",
|
|
112
|
-
"semver": "^7.3.5",
|
|
113
|
-
"source-map-loader": "^3.0.0",
|
|
114
|
-
"style-loader": "^3.3.1",
|
|
115
|
-
"tailwindcss": "^3.0.2",
|
|
116
|
-
"terser-webpack-plugin": "^5.2.5",
|
|
117
|
-
"typescript": "^4.7.2",
|
|
118
|
-
"web-vitals": "^2.1.4",
|
|
119
|
-
"webpack": "^5.64.4",
|
|
120
|
-
"webpack-dev-server": "^4.6.0",
|
|
121
|
-
"webpack-manifest-plugin": "^4.0.2",
|
|
122
|
-
"workbox-webpack-plugin": "^6.4.1"
|
|
123
|
-
},
|
|
124
39
|
"peerDependencies": {
|
|
125
40
|
"react": ">=16.11.0",
|
|
126
41
|
"react-dom": ">=16.11.0"
|
package/README.md
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
# 快捷指令使用
|
|
2
|
-
|
|
3
|
-
## 1、发布 -- npm run pub
|
|
4
|
-
|
|
5
|
-
## 2、新增国际化 -- npm run cl "Hello world"
|
|
6
|
-
|
|
7
|
-
## 3、更新iconfont -- npm run iconfont
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# 设计器二期
|
|
11
|
-
|
|
12
|
-
## 1、基本概念
|
|
13
|
-
|
|
14
|
-
### 1.1、元组件:构成复合组件的最小单位
|
|
15
|
-
|
|
16
|
-
Text、Image、Button、Divider、Video 等
|
|
17
|
-
|
|
18
|
-
### 1.2、复合组件:由若干个元组件构成的一个大组件
|
|
19
|
-
|
|
20
|
-
Text、Banner、Image Gallery、Image and Text、Carousel、Reward、Newsletter 等
|
|
21
|
-
|
|
22
|
-
### 1.3、业务公共组件:项目中复用的公共组件
|
|
23
|
-
|
|
24
|
-
所有的公共组件需要开放 value 和 onChange Api(除 Button、Iconfont)
|
|
25
|
-
|
|
26
|
-
Button、Iconfont、AlignSelecter、Collapse、ColorPicker、ImagePicker、LayoutSelecter、Slider、UrlPicker
|
|
27
|
-
|
|
28
|
-
## 2、元组件
|
|
29
|
-
|
|
30
|
-
### 2.1
|
|
31
|
-
|
|
32
|
-
元组件类型:
|
|
33
|
-
|
|
34
|
-
TEXT、IMAGE、BUTTON、DIVIDER、VIDEO
|
|
35
|
-
|
|
36
|
-
元组件报文格式:
|
|
37
|
-
|
|
38
|
-
```json
|
|
39
|
-
{
|
|
40
|
-
id:'xxxx' //元组件key
|
|
41
|
-
type: 'TYPE', //元组件类型
|
|
42
|
-
style:{
|
|
43
|
-
fontFamily:'xxx', //字体
|
|
44
|
-
...css //属性名称尽量使用标准css名称
|
|
45
|
-
},
|
|
46
|
-
hoverStyle:{
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
动态设置 hover 效果
|
|
53
|
-
|
|
54
|
-
onMouseEnter={e => { e.target.style.color = 'red'; }}
|
|
55
|
-
|
|
56
|
-
onMouseLeave={e => { e.target.style.color = 'white'; }}
|
|
57
|
-
|
|
58
|
-
文本可编辑
|
|
59
|
-
|
|
60
|
-
contenteditable="true"
|
|
61
|
-
|
|
62
|
-
### 2.2 、元组件报文
|
|
63
|
-
|
|
64
|
-
#### Text
|
|
65
|
-
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
id:'xxxx' //元组件key
|
|
69
|
-
type: 'TYPE', //元组件类型
|
|
70
|
-
content:'this is text',
|
|
71
|
-
style:{
|
|
72
|
-
fontFamily:'xxx', //字体
|
|
73
|
-
fontSize: '14px',
|
|
74
|
-
width: '200px',
|
|
75
|
-
...css
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### Image
|
|
81
|
-
|
|
82
|
-
```json
|
|
83
|
-
{
|
|
84
|
-
id:'xxxx' //元组件key
|
|
85
|
-
type: 'IMAGE', //元组件类型
|
|
86
|
-
name:'123.png',
|
|
87
|
-
src:'../image.png', //图片地址
|
|
88
|
-
url:'www.baidu.com', //图片跳转地址
|
|
89
|
-
style:{
|
|
90
|
-
width: '200px',
|
|
91
|
-
...css
|
|
92
|
-
},
|
|
93
|
-
hoverStyle:{ //hover 类型为new时保存src,类型为enlarge时保存scale
|
|
94
|
-
scale: '2',
|
|
95
|
-
src:'../image1.png',
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### Button
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
id:'xxxx' //元组件key
|
|
105
|
-
type: 'BUTTON', //元组件类型
|
|
106
|
-
name:'Submit',
|
|
107
|
-
url: 'www.baidu.com',
|
|
108
|
-
style:{
|
|
109
|
-
buttonIconSrc:'../img.png',
|
|
110
|
-
buttonIconPlace: 'left',
|
|
111
|
-
color:'#FEFEFE',
|
|
112
|
-
border: '1px solid red',
|
|
113
|
-
borderRadius:'10px',
|
|
114
|
-
fontFamily:'xxx', //字体
|
|
115
|
-
fontSize: '14px',
|
|
116
|
-
...css
|
|
117
|
-
},
|
|
118
|
-
hoverStyle {
|
|
119
|
-
color:'#FEFEFE',
|
|
120
|
-
border: '1px solid red',
|
|
121
|
-
fontFamily:'xxx', //字体
|
|
122
|
-
fontSize: '14px',
|
|
123
|
-
...css
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## 2、复合组件
|
|
129
|
-
|
|
130
|
-
### 2.1
|
|
131
|
-
|
|
132
|
-
元组件类型:
|
|
133
|
-
|
|
134
|
-
TEXT、BANNER、IMAGE_GALLERT、IMAGE_TEXT、CAROUSEL、REWARD、NEWSLETTER
|
|
135
|
-
|
|
136
|
-
复合组件报文格式:
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
id:'xxxx' //复合组件key
|
|
141
|
-
type: 'TYPE', //复合组件类型
|
|
142
|
-
setting:{ //开关类型的配置及属性配置放在这里
|
|
143
|
-
autoplays: 3, //3秒轮播
|
|
144
|
-
},
|
|
145
|
-
groupSource:[], //元组件集合组数据放在这里
|
|
146
|
-
metas:{
|
|
147
|
-
title:{
|
|
148
|
-
open:false,
|
|
149
|
-
type:'IMAGE'
|
|
150
|
-
...metaCompJson
|
|
151
|
-
},
|
|
152
|
-
subTitle:{
|
|
153
|
-
open:false,
|
|
154
|
-
type:'IMAGE'
|
|
155
|
-
...metaCompJson
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
customize:{
|
|
159
|
-
layout:'',
|
|
160
|
-
background:{
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### Text
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
{
|
|
171
|
-
id: 'xxxx', //复合组件key
|
|
172
|
-
type: 'TEXT', //复合组件类型
|
|
173
|
-
setting:{
|
|
174
|
-
layout:'left', // 模块布局 left/center/right ,每一个layout可能都是一个不同的组件
|
|
175
|
-
title:{
|
|
176
|
-
type:'TEXT'
|
|
177
|
-
...metaCompJson
|
|
178
|
-
},
|
|
179
|
-
subtitle:{
|
|
180
|
-
type:'TEXT'
|
|
181
|
-
...metaCompJson
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
source:[
|
|
185
|
-
{ //此处可以抽出业务组件
|
|
186
|
-
title:{
|
|
187
|
-
type:'TEXT'
|
|
188
|
-
...metaCompJson
|
|
189
|
-
},
|
|
190
|
-
content:{
|
|
191
|
-
type:'TEXT'
|
|
192
|
-
...metaCompJson
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
],
|
|
196
|
-
style:{
|
|
197
|
-
align:'left', //文本布局 left/center/right
|
|
198
|
-
backgroundColor: 'red',
|
|
199
|
-
backgroundImage:'../image.png'
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### Banner
|
|
205
|
-
|
|
206
|
-
modifySetting
|
|
207
|
-
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"comositeId": "1111",
|
|
211
|
-
|
|
212
|
-
"value": {
|
|
213
|
-
"autoplays": 4
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
```json
|
|
219
|
-
{
|
|
220
|
-
id: 'xxxx',
|
|
221
|
-
type: 'BANNER',
|
|
222
|
-
setting:{
|
|
223
|
-
open:false
|
|
224
|
-
autoplays: 3, //3秒轮播
|
|
225
|
-
arrows:{ // 滚动箭头
|
|
226
|
-
open:false,
|
|
227
|
-
color:'red',
|
|
228
|
-
size:'',
|
|
229
|
-
hoverSize:'',
|
|
230
|
-
hoverColor:'green',
|
|
231
|
-
},
|
|
232
|
-
dots:{ //面板指示点
|
|
233
|
-
open:false,
|
|
234
|
-
color: 'red',
|
|
235
|
-
size:'',
|
|
236
|
-
hoverSize:''
|
|
237
|
-
hoverColor:'green',
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
groupSource:[
|
|
241
|
-
{ //此处可以作为一个业务组件
|
|
242
|
-
id:'xxxxx',
|
|
243
|
-
image:{
|
|
244
|
-
open:false,
|
|
245
|
-
type:'IMAGE'
|
|
246
|
-
...metaCompJson
|
|
247
|
-
},
|
|
248
|
-
title:{
|
|
249
|
-
open:false,
|
|
250
|
-
type:'TEXT',
|
|
251
|
-
...metaCompJson
|
|
252
|
-
},
|
|
253
|
-
content:{
|
|
254
|
-
open:false,
|
|
255
|
-
type:'TEXT',
|
|
256
|
-
...metaCompJson
|
|
257
|
-
},
|
|
258
|
-
button:{
|
|
259
|
-
type:'BUTTON',
|
|
260
|
-
...metaCompJson
|
|
261
|
-
},
|
|
262
|
-
secondaryButton:{
|
|
263
|
-
type:'BUTTON',
|
|
264
|
-
...metaCompJson
|
|
265
|
-
},
|
|
266
|
-
layout:'center',
|
|
267
|
-
align:'left',
|
|
268
|
-
//文本布局 left/center/right
|
|
269
|
-
}
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
#### Image Gallery
|
|
275
|
-
|
|
276
|
-
```json
|
|
277
|
-
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
#### Image and Text
|
|
281
|
-
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
id:'xxxx'
|
|
285
|
-
type: 'IMAGE_TEXT',
|
|
286
|
-
setting:{
|
|
287
|
-
layout:'left',
|
|
288
|
-
title:{},
|
|
289
|
-
subtitle:{},
|
|
290
|
-
button:{},
|
|
291
|
-
secondaryButton:{}
|
|
292
|
-
},
|
|
293
|
-
source:[
|
|
294
|
-
|
|
295
|
-
],
|
|
296
|
-
style:{
|
|
297
|
-
align:'left',
|
|
298
|
-
backgroundColor:'red',
|
|
299
|
-
backgroundImage:'./img.png'
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
疑问:
|
|
305
|
-
|
|
306
|
-
Text 元组件
|
|
307
|
-
|
|
308
|
-
文字链接配置好之后,怎么删除
|
|
309
|
-
|
|
310
|
-
链接配置的规则,按单词还是字符
|
|
311
|
-
|
|
312
|
-
image 元组件
|
|
313
|
-
|
|
314
|
-
属性控制进度条和输入框是否要限制最大最小值
|
|
315
|
-
|
|
316
|
-
button 元组件
|
|
317
|
-
|
|
318
|
-
是否需要 icon 的 hover 效果
|
|
319
|
-
|
|
320
|
-
banner 中的 text Align 放在元组件里?
|