@m4l/components 0.1.26 → 0.1.28
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 +42 -35
- package/commonjs.565e6834.js +5 -5
- package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
- package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
- package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
- package/components/DataGrid/index.76d8fd25.js +1075 -0
- package/components/DynamicFilter/index.342ba5fe.js +1577 -0
- package/components/ErrorLabel/index.c8615f16.js +13 -12
- package/components/Icon/index.619c31c4.js +96 -0
- package/components/Icon/types.d.ts +2 -1
- package/components/Image/index.93d5f37f.js +190 -0
- package/components/Loadable/index.f5518558.js +8 -8
- package/components/ModalDialog/index.9ea10764.js +184 -0
- package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
- package/components/ObjectLogs/index.f941fb79.js +288 -0
- package/components/Page/index.4237c241.js +22 -20
- package/components/PaperForm/index.ec9cb8c9.js +112 -0
- package/components/Period/index.2941fbda.js +249 -0
- package/components/PropertyValue/index.dfcfe1ba.js +147 -0
- package/components/PropertyValue/styles.d.ts +2 -1
- package/components/PropertyValue/types.d.ts +3 -3
- package/components/Resizeable/index.45995d2b.js +19 -19
- package/components/ScrollBar/index.39eeb2de.js +26 -21
- package/components/ScrollToTop/index.e06f98f6.js +8 -7
- package/components/SplitLayout/index.4032673d.js +35 -33
- package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
- package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
- package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
- package/components/animate/features.0fbf41e1.js +3 -3
- package/components/animate/variants/bounce.784aaaaa.js +16 -13
- package/components/animate/variants/container.11f82b76.js +8 -6
- package/components/animate/variants/fade.b561c0fc.js +32 -28
- package/components/animate/variants/transition.bd46b9ce.js +17 -12
- package/components/formatters/BooleanFormatter/index.8da35c9c.js +55 -0
- package/components/formatters/DateFormatter/index.1b9baacc.js +69 -0
- package/components/formatters/index.689a8086.js +119 -0
- package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
- package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
- package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
- package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
- package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
- package/components/hook-form/RHFTextField/index.f9aaaa90.js +146 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/styles.d.ts +4 -3
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/types.d.ts +0 -0
- package/components/hook-form/RHFUpload/index.d5cc7c13.js +285 -0
- package/components/mui_extended/Accordion/index.a02ac6ae.js +107 -0
- package/components/mui_extended/Avatar/index.fe06afd7.js +51 -0
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
- package/components/mui_extended/Button/index.53b56958.js +178 -0
- package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
- package/components/mui_extended/IconButton/index.a321e5cb.js +120 -0
- package/components/mui_extended/IconButton/index.d.ts +1 -1
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
- package/components/mui_extended/Pager/index.c0865b70.js +141 -0
- package/components/mui_extended/Popover/index.705275a4.js +278 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
- package/components/mui_extended/Typography/index.e5494696.js +25 -21
- package/contexts/ModalContext/index.b92fa565.js +153 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
- package/contexts/RHFormContext/index.b142190a.js +63 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
- package/hooks/useModal/index.5fee01a3.js +11 -0
- package/index.js +153 -153
- package/package.json +2 -1
- package/react-data-grid.d46d625e.js +2206 -1663
- package/react-draggable.20e95c61.js +800 -553
- package/react-json-view.f56a7f8e.js +2344 -2340
- package/react-resizable.5277deaf.js +470 -298
- package/react-splitter-layout.7810ac1b.js +130 -128
- package/utils/index.214d9542.js +500 -354
- package/components/CommonActions/components/ActionCancel/index.6736b782.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.281ee166.js +0 -49
- package/components/CommonActions/components/ActionIntro/index.4665a611.js +0 -18
- package/components/CommonActions/components/Actions/index.cd7b2671.js +0 -742
- package/components/DataGrid/index.2caf6231.js +0 -894
- package/components/DynamicFilter/index.f2377369.js +0 -1157
- package/components/Icon/index.f569765b.js +0 -82
- package/components/Image/index.c9da2d5a.js +0 -152
- package/components/ModalDialog/index.bee344a5.js +0 -168
- package/components/ObjectLogs/index.6b6f95e6.js +0 -266
- package/components/PaperForm/index.3f8c7ef2.js +0 -105
- package/components/Period/index.a112ce37.js +0 -175
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/contexts/RHFormContext/index.33dba822.js +0 -56
- package/components/formatters/BooleanFormatter/index.3ec56305.js +0 -42
- package/components/formatters/DateFormatter/index.08d8823b.js +0 -57
- package/components/formatters/index.6959c2de.js +0 -106
- package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
- package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
- package/components/hook-form/RHFPeriod/index.979d0898.js +0 -51
- package/components/hook-form/RHFTextField/index.ba2a8f67.js +0 -129
- package/components/hook-form/RHFUpload/index.6347159a.js +0 -258
- package/components/mui_extended/Accordion/index.49f5df8e.js +0 -103
- package/components/mui_extended/Avatar/index.dadb0528.js +0 -37
- package/components/mui_extended/Button/index.52d18aea.js +0 -144
- package/components/mui_extended/IconButton/index.4b5ce8b5.js +0 -103
- package/components/mui_extended/Pager/index.951b6975.js +0 -126
- package/components/mui_extended/Popover/index.4da8587a.js +0 -252
- package/contexts/ModalContext/index.5388dfd5.js +0 -136
- package/hooks/useModal/index.3b1ff084.js +0 -11
- package/node_modules.168cb897.js +0 -55
|
@@ -1,164 +1,226 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { s as
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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.214d9542.js";
|
|
6
|
+
var cjs = { exports: {} };
|
|
7
|
+
var Draggable$1 = {};
|
|
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);
|
|
13
16
|
}
|
|
14
|
-
Object.defineProperty(
|
|
15
|
-
value:
|
|
17
|
+
Object.defineProperty(DraggableCore$2, "__esModule", {
|
|
18
|
+
value: true
|
|
16
19
|
});
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
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 };
|
|
21
30
|
}
|
|
22
|
-
function
|
|
23
|
-
if (typeof WeakMap
|
|
31
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
32
|
+
if (typeof WeakMap !== "function")
|
|
24
33
|
return null;
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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);
|
|
29
39
|
}
|
|
30
|
-
function
|
|
31
|
-
if (!
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
}
|
|
43
61
|
}
|
|
44
|
-
|
|
62
|
+
}
|
|
63
|
+
newObj.default = obj;
|
|
64
|
+
if (cache) {
|
|
65
|
+
cache.set(obj, newObj);
|
|
66
|
+
}
|
|
67
|
+
return newObj;
|
|
45
68
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
69
|
+
function _slicedToArray(arr, i) {
|
|
70
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
48
71
|
}
|
|
49
|
-
function
|
|
50
|
-
throw new TypeError(
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
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.");
|
|
52
74
|
}
|
|
53
|
-
function
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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);
|
|
63
87
|
}
|
|
64
|
-
function
|
|
65
|
-
(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
69
95
|
}
|
|
70
|
-
function
|
|
71
|
-
var
|
|
72
|
-
if (
|
|
73
|
-
|
|
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 {
|
|
74
114
|
try {
|
|
75
|
-
|
|
76
|
-
;
|
|
77
|
-
} catch (v) {
|
|
78
|
-
p = !0, s = v;
|
|
115
|
+
if (!_n && _i["return"] != null)
|
|
116
|
+
_i["return"]();
|
|
79
117
|
} finally {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} finally {
|
|
83
|
-
if (p)
|
|
84
|
-
throw s;
|
|
85
|
-
}
|
|
118
|
+
if (_d)
|
|
119
|
+
throw _e;
|
|
86
120
|
}
|
|
87
|
-
return e;
|
|
88
121
|
}
|
|
122
|
+
return _arr;
|
|
89
123
|
}
|
|
90
|
-
function
|
|
91
|
-
if (Array.isArray(
|
|
92
|
-
return
|
|
124
|
+
function _arrayWithHoles(arr) {
|
|
125
|
+
if (Array.isArray(arr))
|
|
126
|
+
return arr;
|
|
93
127
|
}
|
|
94
|
-
function
|
|
95
|
-
if (!(
|
|
128
|
+
function _classCallCheck(instance, Constructor) {
|
|
129
|
+
if (!(instance instanceof Constructor)) {
|
|
96
130
|
throw new TypeError("Cannot call a class as a function");
|
|
131
|
+
}
|
|
97
132
|
}
|
|
98
|
-
function
|
|
99
|
-
for (var
|
|
100
|
-
var
|
|
101
|
-
|
|
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);
|
|
102
141
|
}
|
|
103
142
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
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;
|
|
106
150
|
}
|
|
107
|
-
function
|
|
108
|
-
if (typeof
|
|
151
|
+
function _inherits(subClass, superClass) {
|
|
152
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
109
153
|
throw new TypeError("Super expression must either be null or a function");
|
|
110
|
-
|
|
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);
|
|
111
159
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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);
|
|
116
166
|
}
|
|
117
|
-
function
|
|
118
|
-
var
|
|
119
|
-
return function() {
|
|
120
|
-
var
|
|
121
|
-
if (
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
} else
|
|
125
|
-
|
|
126
|
-
|
|
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);
|
|
127
178
|
};
|
|
128
179
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
132
|
-
if (
|
|
180
|
+
function _possibleConstructorReturn(self, call) {
|
|
181
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
182
|
+
return call;
|
|
183
|
+
} else if (call !== void 0) {
|
|
133
184
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
134
|
-
|
|
185
|
+
}
|
|
186
|
+
return _assertThisInitialized(self);
|
|
135
187
|
}
|
|
136
|
-
function
|
|
137
|
-
if (
|
|
188
|
+
function _assertThisInitialized(self) {
|
|
189
|
+
if (self === void 0) {
|
|
138
190
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
139
|
-
|
|
191
|
+
}
|
|
192
|
+
return self;
|
|
140
193
|
}
|
|
141
|
-
function
|
|
142
|
-
if (typeof Reflect
|
|
143
|
-
return
|
|
144
|
-
if (
|
|
145
|
-
return
|
|
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;
|
|
146
201
|
try {
|
|
147
|
-
|
|
148
|
-
}))
|
|
149
|
-
|
|
150
|
-
|
|
202
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
203
|
+
}));
|
|
204
|
+
return true;
|
|
205
|
+
} catch (e) {
|
|
206
|
+
return false;
|
|
151
207
|
}
|
|
152
208
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
return
|
|
156
|
-
}
|
|
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);
|
|
157
214
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
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;
|
|
160
222
|
}
|
|
161
|
-
var
|
|
223
|
+
var eventsFor = {
|
|
162
224
|
touch: {
|
|
163
225
|
start: "touchstart",
|
|
164
226
|
move: "touchmove",
|
|
@@ -169,532 +231,717 @@ var N = {
|
|
|
169
231
|
move: "mousemove",
|
|
170
232
|
stop: "mouseup"
|
|
171
233
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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,
|
|
182
248
|
lastX: NaN,
|
|
183
249
|
lastY: NaN,
|
|
184
250
|
touchIdentifier: null
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (!
|
|
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) {
|
|
190
259
|
throw new Error("<DraggableCore> not mounted on DragStart!");
|
|
191
|
-
var m = v.ownerDocument;
|
|
192
|
-
if (!(e.props.disabled || !(s.target instanceof m.defaultView.Node) || e.props.handle && !(0, _.matchesSelectorAndParentsTo)(s.target, e.props.handle, v) || e.props.cancel && (0, _.matchesSelectorAndParentsTo)(s.target, e.props.cancel, v))) {
|
|
193
|
-
s.type === "touchstart" && s.preventDefault();
|
|
194
|
-
var D = (0, _.getTouchIdentifier)(s);
|
|
195
|
-
e.setState({
|
|
196
|
-
touchIdentifier: D
|
|
197
|
-
});
|
|
198
|
-
var O = (0, j.getControlPosition)(s, D, S(e));
|
|
199
|
-
if (O != null) {
|
|
200
|
-
var b = O.x, E = O.y, M = (0, j.createCoreData)(S(e), b, E);
|
|
201
|
-
(0, F.default)("DraggableCore: handleDragStart: %j", M), (0, F.default)("calling", e.props.onStart);
|
|
202
|
-
var x = e.props.onStart(s, M);
|
|
203
|
-
x === !1 || e.mounted === !1 || (e.props.enableUserSelectHack && (0, _.addUserSelectStyles)(m), e.setState({
|
|
204
|
-
dragging: !0,
|
|
205
|
-
lastX: b,
|
|
206
|
-
lastY: E
|
|
207
|
-
}), (0, _.addEvent)(m, k.move, e.handleDrag), (0, _.addEvent)(m, k.stop, e.handleDragStop));
|
|
208
|
-
}
|
|
209
260
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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)
|
|
230
303
|
return;
|
|
231
|
-
|
|
232
|
-
e.setState({
|
|
233
|
-
lastX: m,
|
|
234
|
-
lastY: D
|
|
235
|
-
});
|
|
304
|
+
x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
|
|
236
305
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if ($ === !1 || e.mounted === !1)
|
|
248
|
-
return !1;
|
|
249
|
-
var C = e.findDOMNode();
|
|
250
|
-
C && e.props.enableUserSelectHack && (0, _.removeUserSelectStyles)(C.ownerDocument), (0, F.default)("DraggableCore: handleDragStop: %j", x), e.setState({
|
|
251
|
-
dragging: !1,
|
|
252
|
-
lastX: NaN,
|
|
253
|
-
lastY: NaN
|
|
254
|
-
}), C && ((0, F.default)("DraggableCore: Removing handlers"), (0, _.removeEvent)(C.ownerDocument, k.move, e.handleDrag), (0, _.removeEvent)(C.ownerDocument, k.stop, e.handleDragStop));
|
|
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);
|
|
255
316
|
}
|
|
317
|
+
return;
|
|
256
318
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
|
274
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
|
+
}
|
|
275
389
|
}
|
|
276
390
|
}, {
|
|
277
391
|
key: "componentWillUnmount",
|
|
278
|
-
value: function() {
|
|
279
|
-
this.mounted =
|
|
280
|
-
var
|
|
281
|
-
if (
|
|
282
|
-
var
|
|
283
|
-
(0,
|
|
284
|
-
|
|
285
|
-
|
|
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);
|
|
286
406
|
}
|
|
287
407
|
}
|
|
288
408
|
}, {
|
|
289
409
|
key: "findDOMNode",
|
|
290
|
-
value: function() {
|
|
291
|
-
var
|
|
292
|
-
return (
|
|
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);
|
|
293
413
|
}
|
|
294
414
|
}, {
|
|
295
415
|
key: "render",
|
|
296
|
-
value: function() {
|
|
297
|
-
return /* @__PURE__ */
|
|
416
|
+
value: function render() {
|
|
417
|
+
return /* @__PURE__ */ React.cloneElement(React.Children.only(this.props.children), {
|
|
298
418
|
onMouseDown: this.onMouseDown,
|
|
299
419
|
onMouseUp: this.onMouseUp,
|
|
300
420
|
onTouchEnd: this.onTouchEnd
|
|
301
421
|
});
|
|
302
422
|
}
|
|
303
|
-
}])
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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) {
|
|
313
434
|
throw new Error("Draggable's offsetParent must be a DOM Node.");
|
|
435
|
+
}
|
|
314
436
|
},
|
|
315
|
-
grid:
|
|
316
|
-
handle:
|
|
317
|
-
cancel:
|
|
318
|
-
nodeRef:
|
|
319
|
-
onStart:
|
|
320
|
-
onDrag:
|
|
321
|
-
onStop:
|
|
322
|
-
onMouseDown:
|
|
323
|
-
scale:
|
|
324
|
-
className:
|
|
325
|
-
style:
|
|
326
|
-
transform:
|
|
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
|
|
327
449
|
});
|
|
328
|
-
|
|
329
|
-
allowAnyClick:
|
|
330
|
-
disabled:
|
|
331
|
-
enableUserSelectHack:
|
|
332
|
-
onStart: function() {
|
|
450
|
+
_defineProperty(DraggableCore$1, "defaultProps", {
|
|
451
|
+
allowAnyClick: false,
|
|
452
|
+
disabled: false,
|
|
453
|
+
enableUserSelectHack: true,
|
|
454
|
+
onStart: function onStart() {
|
|
333
455
|
},
|
|
334
|
-
onDrag: function() {
|
|
456
|
+
onDrag: function onDrag() {
|
|
335
457
|
},
|
|
336
|
-
onStop: function() {
|
|
458
|
+
onStop: function onStop() {
|
|
337
459
|
},
|
|
338
|
-
onMouseDown: function() {
|
|
460
|
+
onMouseDown: function onMouseDown() {
|
|
339
461
|
},
|
|
340
462
|
scale: 1
|
|
341
463
|
});
|
|
342
|
-
(function(
|
|
343
|
-
function
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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;
|
|
356
480
|
}
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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")
|
|
364
498
|
return null;
|
|
365
|
-
var
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
var
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
+
}
|
|
383
526
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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
|
+
}
|
|
392
543
|
}
|
|
393
|
-
return
|
|
394
|
-
}
|
|
544
|
+
return target;
|
|
545
|
+
};
|
|
546
|
+
return _extends.apply(this, arguments);
|
|
395
547
|
}
|
|
396
|
-
function
|
|
397
|
-
if (
|
|
548
|
+
function _objectWithoutProperties(source, excluded) {
|
|
549
|
+
if (source == null)
|
|
398
550
|
return {};
|
|
399
|
-
var
|
|
551
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
552
|
+
var key, i;
|
|
400
553
|
if (Object.getOwnPropertySymbols) {
|
|
401
|
-
var
|
|
402
|
-
for (
|
|
403
|
-
|
|
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
|
+
}
|
|
404
563
|
}
|
|
405
|
-
return
|
|
564
|
+
return target;
|
|
406
565
|
}
|
|
407
|
-
function
|
|
408
|
-
if (
|
|
566
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
567
|
+
if (source == null)
|
|
409
568
|
return {};
|
|
410
|
-
var
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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;
|
|
414
579
|
}
|
|
415
|
-
function
|
|
416
|
-
var
|
|
580
|
+
function ownKeys(object, enumerableOnly) {
|
|
581
|
+
var keys = Object.keys(object);
|
|
417
582
|
if (Object.getOwnPropertySymbols) {
|
|
418
|
-
var
|
|
419
|
-
|
|
420
|
-
return Object.getOwnPropertyDescriptor(
|
|
421
|
-
})),
|
|
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);
|
|
422
587
|
}
|
|
423
|
-
return
|
|
424
|
-
}
|
|
425
|
-
function
|
|
426
|
-
for (var
|
|
427
|
-
var
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
431
|
-
Object.defineProperty(
|
|
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));
|
|
432
597
|
});
|
|
433
598
|
}
|
|
434
|
-
return
|
|
435
|
-
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
438
|
-
}
|
|
439
|
-
function
|
|
440
|
-
throw new TypeError(
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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];
|
|
452
625
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
var
|
|
462
|
-
|
|
463
|
-
|
|
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 {
|
|
464
646
|
try {
|
|
465
|
-
|
|
466
|
-
;
|
|
467
|
-
} catch (g) {
|
|
468
|
-
f = !0, y = g;
|
|
647
|
+
if (!_n && _i["return"] != null)
|
|
648
|
+
_i["return"]();
|
|
469
649
|
} finally {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
} finally {
|
|
473
|
-
if (f)
|
|
474
|
-
throw y;
|
|
475
|
-
}
|
|
650
|
+
if (_d)
|
|
651
|
+
throw _e;
|
|
476
652
|
}
|
|
477
|
-
return i;
|
|
478
653
|
}
|
|
654
|
+
return _arr;
|
|
479
655
|
}
|
|
480
|
-
function
|
|
481
|
-
if (Array.isArray(
|
|
482
|
-
return
|
|
656
|
+
function _arrayWithHoles2(arr) {
|
|
657
|
+
if (Array.isArray(arr))
|
|
658
|
+
return arr;
|
|
483
659
|
}
|
|
484
|
-
function
|
|
485
|
-
if (!(
|
|
660
|
+
function _classCallCheck2(instance, Constructor) {
|
|
661
|
+
if (!(instance instanceof Constructor)) {
|
|
486
662
|
throw new TypeError("Cannot call a class as a function");
|
|
663
|
+
}
|
|
487
664
|
}
|
|
488
|
-
function
|
|
489
|
-
for (var
|
|
490
|
-
var
|
|
491
|
-
|
|
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);
|
|
492
673
|
}
|
|
493
674
|
}
|
|
494
|
-
function
|
|
495
|
-
|
|
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;
|
|
496
682
|
}
|
|
497
|
-
function
|
|
498
|
-
if (typeof
|
|
683
|
+
function _inherits2(subClass, superClass) {
|
|
684
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
499
685
|
throw new TypeError("Super expression must either be null or a function");
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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);
|
|
517
710
|
};
|
|
518
711
|
}
|
|
519
|
-
function
|
|
520
|
-
if (
|
|
521
|
-
return
|
|
522
|
-
if (
|
|
712
|
+
function _possibleConstructorReturn2(self, call) {
|
|
713
|
+
if (call && (_typeof2(call) === "object" || typeof call === "function")) {
|
|
714
|
+
return call;
|
|
715
|
+
} else if (call !== void 0) {
|
|
523
716
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
524
|
-
|
|
717
|
+
}
|
|
718
|
+
return _assertThisInitialized2(self);
|
|
525
719
|
}
|
|
526
|
-
function
|
|
527
|
-
if (
|
|
720
|
+
function _assertThisInitialized2(self) {
|
|
721
|
+
if (self === void 0) {
|
|
528
722
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
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;
|
|
536
733
|
try {
|
|
537
|
-
|
|
538
|
-
}))
|
|
539
|
-
|
|
540
|
-
|
|
734
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
735
|
+
}));
|
|
736
|
+
return true;
|
|
737
|
+
} catch (e) {
|
|
738
|
+
return false;
|
|
541
739
|
}
|
|
542
740
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
return
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
|
564
770
|
});
|
|
565
|
-
})
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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
|
|
572
780
|
};
|
|
573
|
-
if (
|
|
574
|
-
var
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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;
|
|
578
794
|
}
|
|
579
|
-
var
|
|
580
|
-
if (
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
})
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
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,
|
|
592
809
|
slackX: 0,
|
|
593
810
|
slackY: 0
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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;
|
|
598
817
|
}
|
|
599
|
-
|
|
600
|
-
})
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
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),
|
|
606
826
|
slackX: 0,
|
|
607
827
|
slackY: 0,
|
|
608
|
-
isElementSVG:
|
|
609
|
-
}
|
|
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;
|
|
610
834
|
}
|
|
611
|
-
|
|
835
|
+
_createClass2(Draggable3, [{
|
|
612
836
|
key: "componentDidMount",
|
|
613
|
-
value: function() {
|
|
614
|
-
typeof window.SVGElement
|
|
615
|
-
|
|
616
|
-
|
|
837
|
+
value: function componentDidMount() {
|
|
838
|
+
if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) {
|
|
839
|
+
this.setState({
|
|
840
|
+
isElementSVG: true
|
|
841
|
+
});
|
|
842
|
+
}
|
|
617
843
|
}
|
|
618
844
|
}, {
|
|
619
845
|
key: "componentWillUnmount",
|
|
620
|
-
value: function() {
|
|
846
|
+
value: function componentWillUnmount() {
|
|
621
847
|
this.setState({
|
|
622
|
-
dragging:
|
|
848
|
+
dragging: false
|
|
623
849
|
});
|
|
624
850
|
}
|
|
625
851
|
}, {
|
|
626
852
|
key: "findDOMNode",
|
|
627
|
-
value: function() {
|
|
628
|
-
var
|
|
629
|
-
return (
|
|
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);
|
|
630
856
|
}
|
|
631
857
|
}, {
|
|
632
858
|
key: "render",
|
|
633
|
-
value: function() {
|
|
634
|
-
var
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
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
|
|
641
875
|
};
|
|
642
|
-
this.state.isElementSVG
|
|
643
|
-
|
|
644
|
-
|
|
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, {
|
|
645
883
|
onStart: this.onDragStart,
|
|
646
884
|
onDrag: this.onDrag,
|
|
647
885
|
onStop: this.onDragStop
|
|
648
|
-
}), /* @__PURE__ */
|
|
649
|
-
className
|
|
650
|
-
style:
|
|
651
|
-
transform:
|
|
886
|
+
}), /* @__PURE__ */ React2.cloneElement(React2.Children.only(children), {
|
|
887
|
+
className,
|
|
888
|
+
style: _objectSpread(_objectSpread({}, children.props.style), style),
|
|
889
|
+
transform: svgTransform
|
|
652
890
|
}));
|
|
653
891
|
}
|
|
654
892
|
}], [{
|
|
655
893
|
key: "getDerivedStateFromProps",
|
|
656
|
-
value: function(
|
|
657
|
-
var
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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;
|
|
666
909
|
}
|
|
667
|
-
}])
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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
|
|
683
929
|
}),
|
|
684
|
-
positionOffset:
|
|
685
|
-
x:
|
|
686
|
-
y:
|
|
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])
|
|
687
933
|
}),
|
|
688
|
-
position:
|
|
689
|
-
x:
|
|
690
|
-
y:
|
|
934
|
+
position: _propTypes2.default.shape({
|
|
935
|
+
x: _propTypes2.default.number,
|
|
936
|
+
y: _propTypes2.default.number
|
|
691
937
|
}),
|
|
692
|
-
className:
|
|
693
|
-
style:
|
|
694
|
-
transform:
|
|
695
|
-
}))
|
|
938
|
+
className: _shims2.dontSetMe,
|
|
939
|
+
style: _shims2.dontSetMe,
|
|
940
|
+
transform: _shims2.dontSetMe
|
|
941
|
+
}));
|
|
942
|
+
_defineProperty2(Draggable2, "defaultProps", _objectSpread(_objectSpread({}, _DraggableCore.default.defaultProps), {}, {
|
|
696
943
|
axis: "both",
|
|
697
|
-
bounds:
|
|
944
|
+
bounds: false,
|
|
698
945
|
defaultClassName: "react-draggable",
|
|
699
946
|
defaultClassNameDragging: "react-draggable-dragging",
|
|
700
947
|
defaultClassNameDragged: "react-draggable-dragged",
|
|
@@ -704,11 +951,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
704
951
|
},
|
|
705
952
|
scale: 1
|
|
706
953
|
}));
|
|
707
|
-
})(
|
|
708
|
-
var
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
954
|
+
})(Draggable$1);
|
|
955
|
+
var _require = Draggable$1, Draggable = _require.default, DraggableCore = _require.DraggableCore;
|
|
956
|
+
cjs.exports = Draggable;
|
|
957
|
+
cjs.exports.default = Draggable;
|
|
958
|
+
cjs.exports.DraggableCore = DraggableCore;
|
|
712
959
|
export {
|
|
713
|
-
|
|
960
|
+
cjs as c
|
|
714
961
|
};
|