@m4l/components 0.1.11 → 0.1.13
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.228dcb5a.js +86 -0
- package/commonjs.565e6834.js +12 -0
- package/components/CommonActions/components/ActionCancel/index.cba1b460.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +49 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +31 -0
- package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +18 -0
- package/components/CommonActions/components/Actions/index.e8148d98.js +743 -0
- package/components/CompanyLogo/{index.js → index.f81c179c.js} +42 -48
- package/components/DataGrid/index.b688877d.js +894 -0
- package/components/DataGrid/types.d.ts +1 -1
- package/components/DynamicFilter/index.82ce857e.js +1158 -0
- package/components/ErrorLabel/index.c8615f16.js +19 -0
- package/components/Icon/index.cbca79b0.js +70 -0
- package/components/Image/index.e790b50b.js +122 -0
- package/components/LanguagePopover/index.3d9611cb.js +87 -0
- package/components/Loadable/index.f5518558.js +15 -0
- package/components/ModalDialog/index.3850c053.js +168 -0
- package/components/NoItemSelected/{index.js → index.12f0ca67.js} +43 -50
- package/components/ObjectLogs/index.27ef875d.js +266 -0
- package/components/Page/index.6d69977e.js +35 -0
- package/components/Page/index.d.ts +1 -1
- package/components/PaperForm/index.d7c74064.js +105 -0
- package/components/Period/index.5e68286a.js +160 -0
- package/components/PropertyValue/index.ab3dd7e9.js +116 -0
- package/components/Resizeable/{index.js → index.45995d2b.js} +21 -19
- package/components/ScrollBar/index.39eeb2de.js +49 -0
- package/components/ScrollToTop/index.e06f98f6.js +11 -0
- package/components/SplitLayout/{index.js → index.4032673d.js} +35 -35
- package/components/animate/IconButtonAnimate/index.d.ts +1 -1
- package/components/animate/LoadingScreen/{index.js → index.f1cec7db.js} +29 -27
- package/components/animate/MotionContainer/index.8d9f9d80.js +30 -0
- package/components/animate/MotionLazyContainer/index.572dd012.js +15 -0
- package/components/animate/features.0fbf41e1.js +5 -0
- package/components/animate/variants/{bounce.js → bounce.784aaaaa.js} +15 -16
- package/components/animate/variants/container.11f82b76.js +20 -0
- package/components/animate/variants/fade.b561c0fc.js +59 -0
- package/components/animate/variants/{index.js → index.7a912140.js} +0 -0
- package/components/animate/variants/transition.bd46b9ce.js +15 -0
- package/components/formatters/BooleanFormatter/index.cca53b7f.js +42 -0
- package/components/formatters/DateFormatter/index.ad8d9b8e.js +57 -0
- package/components/formatters/index.55856d65.js +106 -0
- package/components/hook-form/FormProvider/index.257acd9f.js +55 -0
- package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +122 -0
- package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +153 -0
- package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +59 -0
- package/components/hook-form/RHFDateTime/index.fc5cbafe.js +68 -0
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +34 -0
- package/components/hook-form/RHFPeriod/index.23c254e9.js +45 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +43 -0
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +36 -0
- package/components/hook-form/RHFTextField/index.4c455f75.js +77 -0
- package/components/hook-form/RHFTextField/index.d.ts +1 -1
- package/components/hook-form/RHFUpload/index.ed3d739f.js +244 -0
- package/components/mui_extended/Accordion/index.2116e423.js +103 -0
- package/components/mui_extended/Avatar/index.0a2a4523.js +32 -0
- package/components/mui_extended/Avatar/index.d.ts +1 -1
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +22 -0
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +89 -0
- package/components/mui_extended/Button/index.84d8898c.js +110 -0
- package/components/mui_extended/IconButton/index.88f3aadb.js +98 -0
- package/components/mui_extended/LinkWithRoute/index.d4b263de.js +28 -0
- package/components/mui_extended/MenuPopover/index.488fc536.js +131 -0
- package/components/mui_extended/Pager/index.0576814f.js +126 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +28 -0
- package/components/mui_extended/Typography/index.0c4604b3.js +22 -0
- package/contexts/ModalContext/index.2188b69e.js +150 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +26 -0
- package/hooks/useModal/index.6571d2d9.js +6 -0
- package/index.js +162 -70
- package/lodash.e09401f0.js +32 -0
- package/node_modules.168cb897.js +55 -0
- package/package.json +1 -1
- package/react-data-grid.d46d625e.js +2115 -0
- package/react-draggable.20e95c61.js +714 -0
- package/react-json-view.f56a7f8e.js +2762 -0
- package/react-lazy-load-image-component.45b56650.js +784 -0
- package/react-resizable.5277deaf.js +371 -0
- package/react-splitter-layout.7810ac1b.js +165 -0
- package/utils/index.214d9542.js +435 -0
- package/assets/Logo/index.js +0 -91
- package/commonjs.js +0 -9
- package/components/CommonActions/components/ActionCancel/index.js +0 -15
- package/components/CommonActions/components/ActionFormCancel/index.js +0 -62
- package/components/CommonActions/components/ActionFormIntro/index.js +0 -35
- package/components/CommonActions/components/ActionIntro/index.js +0 -16
- package/components/CommonActions/components/Actions/index.js +0 -859
- package/components/DataGrid/index.js +0 -1067
- package/components/DynamicFilter/index.js +0 -1573
- package/components/ErrorLabel/index.js +0 -18
- package/components/Icon/index.js +0 -80
- package/components/Image/index.js +0 -128
- package/components/LanguagePopover/index.js +0 -93
- package/components/Loadable/index.js +0 -13
- package/components/ModalDialog/index.js +0 -180
- package/components/ObjectLogs/index.js +0 -284
- package/components/Page/index.js +0 -36
- package/components/PaperForm/index.js +0 -110
- package/components/Period/index.js +0 -230
- package/components/PropertyValue/index.js +0 -142
- package/components/ScrollBar/index.js +0 -52
- package/components/ScrollToTop/index.js +0 -10
- package/components/animate/MotionContainer/index.js +0 -31
- package/components/animate/MotionLazyContainer/index.js +0 -13
- package/components/animate/features.js +0 -2
- package/components/animate/variants/container.js +0 -20
- package/components/animate/variants/fade.js +0 -61
- package/components/animate/variants/transition.js +0 -16
- package/components/formatters/BooleanFormatter/index.js +0 -52
- package/components/formatters/DateFormatter/index.js +0 -66
- package/components/formatters/index.js +0 -112
- package/components/hook-form/FormProvider/index.js +0 -61
- package/components/hook-form/RHFAutocomplete/index.js +0 -144
- package/components/hook-form/RHFAutocompleteAsync/index.js +0 -191
- package/components/hook-form/RHFCheckbox/index.js +0 -65
- package/components/hook-form/RHFDateTime/index.js +0 -79
- package/components/hook-form/RHFMultiCheckbox/index.js +0 -32
- package/components/hook-form/RHFPeriod/index.js +0 -47
- package/components/hook-form/RHFRadioGroup/index.js +0 -41
- package/components/hook-form/RHFSelect/index.js +0 -34
- package/components/hook-form/RHFTextField/index.js +0 -87
- package/components/hook-form/RHFUpload/index.js +0 -255
- package/components/mui_extended/Accordion/index.js +0 -105
- package/components/mui_extended/Avatar/index.js +0 -33
- package/components/mui_extended/BoxIcon/index.js +0 -20
- package/components/mui_extended/Breadcrumbs/index.js +0 -92
- package/components/mui_extended/Button/index.js +0 -131
- package/components/mui_extended/IconButton/index.js +0 -108
- package/components/mui_extended/LinkWithRoute/index.js +0 -30
- package/components/mui_extended/MenuPopover/index.js +0 -135
- package/components/mui_extended/Pager/index.js +0 -137
- package/components/mui_extended/Tab/index.js +0 -30
- package/components/mui_extended/Typography/index.js +0 -21
- package/contexts/ModalContext/index.js +0 -165
- package/hooks/useFormAddEdit/index.js +0 -42
- package/hooks/useModal/index.js +0 -4
- package/lodash.js +0 -62
- package/node_modules.js +0 -54
- package/react-data-grid.js +0 -2652
- package/react-draggable.js +0 -960
- package/react-json-view.js +0 -2764
- package/react-lazy-load-image-component.js +0 -792
- package/react-resizable.js +0 -541
- package/react-splitter-layout.js +0 -165
- package/utils/index.js +0 -572
package/react-draggable.js
DELETED
|
@@ -1,960 +0,0 @@
|
|
|
1
|
-
import React$1 from "react";
|
|
2
|
-
import require$$1 from "prop-types";
|
|
3
|
-
import require$$2 from "react-dom";
|
|
4
|
-
import clsx from "clsx";
|
|
5
|
-
import { s as shims, l as log, d as domFns, p as positionFns } from "./utils/index.js";
|
|
6
|
-
var cjs = { exports: {} };
|
|
7
|
-
var Draggable$2 = {};
|
|
8
|
-
var DraggableCore$2 = {};
|
|
9
|
-
function _typeof(obj) {
|
|
10
|
-
"@babel/helpers - typeof";
|
|
11
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
12
|
-
return typeof obj2;
|
|
13
|
-
} : function(obj2) {
|
|
14
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
15
|
-
}, _typeof(obj);
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(DraggableCore$2, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
});
|
|
20
|
-
DraggableCore$2.default = void 0;
|
|
21
|
-
var React = _interopRequireWildcard(React$1);
|
|
22
|
-
var _propTypes = _interopRequireDefault(require$$1);
|
|
23
|
-
var _reactDom = _interopRequireDefault(require$$2);
|
|
24
|
-
var _domFns = domFns;
|
|
25
|
-
var _positionFns = positionFns;
|
|
26
|
-
var _shims = shims;
|
|
27
|
-
var _log = _interopRequireDefault(log);
|
|
28
|
-
function _interopRequireDefault(obj) {
|
|
29
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
30
|
-
}
|
|
31
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
32
|
-
if (typeof WeakMap !== "function")
|
|
33
|
-
return null;
|
|
34
|
-
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
35
|
-
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
36
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
|
37
|
-
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
38
|
-
})(nodeInterop);
|
|
39
|
-
}
|
|
40
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
41
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
42
|
-
return obj;
|
|
43
|
-
}
|
|
44
|
-
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
|
45
|
-
return { default: obj };
|
|
46
|
-
}
|
|
47
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
48
|
-
if (cache && cache.has(obj)) {
|
|
49
|
-
return cache.get(obj);
|
|
50
|
-
}
|
|
51
|
-
var newObj = {};
|
|
52
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
|
-
for (var key in obj) {
|
|
54
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
55
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
56
|
-
if (desc && (desc.get || desc.set)) {
|
|
57
|
-
Object.defineProperty(newObj, key, desc);
|
|
58
|
-
} else {
|
|
59
|
-
newObj[key] = obj[key];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
newObj.default = obj;
|
|
64
|
-
if (cache) {
|
|
65
|
-
cache.set(obj, newObj);
|
|
66
|
-
}
|
|
67
|
-
return newObj;
|
|
68
|
-
}
|
|
69
|
-
function _slicedToArray(arr, i) {
|
|
70
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
71
|
-
}
|
|
72
|
-
function _nonIterableRest() {
|
|
73
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
|
-
}
|
|
75
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
76
|
-
if (!o)
|
|
77
|
-
return;
|
|
78
|
-
if (typeof o === "string")
|
|
79
|
-
return _arrayLikeToArray(o, minLen);
|
|
80
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
81
|
-
if (n === "Object" && o.constructor)
|
|
82
|
-
n = o.constructor.name;
|
|
83
|
-
if (n === "Map" || n === "Set")
|
|
84
|
-
return Array.from(o);
|
|
85
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
86
|
-
return _arrayLikeToArray(o, minLen);
|
|
87
|
-
}
|
|
88
|
-
function _arrayLikeToArray(arr, len) {
|
|
89
|
-
if (len == null || len > arr.length)
|
|
90
|
-
len = arr.length;
|
|
91
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
92
|
-
arr2[i] = arr[i];
|
|
93
|
-
}
|
|
94
|
-
return arr2;
|
|
95
|
-
}
|
|
96
|
-
function _iterableToArrayLimit(arr, i) {
|
|
97
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
98
|
-
if (_i == null)
|
|
99
|
-
return;
|
|
100
|
-
var _arr = [];
|
|
101
|
-
var _n = true;
|
|
102
|
-
var _d = false;
|
|
103
|
-
var _s, _e;
|
|
104
|
-
try {
|
|
105
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
106
|
-
_arr.push(_s.value);
|
|
107
|
-
if (i && _arr.length === i)
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
} catch (err) {
|
|
111
|
-
_d = true;
|
|
112
|
-
_e = err;
|
|
113
|
-
} finally {
|
|
114
|
-
try {
|
|
115
|
-
if (!_n && _i["return"] != null)
|
|
116
|
-
_i["return"]();
|
|
117
|
-
} finally {
|
|
118
|
-
if (_d)
|
|
119
|
-
throw _e;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return _arr;
|
|
123
|
-
}
|
|
124
|
-
function _arrayWithHoles(arr) {
|
|
125
|
-
if (Array.isArray(arr))
|
|
126
|
-
return arr;
|
|
127
|
-
}
|
|
128
|
-
function _classCallCheck(instance, Constructor) {
|
|
129
|
-
if (!(instance instanceof Constructor)) {
|
|
130
|
-
throw new TypeError("Cannot call a class as a function");
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function _defineProperties(target, props) {
|
|
134
|
-
for (var i = 0; i < props.length; i++) {
|
|
135
|
-
var descriptor = props[i];
|
|
136
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
137
|
-
descriptor.configurable = true;
|
|
138
|
-
if ("value" in descriptor)
|
|
139
|
-
descriptor.writable = true;
|
|
140
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
144
|
-
if (protoProps)
|
|
145
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
146
|
-
if (staticProps)
|
|
147
|
-
_defineProperties(Constructor, staticProps);
|
|
148
|
-
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
149
|
-
return Constructor;
|
|
150
|
-
}
|
|
151
|
-
function _inherits(subClass, superClass) {
|
|
152
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
153
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
154
|
-
}
|
|
155
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
156
|
-
Object.defineProperty(subClass, "prototype", { writable: false });
|
|
157
|
-
if (superClass)
|
|
158
|
-
_setPrototypeOf(subClass, superClass);
|
|
159
|
-
}
|
|
160
|
-
function _setPrototypeOf(o, p) {
|
|
161
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
162
|
-
o2.__proto__ = p2;
|
|
163
|
-
return o2;
|
|
164
|
-
};
|
|
165
|
-
return _setPrototypeOf(o, p);
|
|
166
|
-
}
|
|
167
|
-
function _createSuper(Derived) {
|
|
168
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
169
|
-
return function _createSuperInternal() {
|
|
170
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
171
|
-
if (hasNativeReflectConstruct) {
|
|
172
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
173
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
174
|
-
} else {
|
|
175
|
-
result = Super.apply(this, arguments);
|
|
176
|
-
}
|
|
177
|
-
return _possibleConstructorReturn(this, result);
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function _possibleConstructorReturn(self, call) {
|
|
181
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
182
|
-
return call;
|
|
183
|
-
} else if (call !== void 0) {
|
|
184
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
185
|
-
}
|
|
186
|
-
return _assertThisInitialized(self);
|
|
187
|
-
}
|
|
188
|
-
function _assertThisInitialized(self) {
|
|
189
|
-
if (self === void 0) {
|
|
190
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
191
|
-
}
|
|
192
|
-
return self;
|
|
193
|
-
}
|
|
194
|
-
function _isNativeReflectConstruct() {
|
|
195
|
-
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
196
|
-
return false;
|
|
197
|
-
if (Reflect.construct.sham)
|
|
198
|
-
return false;
|
|
199
|
-
if (typeof Proxy === "function")
|
|
200
|
-
return true;
|
|
201
|
-
try {
|
|
202
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
203
|
-
}));
|
|
204
|
-
return true;
|
|
205
|
-
} catch (e) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function _getPrototypeOf(o) {
|
|
210
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
211
|
-
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
212
|
-
};
|
|
213
|
-
return _getPrototypeOf(o);
|
|
214
|
-
}
|
|
215
|
-
function _defineProperty(obj, key, value) {
|
|
216
|
-
if (key in obj) {
|
|
217
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
218
|
-
} else {
|
|
219
|
-
obj[key] = value;
|
|
220
|
-
}
|
|
221
|
-
return obj;
|
|
222
|
-
}
|
|
223
|
-
var eventsFor = {
|
|
224
|
-
touch: {
|
|
225
|
-
start: "touchstart",
|
|
226
|
-
move: "touchmove",
|
|
227
|
-
stop: "touchend"
|
|
228
|
-
},
|
|
229
|
-
mouse: {
|
|
230
|
-
start: "mousedown",
|
|
231
|
-
move: "mousemove",
|
|
232
|
-
stop: "mouseup"
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
var dragEventFor = eventsFor.mouse;
|
|
236
|
-
var DraggableCore$1 = /* @__PURE__ */ function(_React$Component) {
|
|
237
|
-
_inherits(DraggableCore2, _React$Component);
|
|
238
|
-
var _super = _createSuper(DraggableCore2);
|
|
239
|
-
function DraggableCore2() {
|
|
240
|
-
var _this;
|
|
241
|
-
_classCallCheck(this, DraggableCore2);
|
|
242
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
243
|
-
args[_key] = arguments[_key];
|
|
244
|
-
}
|
|
245
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
246
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
247
|
-
dragging: false,
|
|
248
|
-
lastX: NaN,
|
|
249
|
-
lastY: NaN,
|
|
250
|
-
touchIdentifier: null
|
|
251
|
-
});
|
|
252
|
-
_defineProperty(_assertThisInitialized(_this), "mounted", false);
|
|
253
|
-
_defineProperty(_assertThisInitialized(_this), "handleDragStart", function(e) {
|
|
254
|
-
_this.props.onMouseDown(e);
|
|
255
|
-
if (!_this.props.allowAnyClick && typeof e.button === "number" && e.button !== 0)
|
|
256
|
-
return false;
|
|
257
|
-
var thisNode = _this.findDOMNode();
|
|
258
|
-
if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
|
259
|
-
throw new Error("<DraggableCore> not mounted on DragStart!");
|
|
260
|
-
}
|
|
261
|
-
var ownerDocument = thisNode.ownerDocument;
|
|
262
|
-
if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, thisNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, thisNode)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (e.type === "touchstart")
|
|
266
|
-
e.preventDefault();
|
|
267
|
-
var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
|
268
|
-
_this.setState({
|
|
269
|
-
touchIdentifier
|
|
270
|
-
});
|
|
271
|
-
var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _assertThisInitialized(_this));
|
|
272
|
-
if (position == null)
|
|
273
|
-
return;
|
|
274
|
-
var x = position.x, y = position.y;
|
|
275
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
|
|
276
|
-
(0, _log.default)("DraggableCore: handleDragStart: %j", coreEvent);
|
|
277
|
-
(0, _log.default)("calling", _this.props.onStart);
|
|
278
|
-
var shouldUpdate = _this.props.onStart(e, coreEvent);
|
|
279
|
-
if (shouldUpdate === false || _this.mounted === false)
|
|
280
|
-
return;
|
|
281
|
-
if (_this.props.enableUserSelectHack)
|
|
282
|
-
(0, _domFns.addUserSelectStyles)(ownerDocument);
|
|
283
|
-
_this.setState({
|
|
284
|
-
dragging: true,
|
|
285
|
-
lastX: x,
|
|
286
|
-
lastY: y
|
|
287
|
-
});
|
|
288
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
|
|
289
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
|
290
|
-
});
|
|
291
|
-
_defineProperty(_assertThisInitialized(_this), "handleDrag", function(e) {
|
|
292
|
-
var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
|
|
293
|
-
if (position == null)
|
|
294
|
-
return;
|
|
295
|
-
var x = position.x, y = position.y;
|
|
296
|
-
if (Array.isArray(_this.props.grid)) {
|
|
297
|
-
var deltaX = x - _this.state.lastX, deltaY = y - _this.state.lastY;
|
|
298
|
-
var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
|
|
299
|
-
var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
|
|
300
|
-
deltaX = _snapToGrid2[0];
|
|
301
|
-
deltaY = _snapToGrid2[1];
|
|
302
|
-
if (!deltaX && !deltaY)
|
|
303
|
-
return;
|
|
304
|
-
x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
|
|
305
|
-
}
|
|
306
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
|
|
307
|
-
(0, _log.default)("DraggableCore: handleDrag: %j", coreEvent);
|
|
308
|
-
var shouldUpdate = _this.props.onDrag(e, coreEvent);
|
|
309
|
-
if (shouldUpdate === false || _this.mounted === false) {
|
|
310
|
-
try {
|
|
311
|
-
_this.handleDragStop(new MouseEvent("mouseup"));
|
|
312
|
-
} catch (err) {
|
|
313
|
-
var event = document.createEvent("MouseEvents");
|
|
314
|
-
event.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
315
|
-
_this.handleDragStop(event);
|
|
316
|
-
}
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
_this.setState({
|
|
320
|
-
lastX: x,
|
|
321
|
-
lastY: y
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
_defineProperty(_assertThisInitialized(_this), "handleDragStop", function(e) {
|
|
325
|
-
if (!_this.state.dragging)
|
|
326
|
-
return;
|
|
327
|
-
var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
|
|
328
|
-
if (position == null)
|
|
329
|
-
return;
|
|
330
|
-
var x = position.x, y = position.y;
|
|
331
|
-
if (Array.isArray(_this.props.grid)) {
|
|
332
|
-
var deltaX = x - _this.state.lastX || 0;
|
|
333
|
-
var deltaY = y - _this.state.lastY || 0;
|
|
334
|
-
var _snapToGrid3 = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
|
|
335
|
-
var _snapToGrid4 = _slicedToArray(_snapToGrid3, 2);
|
|
336
|
-
deltaX = _snapToGrid4[0];
|
|
337
|
-
deltaY = _snapToGrid4[1];
|
|
338
|
-
x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
|
|
339
|
-
}
|
|
340
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
|
|
341
|
-
var shouldContinue = _this.props.onStop(e, coreEvent);
|
|
342
|
-
if (shouldContinue === false || _this.mounted === false)
|
|
343
|
-
return false;
|
|
344
|
-
var thisNode = _this.findDOMNode();
|
|
345
|
-
if (thisNode) {
|
|
346
|
-
if (_this.props.enableUserSelectHack)
|
|
347
|
-
(0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
|
348
|
-
}
|
|
349
|
-
(0, _log.default)("DraggableCore: handleDragStop: %j", coreEvent);
|
|
350
|
-
_this.setState({
|
|
351
|
-
dragging: false,
|
|
352
|
-
lastX: NaN,
|
|
353
|
-
lastY: NaN
|
|
354
|
-
});
|
|
355
|
-
if (thisNode) {
|
|
356
|
-
(0, _log.default)("DraggableCore: Removing handlers");
|
|
357
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
|
|
358
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function(e) {
|
|
362
|
-
dragEventFor = eventsFor.mouse;
|
|
363
|
-
return _this.handleDragStart(e);
|
|
364
|
-
});
|
|
365
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseUp", function(e) {
|
|
366
|
-
dragEventFor = eventsFor.mouse;
|
|
367
|
-
return _this.handleDragStop(e);
|
|
368
|
-
});
|
|
369
|
-
_defineProperty(_assertThisInitialized(_this), "onTouchStart", function(e) {
|
|
370
|
-
dragEventFor = eventsFor.touch;
|
|
371
|
-
return _this.handleDragStart(e);
|
|
372
|
-
});
|
|
373
|
-
_defineProperty(_assertThisInitialized(_this), "onTouchEnd", function(e) {
|
|
374
|
-
dragEventFor = eventsFor.touch;
|
|
375
|
-
return _this.handleDragStop(e);
|
|
376
|
-
});
|
|
377
|
-
return _this;
|
|
378
|
-
}
|
|
379
|
-
_createClass(DraggableCore2, [{
|
|
380
|
-
key: "componentDidMount",
|
|
381
|
-
value: function componentDidMount() {
|
|
382
|
-
this.mounted = true;
|
|
383
|
-
var thisNode = this.findDOMNode();
|
|
384
|
-
if (thisNode) {
|
|
385
|
-
(0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
386
|
-
passive: false
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}, {
|
|
391
|
-
key: "componentWillUnmount",
|
|
392
|
-
value: function componentWillUnmount() {
|
|
393
|
-
this.mounted = false;
|
|
394
|
-
var thisNode = this.findDOMNode();
|
|
395
|
-
if (thisNode) {
|
|
396
|
-
var ownerDocument = thisNode.ownerDocument;
|
|
397
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
|
398
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
|
399
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
|
400
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
|
401
|
-
(0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
402
|
-
passive: false
|
|
403
|
-
});
|
|
404
|
-
if (this.props.enableUserSelectHack)
|
|
405
|
-
(0, _domFns.removeUserSelectStyles)(ownerDocument);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}, {
|
|
409
|
-
key: "findDOMNode",
|
|
410
|
-
value: function findDOMNode() {
|
|
411
|
-
var _this$props, _this$props2, _this$props2$nodeRef;
|
|
412
|
-
return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$nodeRef = _this$props2.nodeRef) === null || _this$props2$nodeRef === void 0 ? void 0 : _this$props2$nodeRef.current : _reactDom.default.findDOMNode(this);
|
|
413
|
-
}
|
|
414
|
-
}, {
|
|
415
|
-
key: "render",
|
|
416
|
-
value: function render() {
|
|
417
|
-
return /* @__PURE__ */ React.cloneElement(React.Children.only(this.props.children), {
|
|
418
|
-
onMouseDown: this.onMouseDown,
|
|
419
|
-
onMouseUp: this.onMouseUp,
|
|
420
|
-
onTouchEnd: this.onTouchEnd
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
}]);
|
|
424
|
-
return DraggableCore2;
|
|
425
|
-
}(React.Component);
|
|
426
|
-
DraggableCore$2.default = DraggableCore$1;
|
|
427
|
-
_defineProperty(DraggableCore$1, "displayName", "DraggableCore");
|
|
428
|
-
_defineProperty(DraggableCore$1, "propTypes", {
|
|
429
|
-
allowAnyClick: _propTypes.default.bool,
|
|
430
|
-
disabled: _propTypes.default.bool,
|
|
431
|
-
enableUserSelectHack: _propTypes.default.bool,
|
|
432
|
-
offsetParent: function offsetParent(props, propName) {
|
|
433
|
-
if (props[propName] && props[propName].nodeType !== 1) {
|
|
434
|
-
throw new Error("Draggable's offsetParent must be a DOM Node.");
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
438
|
-
handle: _propTypes.default.string,
|
|
439
|
-
cancel: _propTypes.default.string,
|
|
440
|
-
nodeRef: _propTypes.default.object,
|
|
441
|
-
onStart: _propTypes.default.func,
|
|
442
|
-
onDrag: _propTypes.default.func,
|
|
443
|
-
onStop: _propTypes.default.func,
|
|
444
|
-
onMouseDown: _propTypes.default.func,
|
|
445
|
-
scale: _propTypes.default.number,
|
|
446
|
-
className: _shims.dontSetMe,
|
|
447
|
-
style: _shims.dontSetMe,
|
|
448
|
-
transform: _shims.dontSetMe
|
|
449
|
-
});
|
|
450
|
-
_defineProperty(DraggableCore$1, "defaultProps", {
|
|
451
|
-
allowAnyClick: false,
|
|
452
|
-
disabled: false,
|
|
453
|
-
enableUserSelectHack: true,
|
|
454
|
-
onStart: function onStart() {
|
|
455
|
-
},
|
|
456
|
-
onDrag: function onDrag() {
|
|
457
|
-
},
|
|
458
|
-
onStop: function onStop() {
|
|
459
|
-
},
|
|
460
|
-
onMouseDown: function onMouseDown() {
|
|
461
|
-
},
|
|
462
|
-
scale: 1
|
|
463
|
-
});
|
|
464
|
-
(function(exports) {
|
|
465
|
-
function _typeof2(obj) {
|
|
466
|
-
"@babel/helpers - typeof";
|
|
467
|
-
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
468
|
-
return typeof obj2;
|
|
469
|
-
} : function(obj2) {
|
|
470
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
471
|
-
}, _typeof2(obj);
|
|
472
|
-
}
|
|
473
|
-
Object.defineProperty(exports, "__esModule", {
|
|
474
|
-
value: true
|
|
475
|
-
});
|
|
476
|
-
Object.defineProperty(exports, "DraggableCore", {
|
|
477
|
-
enumerable: true,
|
|
478
|
-
get: function get() {
|
|
479
|
-
return _DraggableCore.default;
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
exports.default = void 0;
|
|
483
|
-
var React2 = _interopRequireWildcard2(React$1);
|
|
484
|
-
var _propTypes2 = _interopRequireDefault2(require$$1);
|
|
485
|
-
var _reactDom2 = _interopRequireDefault2(require$$2);
|
|
486
|
-
var _clsx2 = _interopRequireDefault2(clsx);
|
|
487
|
-
var _domFns2 = domFns;
|
|
488
|
-
var _positionFns2 = positionFns;
|
|
489
|
-
var _shims2 = shims;
|
|
490
|
-
var _DraggableCore = _interopRequireDefault2(DraggableCore$2);
|
|
491
|
-
var _log2 = _interopRequireDefault2(log);
|
|
492
|
-
var _excluded = ["axis", "bounds", "children", "defaultPosition", "defaultClassName", "defaultClassNameDragging", "defaultClassNameDragged", "position", "positionOffset", "scale"];
|
|
493
|
-
function _interopRequireDefault2(obj) {
|
|
494
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
495
|
-
}
|
|
496
|
-
function _getRequireWildcardCache2(nodeInterop) {
|
|
497
|
-
if (typeof WeakMap !== "function")
|
|
498
|
-
return null;
|
|
499
|
-
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
500
|
-
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
501
|
-
return (_getRequireWildcardCache2 = function _getRequireWildcardCache3(nodeInterop2) {
|
|
502
|
-
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
503
|
-
})(nodeInterop);
|
|
504
|
-
}
|
|
505
|
-
function _interopRequireWildcard2(obj, nodeInterop) {
|
|
506
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
507
|
-
return obj;
|
|
508
|
-
}
|
|
509
|
-
if (obj === null || _typeof2(obj) !== "object" && typeof obj !== "function") {
|
|
510
|
-
return { default: obj };
|
|
511
|
-
}
|
|
512
|
-
var cache = _getRequireWildcardCache2(nodeInterop);
|
|
513
|
-
if (cache && cache.has(obj)) {
|
|
514
|
-
return cache.get(obj);
|
|
515
|
-
}
|
|
516
|
-
var newObj = {};
|
|
517
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
518
|
-
for (var key in obj) {
|
|
519
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
520
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
521
|
-
if (desc && (desc.get || desc.set)) {
|
|
522
|
-
Object.defineProperty(newObj, key, desc);
|
|
523
|
-
} else {
|
|
524
|
-
newObj[key] = obj[key];
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
newObj.default = obj;
|
|
529
|
-
if (cache) {
|
|
530
|
-
cache.set(obj, newObj);
|
|
531
|
-
}
|
|
532
|
-
return newObj;
|
|
533
|
-
}
|
|
534
|
-
function _extends() {
|
|
535
|
-
_extends = Object.assign || function(target) {
|
|
536
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
537
|
-
var source = arguments[i];
|
|
538
|
-
for (var key in source) {
|
|
539
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
540
|
-
target[key] = source[key];
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
return target;
|
|
545
|
-
};
|
|
546
|
-
return _extends.apply(this, arguments);
|
|
547
|
-
}
|
|
548
|
-
function _objectWithoutProperties(source, excluded) {
|
|
549
|
-
if (source == null)
|
|
550
|
-
return {};
|
|
551
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
552
|
-
var key, i;
|
|
553
|
-
if (Object.getOwnPropertySymbols) {
|
|
554
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
555
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
556
|
-
key = sourceSymbolKeys[i];
|
|
557
|
-
if (excluded.indexOf(key) >= 0)
|
|
558
|
-
continue;
|
|
559
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
560
|
-
continue;
|
|
561
|
-
target[key] = source[key];
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
return target;
|
|
565
|
-
}
|
|
566
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
567
|
-
if (source == null)
|
|
568
|
-
return {};
|
|
569
|
-
var target = {};
|
|
570
|
-
var sourceKeys = Object.keys(source);
|
|
571
|
-
var key, i;
|
|
572
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
573
|
-
key = sourceKeys[i];
|
|
574
|
-
if (excluded.indexOf(key) >= 0)
|
|
575
|
-
continue;
|
|
576
|
-
target[key] = source[key];
|
|
577
|
-
}
|
|
578
|
-
return target;
|
|
579
|
-
}
|
|
580
|
-
function ownKeys(object, enumerableOnly) {
|
|
581
|
-
var keys = Object.keys(object);
|
|
582
|
-
if (Object.getOwnPropertySymbols) {
|
|
583
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
584
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
585
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
586
|
-
})), keys.push.apply(keys, symbols);
|
|
587
|
-
}
|
|
588
|
-
return keys;
|
|
589
|
-
}
|
|
590
|
-
function _objectSpread(target) {
|
|
591
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
592
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
593
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
594
|
-
_defineProperty2(target, key, source[key]);
|
|
595
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
596
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
return target;
|
|
600
|
-
}
|
|
601
|
-
function _slicedToArray2(arr, i) {
|
|
602
|
-
return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i) || _unsupportedIterableToArray2(arr, i) || _nonIterableRest2();
|
|
603
|
-
}
|
|
604
|
-
function _nonIterableRest2() {
|
|
605
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
606
|
-
}
|
|
607
|
-
function _unsupportedIterableToArray2(o, minLen) {
|
|
608
|
-
if (!o)
|
|
609
|
-
return;
|
|
610
|
-
if (typeof o === "string")
|
|
611
|
-
return _arrayLikeToArray2(o, minLen);
|
|
612
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
613
|
-
if (n === "Object" && o.constructor)
|
|
614
|
-
n = o.constructor.name;
|
|
615
|
-
if (n === "Map" || n === "Set")
|
|
616
|
-
return Array.from(o);
|
|
617
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
618
|
-
return _arrayLikeToArray2(o, minLen);
|
|
619
|
-
}
|
|
620
|
-
function _arrayLikeToArray2(arr, len) {
|
|
621
|
-
if (len == null || len > arr.length)
|
|
622
|
-
len = arr.length;
|
|
623
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
624
|
-
arr2[i] = arr[i];
|
|
625
|
-
}
|
|
626
|
-
return arr2;
|
|
627
|
-
}
|
|
628
|
-
function _iterableToArrayLimit2(arr, i) {
|
|
629
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
630
|
-
if (_i == null)
|
|
631
|
-
return;
|
|
632
|
-
var _arr = [];
|
|
633
|
-
var _n = true;
|
|
634
|
-
var _d = false;
|
|
635
|
-
var _s, _e;
|
|
636
|
-
try {
|
|
637
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
638
|
-
_arr.push(_s.value);
|
|
639
|
-
if (i && _arr.length === i)
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
} catch (err) {
|
|
643
|
-
_d = true;
|
|
644
|
-
_e = err;
|
|
645
|
-
} finally {
|
|
646
|
-
try {
|
|
647
|
-
if (!_n && _i["return"] != null)
|
|
648
|
-
_i["return"]();
|
|
649
|
-
} finally {
|
|
650
|
-
if (_d)
|
|
651
|
-
throw _e;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
return _arr;
|
|
655
|
-
}
|
|
656
|
-
function _arrayWithHoles2(arr) {
|
|
657
|
-
if (Array.isArray(arr))
|
|
658
|
-
return arr;
|
|
659
|
-
}
|
|
660
|
-
function _classCallCheck2(instance, Constructor) {
|
|
661
|
-
if (!(instance instanceof Constructor)) {
|
|
662
|
-
throw new TypeError("Cannot call a class as a function");
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
function _defineProperties2(target, props) {
|
|
666
|
-
for (var i = 0; i < props.length; i++) {
|
|
667
|
-
var descriptor = props[i];
|
|
668
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
669
|
-
descriptor.configurable = true;
|
|
670
|
-
if ("value" in descriptor)
|
|
671
|
-
descriptor.writable = true;
|
|
672
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
function _createClass2(Constructor, protoProps, staticProps) {
|
|
676
|
-
if (protoProps)
|
|
677
|
-
_defineProperties2(Constructor.prototype, protoProps);
|
|
678
|
-
if (staticProps)
|
|
679
|
-
_defineProperties2(Constructor, staticProps);
|
|
680
|
-
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
681
|
-
return Constructor;
|
|
682
|
-
}
|
|
683
|
-
function _inherits2(subClass, superClass) {
|
|
684
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
685
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
686
|
-
}
|
|
687
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
688
|
-
Object.defineProperty(subClass, "prototype", { writable: false });
|
|
689
|
-
if (superClass)
|
|
690
|
-
_setPrototypeOf2(subClass, superClass);
|
|
691
|
-
}
|
|
692
|
-
function _setPrototypeOf2(o, p) {
|
|
693
|
-
_setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf3(o2, p2) {
|
|
694
|
-
o2.__proto__ = p2;
|
|
695
|
-
return o2;
|
|
696
|
-
};
|
|
697
|
-
return _setPrototypeOf2(o, p);
|
|
698
|
-
}
|
|
699
|
-
function _createSuper2(Derived) {
|
|
700
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct2();
|
|
701
|
-
return function _createSuperInternal() {
|
|
702
|
-
var Super = _getPrototypeOf2(Derived), result;
|
|
703
|
-
if (hasNativeReflectConstruct) {
|
|
704
|
-
var NewTarget = _getPrototypeOf2(this).constructor;
|
|
705
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
706
|
-
} else {
|
|
707
|
-
result = Super.apply(this, arguments);
|
|
708
|
-
}
|
|
709
|
-
return _possibleConstructorReturn2(this, result);
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
function _possibleConstructorReturn2(self, call) {
|
|
713
|
-
if (call && (_typeof2(call) === "object" || typeof call === "function")) {
|
|
714
|
-
return call;
|
|
715
|
-
} else if (call !== void 0) {
|
|
716
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
717
|
-
}
|
|
718
|
-
return _assertThisInitialized2(self);
|
|
719
|
-
}
|
|
720
|
-
function _assertThisInitialized2(self) {
|
|
721
|
-
if (self === void 0) {
|
|
722
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
723
|
-
}
|
|
724
|
-
return self;
|
|
725
|
-
}
|
|
726
|
-
function _isNativeReflectConstruct2() {
|
|
727
|
-
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
728
|
-
return false;
|
|
729
|
-
if (Reflect.construct.sham)
|
|
730
|
-
return false;
|
|
731
|
-
if (typeof Proxy === "function")
|
|
732
|
-
return true;
|
|
733
|
-
try {
|
|
734
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
735
|
-
}));
|
|
736
|
-
return true;
|
|
737
|
-
} catch (e) {
|
|
738
|
-
return false;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function _getPrototypeOf2(o) {
|
|
742
|
-
_getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf3(o2) {
|
|
743
|
-
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
744
|
-
};
|
|
745
|
-
return _getPrototypeOf2(o);
|
|
746
|
-
}
|
|
747
|
-
function _defineProperty2(obj, key, value) {
|
|
748
|
-
if (key in obj) {
|
|
749
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
750
|
-
} else {
|
|
751
|
-
obj[key] = value;
|
|
752
|
-
}
|
|
753
|
-
return obj;
|
|
754
|
-
}
|
|
755
|
-
var Draggable2 = /* @__PURE__ */ function(_React$Component) {
|
|
756
|
-
_inherits2(Draggable3, _React$Component);
|
|
757
|
-
var _super = _createSuper2(Draggable3);
|
|
758
|
-
function Draggable3(props) {
|
|
759
|
-
var _this;
|
|
760
|
-
_classCallCheck2(this, Draggable3);
|
|
761
|
-
_this = _super.call(this, props);
|
|
762
|
-
_defineProperty2(_assertThisInitialized2(_this), "onDragStart", function(e, coreData) {
|
|
763
|
-
(0, _log2.default)("Draggable: onDragStart: %j", coreData);
|
|
764
|
-
var shouldStart = _this.props.onStart(e, (0, _positionFns2.createDraggableData)(_assertThisInitialized2(_this), coreData));
|
|
765
|
-
if (shouldStart === false)
|
|
766
|
-
return false;
|
|
767
|
-
_this.setState({
|
|
768
|
-
dragging: true,
|
|
769
|
-
dragged: true
|
|
770
|
-
});
|
|
771
|
-
});
|
|
772
|
-
_defineProperty2(_assertThisInitialized2(_this), "onDrag", function(e, coreData) {
|
|
773
|
-
if (!_this.state.dragging)
|
|
774
|
-
return false;
|
|
775
|
-
(0, _log2.default)("Draggable: onDrag: %j", coreData);
|
|
776
|
-
var uiData = (0, _positionFns2.createDraggableData)(_assertThisInitialized2(_this), coreData);
|
|
777
|
-
var newState = {
|
|
778
|
-
x: uiData.x,
|
|
779
|
-
y: uiData.y
|
|
780
|
-
};
|
|
781
|
-
if (_this.props.bounds) {
|
|
782
|
-
var x = newState.x, y = newState.y;
|
|
783
|
-
newState.x += _this.state.slackX;
|
|
784
|
-
newState.y += _this.state.slackY;
|
|
785
|
-
var _getBoundPosition = (0, _positionFns2.getBoundPosition)(_assertThisInitialized2(_this), newState.x, newState.y), _getBoundPosition2 = _slicedToArray2(_getBoundPosition, 2), newStateX = _getBoundPosition2[0], newStateY = _getBoundPosition2[1];
|
|
786
|
-
newState.x = newStateX;
|
|
787
|
-
newState.y = newStateY;
|
|
788
|
-
newState.slackX = _this.state.slackX + (x - newState.x);
|
|
789
|
-
newState.slackY = _this.state.slackY + (y - newState.y);
|
|
790
|
-
uiData.x = newState.x;
|
|
791
|
-
uiData.y = newState.y;
|
|
792
|
-
uiData.deltaX = newState.x - _this.state.x;
|
|
793
|
-
uiData.deltaY = newState.y - _this.state.y;
|
|
794
|
-
}
|
|
795
|
-
var shouldUpdate = _this.props.onDrag(e, uiData);
|
|
796
|
-
if (shouldUpdate === false)
|
|
797
|
-
return false;
|
|
798
|
-
_this.setState(newState);
|
|
799
|
-
});
|
|
800
|
-
_defineProperty2(_assertThisInitialized2(_this), "onDragStop", function(e, coreData) {
|
|
801
|
-
if (!_this.state.dragging)
|
|
802
|
-
return false;
|
|
803
|
-
var shouldContinue = _this.props.onStop(e, (0, _positionFns2.createDraggableData)(_assertThisInitialized2(_this), coreData));
|
|
804
|
-
if (shouldContinue === false)
|
|
805
|
-
return false;
|
|
806
|
-
(0, _log2.default)("Draggable: onDragStop: %j", coreData);
|
|
807
|
-
var newState = {
|
|
808
|
-
dragging: false,
|
|
809
|
-
slackX: 0,
|
|
810
|
-
slackY: 0
|
|
811
|
-
};
|
|
812
|
-
var controlled = Boolean(_this.props.position);
|
|
813
|
-
if (controlled) {
|
|
814
|
-
var _this$props$position = _this.props.position, x = _this$props$position.x, y = _this$props$position.y;
|
|
815
|
-
newState.x = x;
|
|
816
|
-
newState.y = y;
|
|
817
|
-
}
|
|
818
|
-
_this.setState(newState);
|
|
819
|
-
});
|
|
820
|
-
_this.state = {
|
|
821
|
-
dragging: false,
|
|
822
|
-
dragged: false,
|
|
823
|
-
x: props.position ? props.position.x : props.defaultPosition.x,
|
|
824
|
-
y: props.position ? props.position.y : props.defaultPosition.y,
|
|
825
|
-
prevPropsPosition: _objectSpread({}, props.position),
|
|
826
|
-
slackX: 0,
|
|
827
|
-
slackY: 0,
|
|
828
|
-
isElementSVG: false
|
|
829
|
-
};
|
|
830
|
-
if (props.position && !(props.onDrag || props.onStop)) {
|
|
831
|
-
console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
|
|
832
|
-
}
|
|
833
|
-
return _this;
|
|
834
|
-
}
|
|
835
|
-
_createClass2(Draggable3, [{
|
|
836
|
-
key: "componentDidMount",
|
|
837
|
-
value: function componentDidMount() {
|
|
838
|
-
if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) {
|
|
839
|
-
this.setState({
|
|
840
|
-
isElementSVG: true
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}, {
|
|
845
|
-
key: "componentWillUnmount",
|
|
846
|
-
value: function componentWillUnmount() {
|
|
847
|
-
this.setState({
|
|
848
|
-
dragging: false
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
}, {
|
|
852
|
-
key: "findDOMNode",
|
|
853
|
-
value: function findDOMNode() {
|
|
854
|
-
var _this$props$nodeRef$c, _this$props, _this$props$nodeRef;
|
|
855
|
-
return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$nodeRef = _this$props.nodeRef) === null || _this$props$nodeRef === void 0 ? void 0 : _this$props$nodeRef.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom2.default.findDOMNode(this);
|
|
856
|
-
}
|
|
857
|
-
}, {
|
|
858
|
-
key: "render",
|
|
859
|
-
value: function render() {
|
|
860
|
-
var _clsx;
|
|
861
|
-
var _this$props2 = this.props;
|
|
862
|
-
_this$props2.axis;
|
|
863
|
-
_this$props2.bounds;
|
|
864
|
-
var children = _this$props2.children, defaultPosition = _this$props2.defaultPosition, defaultClassName = _this$props2.defaultClassName, defaultClassNameDragging = _this$props2.defaultClassNameDragging, defaultClassNameDragged = _this$props2.defaultClassNameDragged, position = _this$props2.position, positionOffset = _this$props2.positionOffset;
|
|
865
|
-
_this$props2.scale;
|
|
866
|
-
var draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
867
|
-
var style = {};
|
|
868
|
-
var svgTransform = null;
|
|
869
|
-
var controlled = Boolean(position);
|
|
870
|
-
var draggable = !controlled || this.state.dragging;
|
|
871
|
-
var validPosition = position || defaultPosition;
|
|
872
|
-
var transformOpts = {
|
|
873
|
-
x: (0, _positionFns2.canDragX)(this) && draggable ? this.state.x : validPosition.x,
|
|
874
|
-
y: (0, _positionFns2.canDragY)(this) && draggable ? this.state.y : validPosition.y
|
|
875
|
-
};
|
|
876
|
-
if (this.state.isElementSVG) {
|
|
877
|
-
svgTransform = (0, _domFns2.createSVGTransform)(transformOpts, positionOffset);
|
|
878
|
-
} else {
|
|
879
|
-
style = (0, _domFns2.createCSSTransform)(transformOpts, positionOffset);
|
|
880
|
-
}
|
|
881
|
-
var className = (0, _clsx2.default)(children.props.className || "", defaultClassName, (_clsx = {}, _defineProperty2(_clsx, defaultClassNameDragging, this.state.dragging), _defineProperty2(_clsx, defaultClassNameDragged, this.state.dragged), _clsx));
|
|
882
|
-
return /* @__PURE__ */ React2.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
|
|
883
|
-
onStart: this.onDragStart,
|
|
884
|
-
onDrag: this.onDrag,
|
|
885
|
-
onStop: this.onDragStop
|
|
886
|
-
}), /* @__PURE__ */ React2.cloneElement(React2.Children.only(children), {
|
|
887
|
-
className,
|
|
888
|
-
style: _objectSpread(_objectSpread({}, children.props.style), style),
|
|
889
|
-
transform: svgTransform
|
|
890
|
-
}));
|
|
891
|
-
}
|
|
892
|
-
}], [{
|
|
893
|
-
key: "getDerivedStateFromProps",
|
|
894
|
-
value: function getDerivedStateFromProps(_ref, _ref2) {
|
|
895
|
-
var position = _ref.position;
|
|
896
|
-
var prevPropsPosition = _ref2.prevPropsPosition;
|
|
897
|
-
if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
|
|
898
|
-
(0, _log2.default)("Draggable: getDerivedStateFromProps %j", {
|
|
899
|
-
position,
|
|
900
|
-
prevPropsPosition
|
|
901
|
-
});
|
|
902
|
-
return {
|
|
903
|
-
x: position.x,
|
|
904
|
-
y: position.y,
|
|
905
|
-
prevPropsPosition: _objectSpread({}, position)
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
return null;
|
|
909
|
-
}
|
|
910
|
-
}]);
|
|
911
|
-
return Draggable3;
|
|
912
|
-
}(React2.Component);
|
|
913
|
-
exports.default = Draggable2;
|
|
914
|
-
_defineProperty2(Draggable2, "displayName", "Draggable");
|
|
915
|
-
_defineProperty2(Draggable2, "propTypes", _objectSpread(_objectSpread({}, _DraggableCore.default.propTypes), {}, {
|
|
916
|
-
axis: _propTypes2.default.oneOf(["both", "x", "y", "none"]),
|
|
917
|
-
bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
|
|
918
|
-
left: _propTypes2.default.number,
|
|
919
|
-
right: _propTypes2.default.number,
|
|
920
|
-
top: _propTypes2.default.number,
|
|
921
|
-
bottom: _propTypes2.default.number
|
|
922
|
-
}), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
|
|
923
|
-
defaultClassName: _propTypes2.default.string,
|
|
924
|
-
defaultClassNameDragging: _propTypes2.default.string,
|
|
925
|
-
defaultClassNameDragged: _propTypes2.default.string,
|
|
926
|
-
defaultPosition: _propTypes2.default.shape({
|
|
927
|
-
x: _propTypes2.default.number,
|
|
928
|
-
y: _propTypes2.default.number
|
|
929
|
-
}),
|
|
930
|
-
positionOffset: _propTypes2.default.shape({
|
|
931
|
-
x: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
|
|
932
|
-
y: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
|
|
933
|
-
}),
|
|
934
|
-
position: _propTypes2.default.shape({
|
|
935
|
-
x: _propTypes2.default.number,
|
|
936
|
-
y: _propTypes2.default.number
|
|
937
|
-
}),
|
|
938
|
-
className: _shims2.dontSetMe,
|
|
939
|
-
style: _shims2.dontSetMe,
|
|
940
|
-
transform: _shims2.dontSetMe
|
|
941
|
-
}));
|
|
942
|
-
_defineProperty2(Draggable2, "defaultProps", _objectSpread(_objectSpread({}, _DraggableCore.default.defaultProps), {}, {
|
|
943
|
-
axis: "both",
|
|
944
|
-
bounds: false,
|
|
945
|
-
defaultClassName: "react-draggable",
|
|
946
|
-
defaultClassNameDragging: "react-draggable-dragging",
|
|
947
|
-
defaultClassNameDragged: "react-draggable-dragged",
|
|
948
|
-
defaultPosition: {
|
|
949
|
-
x: 0,
|
|
950
|
-
y: 0
|
|
951
|
-
},
|
|
952
|
-
scale: 1
|
|
953
|
-
}));
|
|
954
|
-
})(Draggable$2);
|
|
955
|
-
var _require = Draggable$2, Draggable = _require.default, DraggableCore = _require.DraggableCore;
|
|
956
|
-
cjs.exports = Draggable;
|
|
957
|
-
cjs.exports.default = Draggable;
|
|
958
|
-
cjs.exports.DraggableCore = DraggableCore;
|
|
959
|
-
const Draggable$1 = cjs.exports;
|
|
960
|
-
export { Draggable$1 as D, cjs as c };
|