@m4l/components 0.1.13 → 0.1.15
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/assets/Logo/index.js +91 -0
- package/commonjs.js +9 -0
- package/components/CommonActions/components/ActionCancel/index.js +15 -0
- package/components/CommonActions/components/ActionFormCancel/index.js +62 -0
- package/components/CommonActions/components/ActionFormIntro/index.js +35 -0
- package/components/CommonActions/components/ActionIntro/index.js +16 -0
- package/components/CommonActions/components/Actions/index.js +859 -0
- package/components/CompanyLogo/{index.f81c179c.js → index.js} +48 -42
- package/components/DataGrid/index.js +1067 -0
- package/components/DynamicFilter/index.js +1573 -0
- package/components/ErrorLabel/index.js +18 -0
- package/components/Icon/index.js +80 -0
- package/components/Image/index.js +128 -0
- package/components/LanguagePopover/index.js +93 -0
- package/components/Loadable/index.js +13 -0
- package/components/ModalDialog/index.js +180 -0
- package/components/NoItemSelected/{index.12f0ca67.js → index.js} +50 -43
- package/components/ObjectLogs/index.js +284 -0
- package/components/Page/index.js +36 -0
- package/components/PaperForm/index.js +110 -0
- package/components/Period/index.js +230 -0
- package/components/PropertyValue/index.js +142 -0
- package/components/Resizeable/{index.45995d2b.js → index.js} +19 -21
- package/components/ScrollBar/index.js +52 -0
- package/components/ScrollToTop/index.js +10 -0
- package/components/SplitLayout/{index.4032673d.js → index.js} +35 -35
- package/components/animate/LoadingScreen/{index.f1cec7db.js → index.js} +27 -29
- package/components/animate/MotionContainer/index.js +31 -0
- package/components/animate/MotionLazyContainer/index.js +13 -0
- package/components/animate/features.js +2 -0
- package/components/animate/variants/{bounce.784aaaaa.js → bounce.js} +16 -15
- package/components/animate/variants/container.js +20 -0
- package/components/animate/variants/fade.js +61 -0
- package/components/animate/variants/{index.7a912140.js → index.js} +0 -0
- package/components/animate/variants/transition.js +16 -0
- package/components/formatters/BooleanFormatter/index.js +52 -0
- package/components/formatters/DateFormatter/index.js +66 -0
- package/components/formatters/index.js +112 -0
- package/components/hook-form/FormProvider/index.js +61 -0
- package/components/hook-form/RHFAutocomplete/index.js +144 -0
- package/components/hook-form/RHFAutocompleteAsync/index.js +191 -0
- package/components/hook-form/RHFCheckbox/index.js +65 -0
- package/components/hook-form/RHFDateTime/index.js +79 -0
- package/components/hook-form/RHFMultiCheckbox/index.js +32 -0
- package/components/hook-form/RHFPeriod/index.js +47 -0
- package/components/hook-form/RHFRadioGroup/index.js +41 -0
- package/components/hook-form/RHFSelect/index.js +34 -0
- package/components/hook-form/RHFTextField/index.js +87 -0
- package/components/hook-form/RHFUpload/index.js +255 -0
- package/components/mui_extended/Accordion/index.js +105 -0
- package/components/mui_extended/Avatar/index.js +33 -0
- package/components/mui_extended/BoxIcon/index.js +20 -0
- package/components/mui_extended/Breadcrumbs/index.js +92 -0
- package/components/mui_extended/Button/index.js +131 -0
- package/components/mui_extended/IconButton/index.js +108 -0
- package/components/mui_extended/LinkWithRoute/index.js +30 -0
- package/components/mui_extended/MenuPopover/index.js +135 -0
- package/components/mui_extended/Pager/index.js +137 -0
- package/components/mui_extended/Tab/index.js +30 -0
- package/components/mui_extended/Typography/index.js +21 -0
- package/contexts/ModalContext/index.js +165 -0
- package/hooks/useFormAddEdit/index.js +42 -0
- package/hooks/useModal/index.js +4 -0
- package/index.js +70 -162
- package/lodash.js +62 -0
- package/node_modules.js +54 -0
- package/package.json +2 -1
- package/react-data-grid.js +2652 -0
- package/react-draggable.js +960 -0
- package/react-json-view.js +2764 -0
- package/react-lazy-load-image-component.js +792 -0
- package/react-resizable.js +541 -0
- package/react-splitter-layout.js +165 -0
- package/utils/index.js +572 -0
- package/assets/Logo/index.228dcb5a.js +0 -86
- package/commonjs.565e6834.js +0 -12
- package/components/CommonActions/components/ActionCancel/index.cba1b460.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +0 -49
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +0 -31
- package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +0 -18
- package/components/CommonActions/components/Actions/index.e8148d98.js +0 -743
- package/components/DataGrid/index.b688877d.js +0 -894
- package/components/DynamicFilter/index.82ce857e.js +0 -1158
- package/components/ErrorLabel/index.c8615f16.js +0 -19
- package/components/Icon/index.cbca79b0.js +0 -70
- package/components/Image/index.e790b50b.js +0 -122
- package/components/LanguagePopover/index.3d9611cb.js +0 -87
- package/components/Loadable/index.f5518558.js +0 -15
- package/components/ModalDialog/index.3850c053.js +0 -168
- package/components/ObjectLogs/index.27ef875d.js +0 -266
- package/components/Page/index.6d69977e.js +0 -35
- package/components/PaperForm/index.d7c74064.js +0 -105
- package/components/Period/index.5e68286a.js +0 -160
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/ScrollBar/index.39eeb2de.js +0 -49
- package/components/ScrollToTop/index.e06f98f6.js +0 -11
- package/components/animate/MotionContainer/index.8d9f9d80.js +0 -30
- package/components/animate/MotionLazyContainer/index.572dd012.js +0 -15
- package/components/animate/features.0fbf41e1.js +0 -5
- package/components/animate/variants/container.11f82b76.js +0 -20
- package/components/animate/variants/fade.b561c0fc.js +0 -59
- package/components/animate/variants/transition.bd46b9ce.js +0 -15
- package/components/formatters/BooleanFormatter/index.cca53b7f.js +0 -42
- package/components/formatters/DateFormatter/index.ad8d9b8e.js +0 -57
- package/components/formatters/index.55856d65.js +0 -106
- package/components/hook-form/FormProvider/index.257acd9f.js +0 -55
- package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +0 -122
- package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +0 -153
- package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +0 -59
- package/components/hook-form/RHFDateTime/index.fc5cbafe.js +0 -68
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +0 -34
- package/components/hook-form/RHFPeriod/index.23c254e9.js +0 -45
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +0 -43
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +0 -36
- package/components/hook-form/RHFTextField/index.4c455f75.js +0 -77
- package/components/hook-form/RHFUpload/index.ed3d739f.js +0 -244
- package/components/mui_extended/Accordion/index.2116e423.js +0 -103
- package/components/mui_extended/Avatar/index.0a2a4523.js +0 -32
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +0 -22
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +0 -89
- package/components/mui_extended/Button/index.84d8898c.js +0 -110
- package/components/mui_extended/IconButton/index.88f3aadb.js +0 -98
- package/components/mui_extended/LinkWithRoute/index.d4b263de.js +0 -28
- package/components/mui_extended/MenuPopover/index.488fc536.js +0 -131
- package/components/mui_extended/Pager/index.0576814f.js +0 -126
- package/components/mui_extended/Tab/index.e0653a0a.js +0 -28
- package/components/mui_extended/Typography/index.0c4604b3.js +0 -22
- package/contexts/ModalContext/index.2188b69e.js +0 -150
- package/hooks/useFormAddEdit/index.d4845f1a.js +0 -26
- package/hooks/useModal/index.6571d2d9.js +0 -6
- package/lodash.e09401f0.js +0 -32
- package/node_modules.168cb897.js +0 -55
- package/react-data-grid.d46d625e.js +0 -2115
- package/react-draggable.20e95c61.js +0 -714
- package/react-json-view.f56a7f8e.js +0 -2762
- package/react-lazy-load-image-component.45b56650.js +0 -784
- package/react-resizable.5277deaf.js +0 -371
- package/react-splitter-layout.7810ac1b.js +0 -165
- package/utils/index.214d9542.js +0 -435
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import React$2 from "react";
|
|
2
|
+
import { c as cjs } from "./react-draggable.js";
|
|
3
|
+
import { u as utils } from "./utils/index.js";
|
|
4
|
+
import require$$1 from "prop-types";
|
|
5
|
+
var reactResizable = { exports: {} };
|
|
6
|
+
var Resizable$1 = {};
|
|
7
|
+
var propTypes = {};
|
|
8
|
+
propTypes.__esModule = true;
|
|
9
|
+
propTypes.resizableProps = void 0;
|
|
10
|
+
var _propTypes$2 = _interopRequireDefault$1(require$$1);
|
|
11
|
+
function _interopRequireDefault$1(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
13
|
+
}
|
|
14
|
+
var resizableProps = {
|
|
15
|
+
axis: _propTypes$2.default.oneOf(["both", "x", "y", "none"]),
|
|
16
|
+
className: _propTypes$2.default.string,
|
|
17
|
+
children: _propTypes$2.default.element.isRequired,
|
|
18
|
+
draggableOpts: _propTypes$2.default.shape({
|
|
19
|
+
allowAnyClick: _propTypes$2.default.bool,
|
|
20
|
+
cancel: _propTypes$2.default.string,
|
|
21
|
+
children: _propTypes$2.default.node,
|
|
22
|
+
disabled: _propTypes$2.default.bool,
|
|
23
|
+
enableUserSelectHack: _propTypes$2.default.bool,
|
|
24
|
+
offsetParent: _propTypes$2.default.node,
|
|
25
|
+
grid: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
26
|
+
handle: _propTypes$2.default.string,
|
|
27
|
+
nodeRef: _propTypes$2.default.object,
|
|
28
|
+
onStart: _propTypes$2.default.func,
|
|
29
|
+
onDrag: _propTypes$2.default.func,
|
|
30
|
+
onStop: _propTypes$2.default.func,
|
|
31
|
+
onMouseDown: _propTypes$2.default.func,
|
|
32
|
+
scale: _propTypes$2.default.number
|
|
33
|
+
}),
|
|
34
|
+
height: _propTypes$2.default.number.isRequired,
|
|
35
|
+
handle: _propTypes$2.default.oneOfType([_propTypes$2.default.node, _propTypes$2.default.func]),
|
|
36
|
+
handleSize: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
37
|
+
lockAspectRatio: _propTypes$2.default.bool,
|
|
38
|
+
maxConstraints: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
39
|
+
minConstraints: _propTypes$2.default.arrayOf(_propTypes$2.default.number),
|
|
40
|
+
onResizeStop: _propTypes$2.default.func,
|
|
41
|
+
onResizeStart: _propTypes$2.default.func,
|
|
42
|
+
onResize: _propTypes$2.default.func,
|
|
43
|
+
resizeHandles: _propTypes$2.default.arrayOf(_propTypes$2.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])),
|
|
44
|
+
transformScale: _propTypes$2.default.number,
|
|
45
|
+
width: _propTypes$2.default.number.isRequired
|
|
46
|
+
};
|
|
47
|
+
propTypes.resizableProps = resizableProps;
|
|
48
|
+
Resizable$1.__esModule = true;
|
|
49
|
+
Resizable$1.default = void 0;
|
|
50
|
+
var React$1 = _interopRequireWildcard$1(React$2);
|
|
51
|
+
var _reactDraggable = cjs.exports;
|
|
52
|
+
var _utils = utils;
|
|
53
|
+
var _propTypes$1 = propTypes;
|
|
54
|
+
var _excluded$1 = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
|
|
55
|
+
function _getRequireWildcardCache$1(nodeInterop) {
|
|
56
|
+
if (typeof WeakMap !== "function")
|
|
57
|
+
return null;
|
|
58
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
59
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
60
|
+
return (_getRequireWildcardCache$1 = function _getRequireWildcardCache2(nodeInterop2) {
|
|
61
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
62
|
+
})(nodeInterop);
|
|
63
|
+
}
|
|
64
|
+
function _interopRequireWildcard$1(obj, nodeInterop) {
|
|
65
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
69
|
+
return { default: obj };
|
|
70
|
+
}
|
|
71
|
+
var cache = _getRequireWildcardCache$1(nodeInterop);
|
|
72
|
+
if (cache && cache.has(obj)) {
|
|
73
|
+
return cache.get(obj);
|
|
74
|
+
}
|
|
75
|
+
var newObj = {};
|
|
76
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
77
|
+
for (var key in obj) {
|
|
78
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
79
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
80
|
+
if (desc && (desc.get || desc.set)) {
|
|
81
|
+
Object.defineProperty(newObj, key, desc);
|
|
82
|
+
} else {
|
|
83
|
+
newObj[key] = obj[key];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
newObj.default = obj;
|
|
88
|
+
if (cache) {
|
|
89
|
+
cache.set(obj, newObj);
|
|
90
|
+
}
|
|
91
|
+
return newObj;
|
|
92
|
+
}
|
|
93
|
+
function _extends$1() {
|
|
94
|
+
_extends$1 = Object.assign || function(target) {
|
|
95
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
96
|
+
var source = arguments[i];
|
|
97
|
+
for (var key in source) {
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
99
|
+
target[key] = source[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return target;
|
|
104
|
+
};
|
|
105
|
+
return _extends$1.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
108
|
+
if (source == null)
|
|
109
|
+
return {};
|
|
110
|
+
var target = {};
|
|
111
|
+
var sourceKeys = Object.keys(source);
|
|
112
|
+
var key, i;
|
|
113
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
114
|
+
key = sourceKeys[i];
|
|
115
|
+
if (excluded.indexOf(key) >= 0)
|
|
116
|
+
continue;
|
|
117
|
+
target[key] = source[key];
|
|
118
|
+
}
|
|
119
|
+
return target;
|
|
120
|
+
}
|
|
121
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
122
|
+
var keys = Object.keys(object);
|
|
123
|
+
if (Object.getOwnPropertySymbols) {
|
|
124
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
125
|
+
if (enumerableOnly) {
|
|
126
|
+
symbols = symbols.filter(function(sym) {
|
|
127
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
keys.push.apply(keys, symbols);
|
|
131
|
+
}
|
|
132
|
+
return keys;
|
|
133
|
+
}
|
|
134
|
+
function _objectSpread$1(target) {
|
|
135
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
136
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
137
|
+
if (i % 2) {
|
|
138
|
+
ownKeys$1(Object(source), true).forEach(function(key) {
|
|
139
|
+
_defineProperty$1(target, key, source[key]);
|
|
140
|
+
});
|
|
141
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
142
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
143
|
+
} else {
|
|
144
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
145
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return target;
|
|
150
|
+
}
|
|
151
|
+
function _defineProperty$1(obj, key, value) {
|
|
152
|
+
if (key in obj) {
|
|
153
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
154
|
+
} else {
|
|
155
|
+
obj[key] = value;
|
|
156
|
+
}
|
|
157
|
+
return obj;
|
|
158
|
+
}
|
|
159
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
160
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
161
|
+
subClass.prototype.constructor = subClass;
|
|
162
|
+
_setPrototypeOf$1(subClass, superClass);
|
|
163
|
+
}
|
|
164
|
+
function _setPrototypeOf$1(o, p) {
|
|
165
|
+
_setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
166
|
+
o2.__proto__ = p2;
|
|
167
|
+
return o2;
|
|
168
|
+
};
|
|
169
|
+
return _setPrototypeOf$1(o, p);
|
|
170
|
+
}
|
|
171
|
+
var Resizable = /* @__PURE__ */ function(_React$Component) {
|
|
172
|
+
_inheritsLoose$1(Resizable2, _React$Component);
|
|
173
|
+
function Resizable2() {
|
|
174
|
+
var _this;
|
|
175
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
176
|
+
args[_key] = arguments[_key];
|
|
177
|
+
}
|
|
178
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
179
|
+
_this.handleRefs = {};
|
|
180
|
+
_this.lastHandleRect = null;
|
|
181
|
+
_this.slack = null;
|
|
182
|
+
return _this;
|
|
183
|
+
}
|
|
184
|
+
var _proto = Resizable2.prototype;
|
|
185
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
186
|
+
this.resetData();
|
|
187
|
+
};
|
|
188
|
+
_proto.resetData = function resetData() {
|
|
189
|
+
this.lastHandleRect = this.slack = null;
|
|
190
|
+
};
|
|
191
|
+
_proto.runConstraints = function runConstraints(width, height) {
|
|
192
|
+
var _this$props = this.props, minConstraints = _this$props.minConstraints, maxConstraints = _this$props.maxConstraints, lockAspectRatio = _this$props.lockAspectRatio;
|
|
193
|
+
if (!minConstraints && !maxConstraints && !lockAspectRatio)
|
|
194
|
+
return [width, height];
|
|
195
|
+
if (lockAspectRatio) {
|
|
196
|
+
var ratio = this.props.width / this.props.height;
|
|
197
|
+
var deltaW = width - this.props.width;
|
|
198
|
+
var deltaH = height - this.props.height;
|
|
199
|
+
if (Math.abs(deltaW) > Math.abs(deltaH * ratio)) {
|
|
200
|
+
height = width / ratio;
|
|
201
|
+
} else {
|
|
202
|
+
width = height * ratio;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var oldW = width, oldH = height;
|
|
206
|
+
var _ref = this.slack || [0, 0], slackW = _ref[0], slackH = _ref[1];
|
|
207
|
+
width += slackW;
|
|
208
|
+
height += slackH;
|
|
209
|
+
if (minConstraints) {
|
|
210
|
+
width = Math.max(minConstraints[0], width);
|
|
211
|
+
height = Math.max(minConstraints[1], height);
|
|
212
|
+
}
|
|
213
|
+
if (maxConstraints) {
|
|
214
|
+
width = Math.min(maxConstraints[0], width);
|
|
215
|
+
height = Math.min(maxConstraints[1], height);
|
|
216
|
+
}
|
|
217
|
+
this.slack = [slackW + (oldW - width), slackH + (oldH - height)];
|
|
218
|
+
return [width, height];
|
|
219
|
+
};
|
|
220
|
+
_proto.resizeHandler = function resizeHandler(handlerName, axis) {
|
|
221
|
+
var _this2 = this;
|
|
222
|
+
return function(e, _ref2) {
|
|
223
|
+
var node = _ref2.node, deltaX = _ref2.deltaX, deltaY = _ref2.deltaY;
|
|
224
|
+
if (handlerName === "onResizeStart")
|
|
225
|
+
_this2.resetData();
|
|
226
|
+
var canDragX = (_this2.props.axis === "both" || _this2.props.axis === "x") && axis !== "n" && axis !== "s";
|
|
227
|
+
var canDragY = (_this2.props.axis === "both" || _this2.props.axis === "y") && axis !== "e" && axis !== "w";
|
|
228
|
+
if (!canDragX && !canDragY)
|
|
229
|
+
return;
|
|
230
|
+
var axisV = axis[0];
|
|
231
|
+
var axisH = axis[axis.length - 1];
|
|
232
|
+
var handleRect = node.getBoundingClientRect();
|
|
233
|
+
if (_this2.lastHandleRect != null) {
|
|
234
|
+
if (axisH === "w") {
|
|
235
|
+
var deltaLeftSinceLast = handleRect.left - _this2.lastHandleRect.left;
|
|
236
|
+
deltaX += deltaLeftSinceLast;
|
|
237
|
+
}
|
|
238
|
+
if (axisV === "n") {
|
|
239
|
+
var deltaTopSinceLast = handleRect.top - _this2.lastHandleRect.top;
|
|
240
|
+
deltaY += deltaTopSinceLast;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
_this2.lastHandleRect = handleRect;
|
|
244
|
+
if (axisH === "w")
|
|
245
|
+
deltaX = -deltaX;
|
|
246
|
+
if (axisV === "n")
|
|
247
|
+
deltaY = -deltaY;
|
|
248
|
+
var width = _this2.props.width + (canDragX ? deltaX / _this2.props.transformScale : 0);
|
|
249
|
+
var height = _this2.props.height + (canDragY ? deltaY / _this2.props.transformScale : 0);
|
|
250
|
+
var _this2$runConstraints = _this2.runConstraints(width, height);
|
|
251
|
+
width = _this2$runConstraints[0];
|
|
252
|
+
height = _this2$runConstraints[1];
|
|
253
|
+
var dimensionsChanged = width !== _this2.props.width || height !== _this2.props.height;
|
|
254
|
+
var cb = typeof _this2.props[handlerName] === "function" ? _this2.props[handlerName] : null;
|
|
255
|
+
var shouldSkipCb = handlerName === "onResize" && !dimensionsChanged;
|
|
256
|
+
if (cb && !shouldSkipCb) {
|
|
257
|
+
e.persist == null ? void 0 : e.persist();
|
|
258
|
+
cb(e, {
|
|
259
|
+
node,
|
|
260
|
+
size: {
|
|
261
|
+
width,
|
|
262
|
+
height
|
|
263
|
+
},
|
|
264
|
+
handle: axis
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (handlerName === "onResizeStop")
|
|
268
|
+
_this2.resetData();
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
_proto.renderResizeHandle = function renderResizeHandle(handleAxis, ref) {
|
|
272
|
+
var handle = this.props.handle;
|
|
273
|
+
if (!handle) {
|
|
274
|
+
return /* @__PURE__ */ React$1.createElement("span", {
|
|
275
|
+
className: "react-resizable-handle react-resizable-handle-" + handleAxis,
|
|
276
|
+
ref
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (typeof handle === "function") {
|
|
280
|
+
return handle(handleAxis, ref);
|
|
281
|
+
}
|
|
282
|
+
var isDOMElement = typeof handle.type === "string";
|
|
283
|
+
var props = _objectSpread$1({
|
|
284
|
+
ref
|
|
285
|
+
}, isDOMElement ? {} : {
|
|
286
|
+
handleAxis
|
|
287
|
+
});
|
|
288
|
+
return /* @__PURE__ */ React$1.cloneElement(handle, props);
|
|
289
|
+
};
|
|
290
|
+
_proto.render = function render() {
|
|
291
|
+
var _this3 = this;
|
|
292
|
+
var _this$props2 = this.props, children = _this$props2.children, className = _this$props2.className, draggableOpts = _this$props2.draggableOpts;
|
|
293
|
+
_this$props2.width;
|
|
294
|
+
_this$props2.height;
|
|
295
|
+
_this$props2.handle;
|
|
296
|
+
_this$props2.handleSize;
|
|
297
|
+
_this$props2.lockAspectRatio;
|
|
298
|
+
_this$props2.axis;
|
|
299
|
+
_this$props2.minConstraints;
|
|
300
|
+
_this$props2.maxConstraints;
|
|
301
|
+
_this$props2.onResize;
|
|
302
|
+
_this$props2.onResizeStop;
|
|
303
|
+
_this$props2.onResizeStart;
|
|
304
|
+
var resizeHandles = _this$props2.resizeHandles;
|
|
305
|
+
_this$props2.transformScale;
|
|
306
|
+
var p = _objectWithoutPropertiesLoose$1(_this$props2, _excluded$1);
|
|
307
|
+
return (0, _utils.cloneElement)(children, _objectSpread$1(_objectSpread$1({}, p), {}, {
|
|
308
|
+
className: (className ? className + " " : "") + "react-resizable",
|
|
309
|
+
children: [].concat(children.props.children, resizeHandles.map(function(handleAxis) {
|
|
310
|
+
var _this3$handleRefs$han;
|
|
311
|
+
var ref = (_this3$handleRefs$han = _this3.handleRefs[handleAxis]) != null ? _this3$handleRefs$han : _this3.handleRefs[handleAxis] = /* @__PURE__ */ React$1.createRef();
|
|
312
|
+
return /* @__PURE__ */ React$1.createElement(_reactDraggable.DraggableCore, _extends$1({}, draggableOpts, {
|
|
313
|
+
nodeRef: ref,
|
|
314
|
+
key: "resizableHandle-" + handleAxis,
|
|
315
|
+
onStop: _this3.resizeHandler("onResizeStop", handleAxis),
|
|
316
|
+
onStart: _this3.resizeHandler("onResizeStart", handleAxis),
|
|
317
|
+
onDrag: _this3.resizeHandler("onResize", handleAxis)
|
|
318
|
+
}), _this3.renderResizeHandle(handleAxis, ref));
|
|
319
|
+
}))
|
|
320
|
+
}));
|
|
321
|
+
};
|
|
322
|
+
return Resizable2;
|
|
323
|
+
}(React$1.Component);
|
|
324
|
+
Resizable$1.default = Resizable;
|
|
325
|
+
Resizable.propTypes = _propTypes$1.resizableProps;
|
|
326
|
+
Resizable.defaultProps = {
|
|
327
|
+
axis: "both",
|
|
328
|
+
handleSize: [20, 20],
|
|
329
|
+
lockAspectRatio: false,
|
|
330
|
+
minConstraints: [20, 20],
|
|
331
|
+
maxConstraints: [Infinity, Infinity],
|
|
332
|
+
resizeHandles: ["se"],
|
|
333
|
+
transformScale: 1
|
|
334
|
+
};
|
|
335
|
+
var ResizableBox$2 = {};
|
|
336
|
+
ResizableBox$2.__esModule = true;
|
|
337
|
+
ResizableBox$2.default = void 0;
|
|
338
|
+
var React = _interopRequireWildcard(React$2);
|
|
339
|
+
var _propTypes = _interopRequireDefault(require$$1);
|
|
340
|
+
var _Resizable = _interopRequireDefault(Resizable$1);
|
|
341
|
+
var _propTypes2 = propTypes;
|
|
342
|
+
var _excluded = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
|
|
343
|
+
function _interopRequireDefault(obj) {
|
|
344
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
345
|
+
}
|
|
346
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
347
|
+
if (typeof WeakMap !== "function")
|
|
348
|
+
return null;
|
|
349
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
350
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
351
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
|
352
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
353
|
+
})(nodeInterop);
|
|
354
|
+
}
|
|
355
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
356
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
357
|
+
return obj;
|
|
358
|
+
}
|
|
359
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
360
|
+
return { default: obj };
|
|
361
|
+
}
|
|
362
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
363
|
+
if (cache && cache.has(obj)) {
|
|
364
|
+
return cache.get(obj);
|
|
365
|
+
}
|
|
366
|
+
var newObj = {};
|
|
367
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
368
|
+
for (var key in obj) {
|
|
369
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
370
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
371
|
+
if (desc && (desc.get || desc.set)) {
|
|
372
|
+
Object.defineProperty(newObj, key, desc);
|
|
373
|
+
} else {
|
|
374
|
+
newObj[key] = obj[key];
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
newObj.default = obj;
|
|
379
|
+
if (cache) {
|
|
380
|
+
cache.set(obj, newObj);
|
|
381
|
+
}
|
|
382
|
+
return newObj;
|
|
383
|
+
}
|
|
384
|
+
function _extends() {
|
|
385
|
+
_extends = Object.assign || function(target) {
|
|
386
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
387
|
+
var source = arguments[i];
|
|
388
|
+
for (var key in source) {
|
|
389
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
390
|
+
target[key] = source[key];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return target;
|
|
395
|
+
};
|
|
396
|
+
return _extends.apply(this, arguments);
|
|
397
|
+
}
|
|
398
|
+
function ownKeys(object, enumerableOnly) {
|
|
399
|
+
var keys = Object.keys(object);
|
|
400
|
+
if (Object.getOwnPropertySymbols) {
|
|
401
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
402
|
+
if (enumerableOnly) {
|
|
403
|
+
symbols = symbols.filter(function(sym) {
|
|
404
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
keys.push.apply(keys, symbols);
|
|
408
|
+
}
|
|
409
|
+
return keys;
|
|
410
|
+
}
|
|
411
|
+
function _objectSpread(target) {
|
|
412
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
413
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
414
|
+
if (i % 2) {
|
|
415
|
+
ownKeys(Object(source), true).forEach(function(key) {
|
|
416
|
+
_defineProperty(target, key, source[key]);
|
|
417
|
+
});
|
|
418
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
419
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
420
|
+
} else {
|
|
421
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
422
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return target;
|
|
427
|
+
}
|
|
428
|
+
function _defineProperty(obj, key, value) {
|
|
429
|
+
if (key in obj) {
|
|
430
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
431
|
+
} else {
|
|
432
|
+
obj[key] = value;
|
|
433
|
+
}
|
|
434
|
+
return obj;
|
|
435
|
+
}
|
|
436
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
437
|
+
if (source == null)
|
|
438
|
+
return {};
|
|
439
|
+
var target = {};
|
|
440
|
+
var sourceKeys = Object.keys(source);
|
|
441
|
+
var key, i;
|
|
442
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
443
|
+
key = sourceKeys[i];
|
|
444
|
+
if (excluded.indexOf(key) >= 0)
|
|
445
|
+
continue;
|
|
446
|
+
target[key] = source[key];
|
|
447
|
+
}
|
|
448
|
+
return target;
|
|
449
|
+
}
|
|
450
|
+
function _inheritsLoose(subClass, superClass) {
|
|
451
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
452
|
+
subClass.prototype.constructor = subClass;
|
|
453
|
+
_setPrototypeOf(subClass, superClass);
|
|
454
|
+
}
|
|
455
|
+
function _setPrototypeOf(o, p) {
|
|
456
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
457
|
+
o2.__proto__ = p2;
|
|
458
|
+
return o2;
|
|
459
|
+
};
|
|
460
|
+
return _setPrototypeOf(o, p);
|
|
461
|
+
}
|
|
462
|
+
var ResizableBox$1 = /* @__PURE__ */ function(_React$Component) {
|
|
463
|
+
_inheritsLoose(ResizableBox2, _React$Component);
|
|
464
|
+
function ResizableBox2() {
|
|
465
|
+
var _this;
|
|
466
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
467
|
+
args[_key] = arguments[_key];
|
|
468
|
+
}
|
|
469
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
470
|
+
_this.state = {
|
|
471
|
+
width: _this.props.width,
|
|
472
|
+
height: _this.props.height,
|
|
473
|
+
propsWidth: _this.props.width,
|
|
474
|
+
propsHeight: _this.props.height
|
|
475
|
+
};
|
|
476
|
+
_this.onResize = function(e, data) {
|
|
477
|
+
var size = data.size;
|
|
478
|
+
if (_this.props.onResize) {
|
|
479
|
+
e.persist == null ? void 0 : e.persist();
|
|
480
|
+
_this.setState(size, function() {
|
|
481
|
+
return _this.props.onResize && _this.props.onResize(e, data);
|
|
482
|
+
});
|
|
483
|
+
} else {
|
|
484
|
+
_this.setState(size);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
return _this;
|
|
488
|
+
}
|
|
489
|
+
ResizableBox2.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
490
|
+
if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
|
|
491
|
+
return {
|
|
492
|
+
width: props.width,
|
|
493
|
+
height: props.height,
|
|
494
|
+
propsWidth: props.width,
|
|
495
|
+
propsHeight: props.height
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
};
|
|
500
|
+
var _proto = ResizableBox2.prototype;
|
|
501
|
+
_proto.render = function render() {
|
|
502
|
+
var _this$props = this.props, handle = _this$props.handle, handleSize = _this$props.handleSize;
|
|
503
|
+
_this$props.onResize;
|
|
504
|
+
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;
|
|
505
|
+
_this$props.width;
|
|
506
|
+
_this$props.height;
|
|
507
|
+
var resizeHandles = _this$props.resizeHandles, style = _this$props.style, transformScale = _this$props.transformScale, props = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
508
|
+
return /* @__PURE__ */ React.createElement(_Resizable.default, {
|
|
509
|
+
axis,
|
|
510
|
+
draggableOpts,
|
|
511
|
+
handle,
|
|
512
|
+
handleSize,
|
|
513
|
+
height: this.state.height,
|
|
514
|
+
lockAspectRatio,
|
|
515
|
+
maxConstraints,
|
|
516
|
+
minConstraints,
|
|
517
|
+
onResizeStart,
|
|
518
|
+
onResize: this.onResize,
|
|
519
|
+
onResizeStop,
|
|
520
|
+
resizeHandles,
|
|
521
|
+
transformScale,
|
|
522
|
+
width: this.state.width
|
|
523
|
+
}, /* @__PURE__ */ React.createElement("div", _extends({}, props, {
|
|
524
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
525
|
+
width: this.state.width + "px",
|
|
526
|
+
height: this.state.height + "px"
|
|
527
|
+
})
|
|
528
|
+
})));
|
|
529
|
+
};
|
|
530
|
+
return ResizableBox2;
|
|
531
|
+
}(React.Component);
|
|
532
|
+
ResizableBox$2.default = ResizableBox$1;
|
|
533
|
+
ResizableBox$1.propTypes = _objectSpread(_objectSpread({}, _propTypes2.resizableProps), {}, {
|
|
534
|
+
children: _propTypes.default.element
|
|
535
|
+
});
|
|
536
|
+
reactResizable.exports = function() {
|
|
537
|
+
throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
|
|
538
|
+
};
|
|
539
|
+
reactResizable.exports.Resizable = Resizable$1.default;
|
|
540
|
+
var ResizableBox = reactResizable.exports.ResizableBox = ResizableBox$2.default;
|
|
541
|
+
export { ResizableBox as R };
|