@m4l/components 0.0.0 → 0.0.3
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/dist/commonjs.js +5 -0
- package/dist/components/FormActions/index.d.ts +3 -0
- package/dist/components/FormActions/index.js +41 -0
- package/dist/components/FormActions/styles.d.ts +2 -0
- package/dist/components/FormActions/types.d.ts +7 -0
- package/dist/components/ModalDialog/components/Header/index.d.ts +3 -0
- package/dist/components/ModalDialog/components/Header/types.d.ts +9 -0
- package/dist/components/ModalDialog/index.d.ts +2 -0
- package/dist/components/ModalDialog/index.js +174 -0
- package/dist/components/ModalDialog/styles.d.ts +9 -0
- package/dist/components/ModalDialog/types.d.ts +5 -0
- package/dist/components/Resizeable/index.d.ts +3 -0
- package/dist/components/Resizeable/index.js +92 -0
- package/dist/components/Resizeable/styles.d.ts +5 -0
- package/dist/components/Resizeable/types.d.ts +8 -0
- package/dist/components/SplitLayout/index.d.ts +3 -0
- package/dist/components/SplitLayout/index.js +130 -0
- package/dist/components/SplitLayout/styles.d.ts +4 -0
- package/dist/components/SplitLayout/types.d.ts +9 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/mui_extended/MenuActions/styles.d.ts +2 -2
- package/dist/contexts/ModalContext/components/ContentConfirm/index.d.ts +3 -0
- package/dist/contexts/ModalContext/components/ContentConfirm/styles.d.ts +6 -0
- package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +8 -0
- package/dist/contexts/ModalContext/index.d.ts +5 -0
- package/dist/contexts/ModalContext/index.js +162 -0
- package/dist/contexts/ModalContext/types.d.ts +42 -0
- package/dist/contexts/index.d.ts +2 -0
- package/dist/hooks/useModal/index.d.ts +1 -0
- package/dist/hooks/useModal/index.js +4 -0
- package/dist/hooks/useResponsive.d.ts +8 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +22 -6
- package/dist/prop-types.js +1 -0
- package/dist/react-draggable.js +1435 -0
- package/dist/react-resizable.js +594 -0
- package/dist/react-splitter-layout.js +165 -0
- package/dist/react.js +2 -0
- package/dist/vendor.js +44 -0
- package/package.json +11 -2
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
import require$$0 from "react";
|
|
2
|
+
import { c as cjs } from "./react-draggable.js";
|
|
3
|
+
import require$$1 from "prop-types";
|
|
4
|
+
var reactResizable = { exports: {} };
|
|
5
|
+
var Resizable$1 = {};
|
|
6
|
+
var utils = {};
|
|
7
|
+
utils.__esModule = true;
|
|
8
|
+
utils.cloneElement = cloneElement;
|
|
9
|
+
var _react = _interopRequireDefault$2(require$$0);
|
|
10
|
+
function _interopRequireDefault$2(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
12
|
+
}
|
|
13
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
14
|
+
var keys = Object.keys(object);
|
|
15
|
+
if (Object.getOwnPropertySymbols) {
|
|
16
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
17
|
+
if (enumerableOnly) {
|
|
18
|
+
symbols = symbols.filter(function(sym) {
|
|
19
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
keys.push.apply(keys, symbols);
|
|
23
|
+
}
|
|
24
|
+
return keys;
|
|
25
|
+
}
|
|
26
|
+
function _objectSpread$2(target) {
|
|
27
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
29
|
+
if (i % 2) {
|
|
30
|
+
ownKeys$2(Object(source), true).forEach(function(key) {
|
|
31
|
+
_defineProperty$2(target, key, source[key]);
|
|
32
|
+
});
|
|
33
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
34
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
35
|
+
} else {
|
|
36
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
37
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
43
|
+
function _defineProperty$2(obj, key, value) {
|
|
44
|
+
if (key in obj) {
|
|
45
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
function cloneElement(element, props) {
|
|
52
|
+
if (props.style && element.props.style) {
|
|
53
|
+
props.style = _objectSpread$2(_objectSpread$2({}, element.props.style), props.style);
|
|
54
|
+
}
|
|
55
|
+
if (props.className && element.props.className) {
|
|
56
|
+
props.className = element.props.className + " " + props.className;
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ _react.default.cloneElement(element, props);
|
|
59
|
+
}
|
|
60
|
+
var propTypes = {};
|
|
61
|
+
propTypes.__esModule = true;
|
|
62
|
+
propTypes.resizableProps = void 0;
|
|
63
|
+
var _propTypes$2 = _interopRequireDefault$1(require$$1);
|
|
64
|
+
function _interopRequireDefault$1(obj) {
|
|
65
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
66
|
+
}
|
|
67
|
+
var resizableProps = {
|
|
68
|
+
axis: _propTypes$2.default.oneOf(["both", "x", "y", "none"]),
|
|
69
|
+
className: _propTypes$2.default.string,
|
|
70
|
+
children: _propTypes$2.default.element.isRequired,
|
|
71
|
+
draggableOpts: _propTypes$2.default.shape({
|
|
72
|
+
allowAnyClick: _propTypes$2.default.bool,
|
|
73
|
+
cancel: _propTypes$2.default.string,
|
|
74
|
+
children: _propTypes$2.default.node,
|
|
75
|
+
disabled: _propTypes$2.default.bool,
|
|
76
|
+
enableUserSelectHack: _propTypes$2.default.bool,
|
|
77
|
+
offsetParent: _propTypes$2.default.node,
|
|
78
|
+
grid: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
79
|
+
handle: _propTypes$2.default.string,
|
|
80
|
+
nodeRef: _propTypes$2.default.object,
|
|
81
|
+
onStart: _propTypes$2.default.func,
|
|
82
|
+
onDrag: _propTypes$2.default.func,
|
|
83
|
+
onStop: _propTypes$2.default.func,
|
|
84
|
+
onMouseDown: _propTypes$2.default.func,
|
|
85
|
+
scale: _propTypes$2.default.number
|
|
86
|
+
}),
|
|
87
|
+
height: _propTypes$2.default.number.isRequired,
|
|
88
|
+
handle: _propTypes$2.default.oneOfType([_propTypes$2.default.node, _propTypes$2.default.func]),
|
|
89
|
+
handleSize: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
90
|
+
lockAspectRatio: _propTypes$2.default.bool,
|
|
91
|
+
maxConstraints: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
92
|
+
minConstraints: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
93
|
+
onResizeStop: _propTypes$2.default.func,
|
|
94
|
+
onResizeStart: _propTypes$2.default.func,
|
|
95
|
+
onResize: _propTypes$2.default.func,
|
|
96
|
+
resizeHandles: _propTypes$2.default.arrayOf(_propTypes$2.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])),
|
|
97
|
+
transformScale: _propTypes$2.default.number,
|
|
98
|
+
width: _propTypes$2.default.number.isRequired
|
|
99
|
+
};
|
|
100
|
+
propTypes.resizableProps = resizableProps;
|
|
101
|
+
Resizable$1.__esModule = true;
|
|
102
|
+
Resizable$1.default = void 0;
|
|
103
|
+
var React$1 = _interopRequireWildcard$1(require$$0);
|
|
104
|
+
var _reactDraggable = cjs.exports;
|
|
105
|
+
var _utils = utils;
|
|
106
|
+
var _propTypes$1 = propTypes;
|
|
107
|
+
var _excluded$1 = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
|
|
108
|
+
function _getRequireWildcardCache$1(nodeInterop) {
|
|
109
|
+
if (typeof WeakMap !== "function")
|
|
110
|
+
return null;
|
|
111
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
112
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
113
|
+
return (_getRequireWildcardCache$1 = function _getRequireWildcardCache2(nodeInterop2) {
|
|
114
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
115
|
+
})(nodeInterop);
|
|
116
|
+
}
|
|
117
|
+
function _interopRequireWildcard$1(obj, nodeInterop) {
|
|
118
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
122
|
+
return { default: obj };
|
|
123
|
+
}
|
|
124
|
+
var cache = _getRequireWildcardCache$1(nodeInterop);
|
|
125
|
+
if (cache && cache.has(obj)) {
|
|
126
|
+
return cache.get(obj);
|
|
127
|
+
}
|
|
128
|
+
var newObj = {};
|
|
129
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
130
|
+
for (var key in obj) {
|
|
131
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
132
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
133
|
+
if (desc && (desc.get || desc.set)) {
|
|
134
|
+
Object.defineProperty(newObj, key, desc);
|
|
135
|
+
} else {
|
|
136
|
+
newObj[key] = obj[key];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
newObj.default = obj;
|
|
141
|
+
if (cache) {
|
|
142
|
+
cache.set(obj, newObj);
|
|
143
|
+
}
|
|
144
|
+
return newObj;
|
|
145
|
+
}
|
|
146
|
+
function _extends$1() {
|
|
147
|
+
_extends$1 = Object.assign || function(target) {
|
|
148
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
149
|
+
var source = arguments[i];
|
|
150
|
+
for (var key in source) {
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
152
|
+
target[key] = source[key];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return target;
|
|
157
|
+
};
|
|
158
|
+
return _extends$1.apply(this, arguments);
|
|
159
|
+
}
|
|
160
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
161
|
+
if (source == null)
|
|
162
|
+
return {};
|
|
163
|
+
var target = {};
|
|
164
|
+
var sourceKeys = Object.keys(source);
|
|
165
|
+
var key, i;
|
|
166
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
167
|
+
key = sourceKeys[i];
|
|
168
|
+
if (excluded.indexOf(key) >= 0)
|
|
169
|
+
continue;
|
|
170
|
+
target[key] = source[key];
|
|
171
|
+
}
|
|
172
|
+
return target;
|
|
173
|
+
}
|
|
174
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
175
|
+
var keys = Object.keys(object);
|
|
176
|
+
if (Object.getOwnPropertySymbols) {
|
|
177
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
178
|
+
if (enumerableOnly) {
|
|
179
|
+
symbols = symbols.filter(function(sym) {
|
|
180
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
keys.push.apply(keys, symbols);
|
|
184
|
+
}
|
|
185
|
+
return keys;
|
|
186
|
+
}
|
|
187
|
+
function _objectSpread$1(target) {
|
|
188
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
189
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
190
|
+
if (i % 2) {
|
|
191
|
+
ownKeys$1(Object(source), true).forEach(function(key) {
|
|
192
|
+
_defineProperty$1(target, key, source[key]);
|
|
193
|
+
});
|
|
194
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
195
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
196
|
+
} else {
|
|
197
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
198
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return target;
|
|
203
|
+
}
|
|
204
|
+
function _defineProperty$1(obj, key, value) {
|
|
205
|
+
if (key in obj) {
|
|
206
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
207
|
+
} else {
|
|
208
|
+
obj[key] = value;
|
|
209
|
+
}
|
|
210
|
+
return obj;
|
|
211
|
+
}
|
|
212
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
213
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
214
|
+
subClass.prototype.constructor = subClass;
|
|
215
|
+
_setPrototypeOf$1(subClass, superClass);
|
|
216
|
+
}
|
|
217
|
+
function _setPrototypeOf$1(o, p) {
|
|
218
|
+
_setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
219
|
+
o2.__proto__ = p2;
|
|
220
|
+
return o2;
|
|
221
|
+
};
|
|
222
|
+
return _setPrototypeOf$1(o, p);
|
|
223
|
+
}
|
|
224
|
+
var Resizable = /* @__PURE__ */ function(_React$Component) {
|
|
225
|
+
_inheritsLoose$1(Resizable2, _React$Component);
|
|
226
|
+
function Resizable2() {
|
|
227
|
+
var _this;
|
|
228
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
229
|
+
args[_key] = arguments[_key];
|
|
230
|
+
}
|
|
231
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
232
|
+
_this.handleRefs = {};
|
|
233
|
+
_this.lastHandleRect = null;
|
|
234
|
+
_this.slack = null;
|
|
235
|
+
return _this;
|
|
236
|
+
}
|
|
237
|
+
var _proto = Resizable2.prototype;
|
|
238
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
239
|
+
this.resetData();
|
|
240
|
+
};
|
|
241
|
+
_proto.resetData = function resetData() {
|
|
242
|
+
this.lastHandleRect = this.slack = null;
|
|
243
|
+
};
|
|
244
|
+
_proto.runConstraints = function runConstraints(width, height) {
|
|
245
|
+
var _this$props = this.props, minConstraints = _this$props.minConstraints, maxConstraints = _this$props.maxConstraints, lockAspectRatio = _this$props.lockAspectRatio;
|
|
246
|
+
if (!minConstraints && !maxConstraints && !lockAspectRatio)
|
|
247
|
+
return [width, height];
|
|
248
|
+
if (lockAspectRatio) {
|
|
249
|
+
var ratio = this.props.width / this.props.height;
|
|
250
|
+
var deltaW = width - this.props.width;
|
|
251
|
+
var deltaH = height - this.props.height;
|
|
252
|
+
if (Math.abs(deltaW) > Math.abs(deltaH * ratio)) {
|
|
253
|
+
height = width / ratio;
|
|
254
|
+
} else {
|
|
255
|
+
width = height * ratio;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
var oldW = width, oldH = height;
|
|
259
|
+
var _ref = this.slack || [0, 0], slackW = _ref[0], slackH = _ref[1];
|
|
260
|
+
width += slackW;
|
|
261
|
+
height += slackH;
|
|
262
|
+
if (minConstraints) {
|
|
263
|
+
width = Math.max(minConstraints[0], width);
|
|
264
|
+
height = Math.max(minConstraints[1], height);
|
|
265
|
+
}
|
|
266
|
+
if (maxConstraints) {
|
|
267
|
+
width = Math.min(maxConstraints[0], width);
|
|
268
|
+
height = Math.min(maxConstraints[1], height);
|
|
269
|
+
}
|
|
270
|
+
this.slack = [slackW + (oldW - width), slackH + (oldH - height)];
|
|
271
|
+
return [width, height];
|
|
272
|
+
};
|
|
273
|
+
_proto.resizeHandler = function resizeHandler(handlerName, axis) {
|
|
274
|
+
var _this2 = this;
|
|
275
|
+
return function(e, _ref2) {
|
|
276
|
+
var node = _ref2.node, deltaX = _ref2.deltaX, deltaY = _ref2.deltaY;
|
|
277
|
+
if (handlerName === "onResizeStart")
|
|
278
|
+
_this2.resetData();
|
|
279
|
+
var canDragX = (_this2.props.axis === "both" || _this2.props.axis === "x") && axis !== "n" && axis !== "s";
|
|
280
|
+
var canDragY = (_this2.props.axis === "both" || _this2.props.axis === "y") && axis !== "e" && axis !== "w";
|
|
281
|
+
if (!canDragX && !canDragY)
|
|
282
|
+
return;
|
|
283
|
+
var axisV = axis[0];
|
|
284
|
+
var axisH = axis[axis.length - 1];
|
|
285
|
+
var handleRect = node.getBoundingClientRect();
|
|
286
|
+
if (_this2.lastHandleRect != null) {
|
|
287
|
+
if (axisH === "w") {
|
|
288
|
+
var deltaLeftSinceLast = handleRect.left - _this2.lastHandleRect.left;
|
|
289
|
+
deltaX += deltaLeftSinceLast;
|
|
290
|
+
}
|
|
291
|
+
if (axisV === "n") {
|
|
292
|
+
var deltaTopSinceLast = handleRect.top - _this2.lastHandleRect.top;
|
|
293
|
+
deltaY += deltaTopSinceLast;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
_this2.lastHandleRect = handleRect;
|
|
297
|
+
if (axisH === "w")
|
|
298
|
+
deltaX = -deltaX;
|
|
299
|
+
if (axisV === "n")
|
|
300
|
+
deltaY = -deltaY;
|
|
301
|
+
var width = _this2.props.width + (canDragX ? deltaX / _this2.props.transformScale : 0);
|
|
302
|
+
var height = _this2.props.height + (canDragY ? deltaY / _this2.props.transformScale : 0);
|
|
303
|
+
var _this2$runConstraints = _this2.runConstraints(width, height);
|
|
304
|
+
width = _this2$runConstraints[0];
|
|
305
|
+
height = _this2$runConstraints[1];
|
|
306
|
+
var dimensionsChanged = width !== _this2.props.width || height !== _this2.props.height;
|
|
307
|
+
var cb = typeof _this2.props[handlerName] === "function" ? _this2.props[handlerName] : null;
|
|
308
|
+
var shouldSkipCb = handlerName === "onResize" && !dimensionsChanged;
|
|
309
|
+
if (cb && !shouldSkipCb) {
|
|
310
|
+
e.persist == null ? void 0 : e.persist();
|
|
311
|
+
cb(e, {
|
|
312
|
+
node,
|
|
313
|
+
size: {
|
|
314
|
+
width,
|
|
315
|
+
height
|
|
316
|
+
},
|
|
317
|
+
handle: axis
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (handlerName === "onResizeStop")
|
|
321
|
+
_this2.resetData();
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
_proto.renderResizeHandle = function renderResizeHandle(handleAxis, ref) {
|
|
325
|
+
var handle = this.props.handle;
|
|
326
|
+
if (!handle) {
|
|
327
|
+
return /* @__PURE__ */ React$1.createElement("span", {
|
|
328
|
+
className: "react-resizable-handle react-resizable-handle-" + handleAxis,
|
|
329
|
+
ref
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
if (typeof handle === "function") {
|
|
333
|
+
return handle(handleAxis, ref);
|
|
334
|
+
}
|
|
335
|
+
var isDOMElement = typeof handle.type === "string";
|
|
336
|
+
var props = _objectSpread$1({
|
|
337
|
+
ref
|
|
338
|
+
}, isDOMElement ? {} : {
|
|
339
|
+
handleAxis
|
|
340
|
+
});
|
|
341
|
+
return /* @__PURE__ */ React$1.cloneElement(handle, props);
|
|
342
|
+
};
|
|
343
|
+
_proto.render = function render() {
|
|
344
|
+
var _this3 = this;
|
|
345
|
+
var _this$props2 = this.props, children = _this$props2.children, className = _this$props2.className, draggableOpts = _this$props2.draggableOpts;
|
|
346
|
+
_this$props2.width;
|
|
347
|
+
_this$props2.height;
|
|
348
|
+
_this$props2.handle;
|
|
349
|
+
_this$props2.handleSize;
|
|
350
|
+
_this$props2.lockAspectRatio;
|
|
351
|
+
_this$props2.axis;
|
|
352
|
+
_this$props2.minConstraints;
|
|
353
|
+
_this$props2.maxConstraints;
|
|
354
|
+
_this$props2.onResize;
|
|
355
|
+
_this$props2.onResizeStop;
|
|
356
|
+
_this$props2.onResizeStart;
|
|
357
|
+
var resizeHandles = _this$props2.resizeHandles;
|
|
358
|
+
_this$props2.transformScale;
|
|
359
|
+
var p = _objectWithoutPropertiesLoose$1(_this$props2, _excluded$1);
|
|
360
|
+
return (0, _utils.cloneElement)(children, _objectSpread$1(_objectSpread$1({}, p), {}, {
|
|
361
|
+
className: (className ? className + " " : "") + "react-resizable",
|
|
362
|
+
children: [].concat(children.props.children, resizeHandles.map(function(handleAxis) {
|
|
363
|
+
var _this3$handleRefs$han;
|
|
364
|
+
var ref = (_this3$handleRefs$han = _this3.handleRefs[handleAxis]) != null ? _this3$handleRefs$han : _this3.handleRefs[handleAxis] = /* @__PURE__ */ React$1.createRef();
|
|
365
|
+
return /* @__PURE__ */ React$1.createElement(_reactDraggable.DraggableCore, _extends$1({}, draggableOpts, {
|
|
366
|
+
nodeRef: ref,
|
|
367
|
+
key: "resizableHandle-" + handleAxis,
|
|
368
|
+
onStop: _this3.resizeHandler("onResizeStop", handleAxis),
|
|
369
|
+
onStart: _this3.resizeHandler("onResizeStart", handleAxis),
|
|
370
|
+
onDrag: _this3.resizeHandler("onResize", handleAxis)
|
|
371
|
+
}), _this3.renderResizeHandle(handleAxis, ref));
|
|
372
|
+
}))
|
|
373
|
+
}));
|
|
374
|
+
};
|
|
375
|
+
return Resizable2;
|
|
376
|
+
}(React$1.Component);
|
|
377
|
+
Resizable$1.default = Resizable;
|
|
378
|
+
Resizable.propTypes = _propTypes$1.resizableProps;
|
|
379
|
+
Resizable.defaultProps = {
|
|
380
|
+
axis: "both",
|
|
381
|
+
handleSize: [20, 20],
|
|
382
|
+
lockAspectRatio: false,
|
|
383
|
+
minConstraints: [20, 20],
|
|
384
|
+
maxConstraints: [Infinity, Infinity],
|
|
385
|
+
resizeHandles: ["se"],
|
|
386
|
+
transformScale: 1
|
|
387
|
+
};
|
|
388
|
+
var ResizableBox$2 = {};
|
|
389
|
+
ResizableBox$2.__esModule = true;
|
|
390
|
+
ResizableBox$2.default = void 0;
|
|
391
|
+
var React = _interopRequireWildcard(require$$0);
|
|
392
|
+
var _propTypes = _interopRequireDefault(require$$1);
|
|
393
|
+
var _Resizable = _interopRequireDefault(Resizable$1);
|
|
394
|
+
var _propTypes2 = propTypes;
|
|
395
|
+
var _excluded = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
|
|
396
|
+
function _interopRequireDefault(obj) {
|
|
397
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
398
|
+
}
|
|
399
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
400
|
+
if (typeof WeakMap !== "function")
|
|
401
|
+
return null;
|
|
402
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
403
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
404
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
|
405
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
406
|
+
})(nodeInterop);
|
|
407
|
+
}
|
|
408
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
409
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
410
|
+
return obj;
|
|
411
|
+
}
|
|
412
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
413
|
+
return { default: obj };
|
|
414
|
+
}
|
|
415
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
416
|
+
if (cache && cache.has(obj)) {
|
|
417
|
+
return cache.get(obj);
|
|
418
|
+
}
|
|
419
|
+
var newObj = {};
|
|
420
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
421
|
+
for (var key in obj) {
|
|
422
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
423
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
424
|
+
if (desc && (desc.get || desc.set)) {
|
|
425
|
+
Object.defineProperty(newObj, key, desc);
|
|
426
|
+
} else {
|
|
427
|
+
newObj[key] = obj[key];
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
newObj.default = obj;
|
|
432
|
+
if (cache) {
|
|
433
|
+
cache.set(obj, newObj);
|
|
434
|
+
}
|
|
435
|
+
return newObj;
|
|
436
|
+
}
|
|
437
|
+
function _extends() {
|
|
438
|
+
_extends = Object.assign || function(target) {
|
|
439
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
440
|
+
var source = arguments[i];
|
|
441
|
+
for (var key in source) {
|
|
442
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
443
|
+
target[key] = source[key];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return target;
|
|
448
|
+
};
|
|
449
|
+
return _extends.apply(this, arguments);
|
|
450
|
+
}
|
|
451
|
+
function ownKeys(object, enumerableOnly) {
|
|
452
|
+
var keys = Object.keys(object);
|
|
453
|
+
if (Object.getOwnPropertySymbols) {
|
|
454
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
455
|
+
if (enumerableOnly) {
|
|
456
|
+
symbols = symbols.filter(function(sym) {
|
|
457
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
keys.push.apply(keys, symbols);
|
|
461
|
+
}
|
|
462
|
+
return keys;
|
|
463
|
+
}
|
|
464
|
+
function _objectSpread(target) {
|
|
465
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
466
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
467
|
+
if (i % 2) {
|
|
468
|
+
ownKeys(Object(source), true).forEach(function(key) {
|
|
469
|
+
_defineProperty(target, key, source[key]);
|
|
470
|
+
});
|
|
471
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
472
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
473
|
+
} else {
|
|
474
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
475
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return target;
|
|
480
|
+
}
|
|
481
|
+
function _defineProperty(obj, key, value) {
|
|
482
|
+
if (key in obj) {
|
|
483
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
484
|
+
} else {
|
|
485
|
+
obj[key] = value;
|
|
486
|
+
}
|
|
487
|
+
return obj;
|
|
488
|
+
}
|
|
489
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
490
|
+
if (source == null)
|
|
491
|
+
return {};
|
|
492
|
+
var target = {};
|
|
493
|
+
var sourceKeys = Object.keys(source);
|
|
494
|
+
var key, i;
|
|
495
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
496
|
+
key = sourceKeys[i];
|
|
497
|
+
if (excluded.indexOf(key) >= 0)
|
|
498
|
+
continue;
|
|
499
|
+
target[key] = source[key];
|
|
500
|
+
}
|
|
501
|
+
return target;
|
|
502
|
+
}
|
|
503
|
+
function _inheritsLoose(subClass, superClass) {
|
|
504
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
505
|
+
subClass.prototype.constructor = subClass;
|
|
506
|
+
_setPrototypeOf(subClass, superClass);
|
|
507
|
+
}
|
|
508
|
+
function _setPrototypeOf(o, p) {
|
|
509
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
510
|
+
o2.__proto__ = p2;
|
|
511
|
+
return o2;
|
|
512
|
+
};
|
|
513
|
+
return _setPrototypeOf(o, p);
|
|
514
|
+
}
|
|
515
|
+
var ResizableBox$1 = /* @__PURE__ */ function(_React$Component) {
|
|
516
|
+
_inheritsLoose(ResizableBox2, _React$Component);
|
|
517
|
+
function ResizableBox2() {
|
|
518
|
+
var _this;
|
|
519
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
520
|
+
args[_key] = arguments[_key];
|
|
521
|
+
}
|
|
522
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
523
|
+
_this.state = {
|
|
524
|
+
width: _this.props.width,
|
|
525
|
+
height: _this.props.height,
|
|
526
|
+
propsWidth: _this.props.width,
|
|
527
|
+
propsHeight: _this.props.height
|
|
528
|
+
};
|
|
529
|
+
_this.onResize = function(e, data) {
|
|
530
|
+
var size = data.size;
|
|
531
|
+
if (_this.props.onResize) {
|
|
532
|
+
e.persist == null ? void 0 : e.persist();
|
|
533
|
+
_this.setState(size, function() {
|
|
534
|
+
return _this.props.onResize && _this.props.onResize(e, data);
|
|
535
|
+
});
|
|
536
|
+
} else {
|
|
537
|
+
_this.setState(size);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
return _this;
|
|
541
|
+
}
|
|
542
|
+
ResizableBox2.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
543
|
+
if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
|
|
544
|
+
return {
|
|
545
|
+
width: props.width,
|
|
546
|
+
height: props.height,
|
|
547
|
+
propsWidth: props.width,
|
|
548
|
+
propsHeight: props.height
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
return null;
|
|
552
|
+
};
|
|
553
|
+
var _proto = ResizableBox2.prototype;
|
|
554
|
+
_proto.render = function render() {
|
|
555
|
+
var _this$props = this.props, handle = _this$props.handle, handleSize = _this$props.handleSize;
|
|
556
|
+
_this$props.onResize;
|
|
557
|
+
var onResizeStart = _this$props.onResizeStart, onResizeStop = _this$props.onResizeStop, draggableOpts = _this$props.draggableOpts, minConstraints = _this$props.minConstraints, maxConstraints = _this$props.maxConstraints, lockAspectRatio = _this$props.lockAspectRatio, axis = _this$props.axis;
|
|
558
|
+
_this$props.width;
|
|
559
|
+
_this$props.height;
|
|
560
|
+
var resizeHandles = _this$props.resizeHandles, style = _this$props.style, transformScale = _this$props.transformScale, props = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
561
|
+
return /* @__PURE__ */ React.createElement(_Resizable.default, {
|
|
562
|
+
axis,
|
|
563
|
+
draggableOpts,
|
|
564
|
+
handle,
|
|
565
|
+
handleSize,
|
|
566
|
+
height: this.state.height,
|
|
567
|
+
lockAspectRatio,
|
|
568
|
+
maxConstraints,
|
|
569
|
+
minConstraints,
|
|
570
|
+
onResizeStart,
|
|
571
|
+
onResize: this.onResize,
|
|
572
|
+
onResizeStop,
|
|
573
|
+
resizeHandles,
|
|
574
|
+
transformScale,
|
|
575
|
+
width: this.state.width
|
|
576
|
+
}, /* @__PURE__ */ React.createElement("div", _extends({}, props, {
|
|
577
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
578
|
+
width: this.state.width + "px",
|
|
579
|
+
height: this.state.height + "px"
|
|
580
|
+
})
|
|
581
|
+
})));
|
|
582
|
+
};
|
|
583
|
+
return ResizableBox2;
|
|
584
|
+
}(React.Component);
|
|
585
|
+
ResizableBox$2.default = ResizableBox$1;
|
|
586
|
+
ResizableBox$1.propTypes = _objectSpread(_objectSpread({}, _propTypes2.resizableProps), {}, {
|
|
587
|
+
children: _propTypes.default.element
|
|
588
|
+
});
|
|
589
|
+
reactResizable.exports = function() {
|
|
590
|
+
throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
|
|
591
|
+
};
|
|
592
|
+
reactResizable.exports.Resizable = Resizable$1.default;
|
|
593
|
+
var ResizableBox = reactResizable.exports.ResizableBox = ResizableBox$2.default;
|
|
594
|
+
export { ResizableBox as R };
|