@pie-lib/plot 4.0.3 → 4.0.4-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +23 -0
- package/dist/draggable.d.ts +13 -0
- package/dist/draggable.js +13 -0
- package/dist/graph-props.d.ts +22 -0
- package/dist/graph-props.js +29 -0
- package/dist/grid-draggable.d.ts +91 -0
- package/dist/grid-draggable.js +168 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +8 -0
- package/dist/label.d.ts +30 -0
- package/dist/label.js +132 -0
- package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
- package/dist/node_modules/.bun/react-draggable@3.3.2/node_modules/react-draggable/dist/react-draggable.js +914 -0
- package/dist/root.d.ts +68 -0
- package/dist/root.js +302 -0
- package/dist/trig.d.ts +41 -0
- package/dist/trig.js +47 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.js +46 -0
- package/dist/utils.d.ts +40 -0
- package/dist/utils.js +82 -0
- package/package.json +27 -20
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -838
- package/LICENSE.md +0 -5
- package/lib/draggable.js +0 -44
- package/lib/draggable.js.map +0 -1
- package/lib/graph-props.js +0 -46
- package/lib/graph-props.js.map +0 -1
- package/lib/grid-draggable.js +0 -361
- package/lib/grid-draggable.js.map +0 -1
- package/lib/index.js +0 -44
- package/lib/index.js.map +0 -1
- package/lib/label.js +0 -173
- package/lib/label.js.map +0 -1
- package/lib/root.js +0 -474
- package/lib/root.js.map +0 -1
- package/lib/trig.js +0 -149
- package/lib/trig.js.map +0 -1
- package/lib/types.js +0 -40
- package/lib/types.js.map +0 -1
- package/lib/utils.js +0 -165
- package/lib/utils.js.map +0 -1
- package/src/__tests__/draggable.test.jsx +0 -41
- package/src/__tests__/grid-draggable.test.jsx +0 -487
- package/src/__tests__/root.test.jsx +0 -277
- package/src/__tests__/trig.test.js +0 -163
- package/src/__tests__/utils.test.js +0 -229
- package/src/draggable.jsx +0 -11
- package/src/graph-props.js +0 -34
- package/src/grid-draggable.jsx +0 -332
- package/src/index.js +0 -9
- package/src/label.jsx +0 -199
- package/src/root.jsx +0 -485
- package/src/trig.js +0 -151
- package/src/types.js +0 -41
- package/src/utils.js +0 -167
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
import { __commonJSMin as e, __require as t } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../../node_modules/.bun/react-draggable@3.3.2/node_modules/react-draggable/dist/react-draggable.js
|
|
3
|
+
var n = /* @__PURE__ */ e(((e, n) => {
|
|
4
|
+
(function(r, i) {
|
|
5
|
+
typeof e == "object" && n !== void 0 ? n.exports = i(t("react-dom"), t("react")) : typeof define == "function" && define.amd ? define(["react-dom", "react"], i) : r.ReactDraggable = i(r.ReactDOM, r.React);
|
|
6
|
+
})(e, (function(e, t) {
|
|
7
|
+
e = e && e.hasOwnProperty("default") ? e.default : e, t = t && t.hasOwnProperty("default") ? t.default : t;
|
|
8
|
+
function n(e, t) {
|
|
9
|
+
return t = { exports: {} }, e(t, t.exports), t.exports;
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
return function() {
|
|
13
|
+
return e;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
var i = function() {};
|
|
17
|
+
i.thatReturns = r, i.thatReturnsFalse = r(!1), i.thatReturnsTrue = r(!0), i.thatReturnsNull = r(null), i.thatReturnsThis = function() {
|
|
18
|
+
return this;
|
|
19
|
+
}, i.thatReturnsArgument = function(e) {
|
|
20
|
+
return e;
|
|
21
|
+
};
|
|
22
|
+
var a = i, o = function(e) {};
|
|
23
|
+
o = function(e) {
|
|
24
|
+
if (e === void 0) throw Error("invariant requires an error message argument");
|
|
25
|
+
};
|
|
26
|
+
function s(e, t, n, r, i, a, s, c) {
|
|
27
|
+
if (o(t), !e) {
|
|
28
|
+
var l;
|
|
29
|
+
if (t === void 0) l = /* @__PURE__ */ Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
|
|
30
|
+
else {
|
|
31
|
+
var u = [
|
|
32
|
+
n,
|
|
33
|
+
r,
|
|
34
|
+
i,
|
|
35
|
+
a,
|
|
36
|
+
s,
|
|
37
|
+
c
|
|
38
|
+
], d = 0;
|
|
39
|
+
l = Error(t.replace(/%s/g, function() {
|
|
40
|
+
return u[d++];
|
|
41
|
+
})), l.name = "Invariant Violation";
|
|
42
|
+
}
|
|
43
|
+
throw l.framesToPop = 1, l;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
var c = s, l = a, u = function(e) {
|
|
47
|
+
var t = [...arguments].slice(1), n = 0, r = "Warning: " + e.replace(/%s/g, function() {
|
|
48
|
+
return t[n++];
|
|
49
|
+
});
|
|
50
|
+
typeof console < "u" && console.error(r);
|
|
51
|
+
try {
|
|
52
|
+
throw Error(r);
|
|
53
|
+
} catch {}
|
|
54
|
+
};
|
|
55
|
+
l = function(e, t) {
|
|
56
|
+
if (t === void 0) throw Error("`warning(condition, format, ...args)` requires a warning message argument");
|
|
57
|
+
if (t.indexOf("Failed Composite propType: ") !== 0 && !e) {
|
|
58
|
+
var n = [...arguments].slice(2);
|
|
59
|
+
u.apply(void 0, [t].concat(n));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var d = l, f = Object.getOwnPropertySymbols, p = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
|
|
63
|
+
function h(e) {
|
|
64
|
+
if (e == null) throw TypeError("Object.assign cannot be called with null or undefined");
|
|
65
|
+
return Object(e);
|
|
66
|
+
}
|
|
67
|
+
function g() {
|
|
68
|
+
try {
|
|
69
|
+
if (!Object.assign) return !1;
|
|
70
|
+
var e = /* @__PURE__ */ new String("abc");
|
|
71
|
+
if (e[5] = "de", Object.getOwnPropertyNames(e)[0] === "5") return !1;
|
|
72
|
+
for (var t = {}, n = 0; n < 10; n++) t["_" + String.fromCharCode(n)] = n;
|
|
73
|
+
if (Object.getOwnPropertyNames(t).map(function(e) {
|
|
74
|
+
return t[e];
|
|
75
|
+
}).join("") !== "0123456789") return !1;
|
|
76
|
+
var r = {};
|
|
77
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(e) {
|
|
78
|
+
r[e] = e;
|
|
79
|
+
}), Object.keys(Object.assign({}, r)).join("") === "abcdefghijklmnopqrst";
|
|
80
|
+
} catch {
|
|
81
|
+
return !1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
var ee = g() ? Object.assign : function(e, t) {
|
|
85
|
+
for (var n, r = h(e), i, a = 1; a < arguments.length; a++) {
|
|
86
|
+
for (var o in n = Object(arguments[a]), n) p.call(n, o) && (r[o] = n[o]);
|
|
87
|
+
if (f) {
|
|
88
|
+
i = f(n);
|
|
89
|
+
for (var s = 0; s < i.length; s++) m.call(n, i[s]) && (r[i[s]] = n[i[s]]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return r;
|
|
93
|
+
}, _ = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", v = c, y = d, b = _, x = {};
|
|
94
|
+
function S(e, t, n, r, i) {
|
|
95
|
+
for (var a in e) if (e.hasOwnProperty(a)) {
|
|
96
|
+
var o;
|
|
97
|
+
try {
|
|
98
|
+
v(typeof e[a] == "function", "%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.", r || "React class", n, a, typeof e[a]), o = e[a](t, a, r, n, null, b);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
o = e;
|
|
101
|
+
}
|
|
102
|
+
if (y(!o || o instanceof Error, "%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", r || "React class", n, a, typeof o), o instanceof Error && !(o.message in x)) {
|
|
103
|
+
x[o.message] = !0;
|
|
104
|
+
var s = i ? i() : "";
|
|
105
|
+
y(!1, "Failed %s type: %s%s", n, o.message, s ?? "");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
var te = S, C = function(e, t) {
|
|
110
|
+
var n = typeof Symbol == "function" && Symbol.iterator, r = "@@iterator";
|
|
111
|
+
function i(e) {
|
|
112
|
+
var t = e && (n && e[n] || e[r]);
|
|
113
|
+
if (typeof t == "function") return t;
|
|
114
|
+
}
|
|
115
|
+
var o = "<<anonymous>>", s = {
|
|
116
|
+
array: p("array"),
|
|
117
|
+
bool: p("boolean"),
|
|
118
|
+
func: p("function"),
|
|
119
|
+
number: p("number"),
|
|
120
|
+
object: p("object"),
|
|
121
|
+
string: p("string"),
|
|
122
|
+
symbol: p("symbol"),
|
|
123
|
+
any: m(),
|
|
124
|
+
arrayOf: h,
|
|
125
|
+
element: g(),
|
|
126
|
+
instanceOf: v,
|
|
127
|
+
node: S(),
|
|
128
|
+
objectOf: b,
|
|
129
|
+
oneOf: y,
|
|
130
|
+
oneOfType: x,
|
|
131
|
+
shape: C,
|
|
132
|
+
exact: w
|
|
133
|
+
};
|
|
134
|
+
function l(e, t) {
|
|
135
|
+
return e === t ? e !== 0 || 1 / e == 1 / t : e !== e && t !== t;
|
|
136
|
+
}
|
|
137
|
+
function u(e) {
|
|
138
|
+
this.message = e, this.stack = "";
|
|
139
|
+
}
|
|
140
|
+
u.prototype = Error.prototype;
|
|
141
|
+
function f(e) {
|
|
142
|
+
var n = {}, r = 0;
|
|
143
|
+
function i(i, a, s, l, f, p, m) {
|
|
144
|
+
if (l ||= o, p ||= s, m !== _) {
|
|
145
|
+
if (t) c(!1, "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");
|
|
146
|
+
else if (typeof console < "u") {
|
|
147
|
+
var h = l + ":" + s;
|
|
148
|
+
!n[h] && r < 3 && (d(!1, "You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.", p, l), n[h] = !0, r++);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return a[s] == null ? i ? a[s] === null ? new u("The " + f + " `" + p + "` is marked as required " + ("in `" + l + "`, but its value is `null`.")) : new u("The " + f + " `" + p + "` is marked as required in " + ("`" + l + "`, but its value is `undefined`.")) : null : e(a, s, l, f, p);
|
|
152
|
+
}
|
|
153
|
+
var a = i.bind(null, !1);
|
|
154
|
+
return a.isRequired = i.bind(null, !0), a;
|
|
155
|
+
}
|
|
156
|
+
function p(e) {
|
|
157
|
+
function t(t, n, r, i, a, o) {
|
|
158
|
+
var s = t[n];
|
|
159
|
+
if (D(s) !== e) {
|
|
160
|
+
var c = O(s);
|
|
161
|
+
return new u("Invalid " + i + " `" + a + "` of type " + ("`" + c + "` supplied to `" + r + "`, expected ") + ("`" + e + "`."));
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return f(t);
|
|
166
|
+
}
|
|
167
|
+
function m() {
|
|
168
|
+
return f(a.thatReturnsNull);
|
|
169
|
+
}
|
|
170
|
+
function h(e) {
|
|
171
|
+
function t(t, n, r, i, a) {
|
|
172
|
+
if (typeof e != "function") return new u("Property `" + a + "` of component `" + r + "` has invalid PropType notation inside arrayOf.");
|
|
173
|
+
var o = t[n];
|
|
174
|
+
if (!Array.isArray(o)) {
|
|
175
|
+
var s = D(o);
|
|
176
|
+
return new u("Invalid " + i + " `" + a + "` of type " + ("`" + s + "` supplied to `" + r + "`, expected an array."));
|
|
177
|
+
}
|
|
178
|
+
for (var c = 0; c < o.length; c++) {
|
|
179
|
+
var l = e(o, c, r, i, a + "[" + c + "]", _);
|
|
180
|
+
if (l instanceof Error) return l;
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
return f(t);
|
|
185
|
+
}
|
|
186
|
+
function g() {
|
|
187
|
+
function t(t, n, r, i, a) {
|
|
188
|
+
var o = t[n];
|
|
189
|
+
if (!e(o)) {
|
|
190
|
+
var s = D(o);
|
|
191
|
+
return new u("Invalid " + i + " `" + a + "` of type " + ("`" + s + "` supplied to `" + r + "`, expected a single ReactElement."));
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return f(t);
|
|
196
|
+
}
|
|
197
|
+
function v(e) {
|
|
198
|
+
function t(t, n, r, i, a) {
|
|
199
|
+
if (!(t[n] instanceof e)) {
|
|
200
|
+
var s = e.name || o, c = A(t[n]);
|
|
201
|
+
return new u("Invalid " + i + " `" + a + "` of type " + ("`" + c + "` supplied to `" + r + "`, expected ") + ("instance of `" + s + "`."));
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return f(t);
|
|
206
|
+
}
|
|
207
|
+
function y(e) {
|
|
208
|
+
if (!Array.isArray(e)) return d(!1, "Invalid argument supplied to oneOf, expected an instance of array."), a.thatReturnsNull;
|
|
209
|
+
function t(t, n, r, i, a) {
|
|
210
|
+
for (var o = t[n], s = 0; s < e.length; s++) if (l(o, e[s])) return null;
|
|
211
|
+
var c = JSON.stringify(e);
|
|
212
|
+
return new u("Invalid " + i + " `" + a + "` of value `" + o + "` " + ("supplied to `" + r + "`, expected one of " + c + "."));
|
|
213
|
+
}
|
|
214
|
+
return f(t);
|
|
215
|
+
}
|
|
216
|
+
function b(e) {
|
|
217
|
+
function t(t, n, r, i, a) {
|
|
218
|
+
if (typeof e != "function") return new u("Property `" + a + "` of component `" + r + "` has invalid PropType notation inside objectOf.");
|
|
219
|
+
var o = t[n], s = D(o);
|
|
220
|
+
if (s !== "object") return new u("Invalid " + i + " `" + a + "` of type " + ("`" + s + "` supplied to `" + r + "`, expected an object."));
|
|
221
|
+
for (var c in o) if (o.hasOwnProperty(c)) {
|
|
222
|
+
var l = e(o, c, r, i, a + "." + c, _);
|
|
223
|
+
if (l instanceof Error) return l;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
return f(t);
|
|
228
|
+
}
|
|
229
|
+
function x(e) {
|
|
230
|
+
if (!Array.isArray(e)) return d(!1, "Invalid argument supplied to oneOfType, expected an instance of array."), a.thatReturnsNull;
|
|
231
|
+
for (var t = 0; t < e.length; t++) {
|
|
232
|
+
var n = e[t];
|
|
233
|
+
if (typeof n != "function") return d(!1, "Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.", k(n), t), a.thatReturnsNull;
|
|
234
|
+
}
|
|
235
|
+
function r(t, n, r, i, a) {
|
|
236
|
+
for (var o = 0; o < e.length; o++) {
|
|
237
|
+
var s = e[o];
|
|
238
|
+
if (s(t, n, r, i, a, _) == null) return null;
|
|
239
|
+
}
|
|
240
|
+
return new u("Invalid " + i + " `" + a + "` supplied to " + ("`" + r + "`."));
|
|
241
|
+
}
|
|
242
|
+
return f(r);
|
|
243
|
+
}
|
|
244
|
+
function S() {
|
|
245
|
+
function e(e, t, n, r, i) {
|
|
246
|
+
return T(e[t]) ? null : new u("Invalid " + r + " `" + i + "` supplied to " + ("`" + n + "`, expected a ReactNode."));
|
|
247
|
+
}
|
|
248
|
+
return f(e);
|
|
249
|
+
}
|
|
250
|
+
function C(e) {
|
|
251
|
+
function t(t, n, r, i, a) {
|
|
252
|
+
var o = t[n], s = D(o);
|
|
253
|
+
if (s !== "object") return new u("Invalid " + i + " `" + a + "` of type `" + s + "` " + ("supplied to `" + r + "`, expected `object`."));
|
|
254
|
+
for (var c in e) {
|
|
255
|
+
var l = e[c];
|
|
256
|
+
if (l) {
|
|
257
|
+
var d = l(o, c, r, i, a + "." + c, _);
|
|
258
|
+
if (d) return d;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return f(t);
|
|
264
|
+
}
|
|
265
|
+
function w(e) {
|
|
266
|
+
function t(t, n, r, i, a) {
|
|
267
|
+
var o = t[n], s = D(o);
|
|
268
|
+
if (s !== "object") return new u("Invalid " + i + " `" + a + "` of type `" + s + "` " + ("supplied to `" + r + "`, expected `object`."));
|
|
269
|
+
for (var c in ee({}, t[n], e)) {
|
|
270
|
+
var l = e[c];
|
|
271
|
+
if (!l) return new u("Invalid " + i + " `" + a + "` key `" + c + "` supplied to `" + r + "`.\nBad object: " + JSON.stringify(t[n], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(e), null, " "));
|
|
272
|
+
var d = l(o, c, r, i, a + "." + c, _);
|
|
273
|
+
if (d) return d;
|
|
274
|
+
}
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return f(t);
|
|
278
|
+
}
|
|
279
|
+
function T(t) {
|
|
280
|
+
switch (typeof t) {
|
|
281
|
+
case "number":
|
|
282
|
+
case "string":
|
|
283
|
+
case "undefined": return !0;
|
|
284
|
+
case "boolean": return !t;
|
|
285
|
+
case "object":
|
|
286
|
+
if (Array.isArray(t)) return t.every(T);
|
|
287
|
+
if (t === null || e(t)) return !0;
|
|
288
|
+
var n = i(t);
|
|
289
|
+
if (n) {
|
|
290
|
+
var r = n.call(t), a;
|
|
291
|
+
if (n !== t.entries) {
|
|
292
|
+
for (; !(a = r.next()).done;) if (!T(a.value)) return !1;
|
|
293
|
+
} else for (; !(a = r.next()).done;) {
|
|
294
|
+
var o = a.value;
|
|
295
|
+
if (o && !T(o[1])) return !1;
|
|
296
|
+
}
|
|
297
|
+
} else return !1;
|
|
298
|
+
return !0;
|
|
299
|
+
default: return !1;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function E(e, t) {
|
|
303
|
+
return e === "symbol" || t["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && t instanceof Symbol;
|
|
304
|
+
}
|
|
305
|
+
function D(e) {
|
|
306
|
+
var t = typeof e;
|
|
307
|
+
return Array.isArray(e) ? "array" : e instanceof RegExp ? "object" : E(t, e) ? "symbol" : t;
|
|
308
|
+
}
|
|
309
|
+
function O(e) {
|
|
310
|
+
if (e == null) return "" + e;
|
|
311
|
+
var t = D(e);
|
|
312
|
+
if (t === "object") {
|
|
313
|
+
if (e instanceof Date) return "date";
|
|
314
|
+
if (e instanceof RegExp) return "regexp";
|
|
315
|
+
}
|
|
316
|
+
return t;
|
|
317
|
+
}
|
|
318
|
+
function k(e) {
|
|
319
|
+
var t = O(e);
|
|
320
|
+
switch (t) {
|
|
321
|
+
case "array":
|
|
322
|
+
case "object": return "an " + t;
|
|
323
|
+
case "boolean":
|
|
324
|
+
case "date":
|
|
325
|
+
case "regexp": return "a " + t;
|
|
326
|
+
default: return t;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function A(e) {
|
|
330
|
+
return !e.constructor || !e.constructor.name ? o : e.constructor.name;
|
|
331
|
+
}
|
|
332
|
+
return s.checkPropTypes = te, s.PropTypes = s, s;
|
|
333
|
+
}, w = n(function(e) {
|
|
334
|
+
var t = typeof Symbol == "function" && Symbol.for && Symbol.for("react.element") || 60103;
|
|
335
|
+
e.exports = C(function(e) {
|
|
336
|
+
return typeof e == "object" && !!e && e.$$typeof === t;
|
|
337
|
+
}, !0);
|
|
338
|
+
}), T = n(function(e) {
|
|
339
|
+
(function() {
|
|
340
|
+
var t = {}.hasOwnProperty;
|
|
341
|
+
function n() {
|
|
342
|
+
for (var e = [], r = 0; r < arguments.length; r++) {
|
|
343
|
+
var i = arguments[r];
|
|
344
|
+
if (i) {
|
|
345
|
+
var a = typeof i;
|
|
346
|
+
if (a === "string" || a === "number") e.push(i);
|
|
347
|
+
else if (Array.isArray(i)) e.push(n.apply(null, i));
|
|
348
|
+
else if (a === "object") for (var o in i) t.call(i, o) && i[o] && e.push(o);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return e.join(" ");
|
|
352
|
+
}
|
|
353
|
+
e.exports ? e.exports = n : window.classNames = n;
|
|
354
|
+
})();
|
|
355
|
+
});
|
|
356
|
+
function E(e, t) {
|
|
357
|
+
for (var n = 0, r = e.length; n < r; n++) if (t.apply(t, [
|
|
358
|
+
e[n],
|
|
359
|
+
n,
|
|
360
|
+
e
|
|
361
|
+
])) return e[n];
|
|
362
|
+
}
|
|
363
|
+
function D(e) {
|
|
364
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
365
|
+
}
|
|
366
|
+
function O(e) {
|
|
367
|
+
return typeof e == "number" && !isNaN(e);
|
|
368
|
+
}
|
|
369
|
+
function k(e) {
|
|
370
|
+
return parseInt(e, 10);
|
|
371
|
+
}
|
|
372
|
+
function A(e, t, n) {
|
|
373
|
+
if (e[t]) return /* @__PURE__ */ Error("Invalid prop " + t + " passed to " + n + " - do not set this, set it on the child.");
|
|
374
|
+
}
|
|
375
|
+
var j = [
|
|
376
|
+
"Moz",
|
|
377
|
+
"Webkit",
|
|
378
|
+
"O",
|
|
379
|
+
"ms"
|
|
380
|
+
];
|
|
381
|
+
function ne() {
|
|
382
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
|
|
383
|
+
if (typeof window > "u" || window.document === void 0) return "";
|
|
384
|
+
var t = window.document.documentElement.style;
|
|
385
|
+
if (e in t) return "";
|
|
386
|
+
for (var n = 0; n < j.length; n++) if (M(e, j[n]) in t) return j[n];
|
|
387
|
+
return "";
|
|
388
|
+
}
|
|
389
|
+
function M(e, t) {
|
|
390
|
+
return t ? "" + t + re(e) : e;
|
|
391
|
+
}
|
|
392
|
+
function re(e) {
|
|
393
|
+
for (var t = "", n = !0, r = 0; r < e.length; r++) n ? (t += e[r].toUpperCase(), n = !1) : e[r] === "-" ? n = !0 : t += e[r];
|
|
394
|
+
return t;
|
|
395
|
+
}
|
|
396
|
+
var ie = ne(), N = function(e, t) {
|
|
397
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
398
|
+
}, P = function() {
|
|
399
|
+
function e(e, t) {
|
|
400
|
+
for (var n = 0; n < t.length; n++) {
|
|
401
|
+
var r = t[n];
|
|
402
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return function(t, n, r) {
|
|
406
|
+
return n && e(t.prototype, n), r && e(t, r), t;
|
|
407
|
+
};
|
|
408
|
+
}(), F = function(e, t, n) {
|
|
409
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
410
|
+
value: n,
|
|
411
|
+
enumerable: !0,
|
|
412
|
+
configurable: !0,
|
|
413
|
+
writable: !0
|
|
414
|
+
}) : e[t] = n, e;
|
|
415
|
+
}, I = Object.assign || function(e) {
|
|
416
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
417
|
+
var n = arguments[t];
|
|
418
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
419
|
+
}
|
|
420
|
+
return e;
|
|
421
|
+
}, L = function(e, t) {
|
|
422
|
+
if (typeof t != "function" && t !== null) throw TypeError("Super expression must either be null or a function, not " + typeof t);
|
|
423
|
+
e.prototype = Object.create(t && t.prototype, { constructor: {
|
|
424
|
+
value: e,
|
|
425
|
+
enumerable: !1,
|
|
426
|
+
writable: !0,
|
|
427
|
+
configurable: !0
|
|
428
|
+
} }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
|
|
429
|
+
}, R = function(e, t) {
|
|
430
|
+
if (!e) throw ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
431
|
+
return t && (typeof t == "object" || typeof t == "function") ? t : e;
|
|
432
|
+
}, z = function() {
|
|
433
|
+
function e(e, t) {
|
|
434
|
+
var n = [], r = !0, i = !1, a = void 0;
|
|
435
|
+
try {
|
|
436
|
+
for (var o = e[Symbol.iterator](), s; !(r = (s = o.next()).done) && (n.push(s.value), !(t && n.length === t)); r = !0);
|
|
437
|
+
} catch (e) {
|
|
438
|
+
i = !0, a = e;
|
|
439
|
+
} finally {
|
|
440
|
+
try {
|
|
441
|
+
!r && o.return && o.return();
|
|
442
|
+
} finally {
|
|
443
|
+
if (i) throw a;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return n;
|
|
447
|
+
}
|
|
448
|
+
return function(t, n) {
|
|
449
|
+
if (Array.isArray(t)) return t;
|
|
450
|
+
if (Symbol.iterator in Object(t)) return e(t, n);
|
|
451
|
+
throw TypeError("Invalid attempt to destructure non-iterable instance");
|
|
452
|
+
};
|
|
453
|
+
}(), B = "";
|
|
454
|
+
function ae(e, t) {
|
|
455
|
+
return B ||= E([
|
|
456
|
+
"matches",
|
|
457
|
+
"webkitMatchesSelector",
|
|
458
|
+
"mozMatchesSelector",
|
|
459
|
+
"msMatchesSelector",
|
|
460
|
+
"oMatchesSelector"
|
|
461
|
+
], function(t) {
|
|
462
|
+
return D(e[t]);
|
|
463
|
+
}), D(e[B]) ? e[B](t) : !1;
|
|
464
|
+
}
|
|
465
|
+
function V(e, t, n) {
|
|
466
|
+
var r = e;
|
|
467
|
+
do {
|
|
468
|
+
if (ae(r, t)) return !0;
|
|
469
|
+
if (r === n) return !1;
|
|
470
|
+
r = r.parentNode;
|
|
471
|
+
} while (r);
|
|
472
|
+
return !1;
|
|
473
|
+
}
|
|
474
|
+
function H(e, t, n) {
|
|
475
|
+
e && (e.attachEvent ? e.attachEvent("on" + t, n) : e.addEventListener ? e.addEventListener(t, n, !0) : e["on" + t] = n);
|
|
476
|
+
}
|
|
477
|
+
function U(e, t, n) {
|
|
478
|
+
e && (e.detachEvent ? e.detachEvent("on" + t, n) : e.removeEventListener ? e.removeEventListener(t, n, !0) : e["on" + t] = null);
|
|
479
|
+
}
|
|
480
|
+
function oe(e) {
|
|
481
|
+
var t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
482
|
+
return t += k(n.borderTopWidth), t += k(n.borderBottomWidth), t;
|
|
483
|
+
}
|
|
484
|
+
function se(e) {
|
|
485
|
+
var t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
486
|
+
return t += k(n.borderLeftWidth), t += k(n.borderRightWidth), t;
|
|
487
|
+
}
|
|
488
|
+
function ce(e) {
|
|
489
|
+
var t = e.clientHeight, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
490
|
+
return t -= k(n.paddingTop), t -= k(n.paddingBottom), t;
|
|
491
|
+
}
|
|
492
|
+
function le(e) {
|
|
493
|
+
var t = e.clientWidth, n = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
494
|
+
return t -= k(n.paddingLeft), t -= k(n.paddingRight), t;
|
|
495
|
+
}
|
|
496
|
+
function ue(e, t) {
|
|
497
|
+
var n = t === t.ownerDocument.body ? {
|
|
498
|
+
left: 0,
|
|
499
|
+
top: 0
|
|
500
|
+
} : t.getBoundingClientRect();
|
|
501
|
+
return {
|
|
502
|
+
x: e.clientX + t.scrollLeft - n.left,
|
|
503
|
+
y: e.clientY + t.scrollTop - n.top
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function de(e, t) {
|
|
507
|
+
var n = W(e, t, "px");
|
|
508
|
+
return F({}, M("transform", ie), n);
|
|
509
|
+
}
|
|
510
|
+
function fe(e, t) {
|
|
511
|
+
return W(e, t, "");
|
|
512
|
+
}
|
|
513
|
+
function W(e, t, n) {
|
|
514
|
+
var r = e.x, i = e.y, a = "translate(" + r + n + "," + i + n + ")";
|
|
515
|
+
if (t) {
|
|
516
|
+
var o = "" + (typeof t.x == "string" ? t.x : t.x + n), s = "" + (typeof t.y == "string" ? t.y : t.y + n);
|
|
517
|
+
a = "translate(" + o + ", " + s + ")" + a;
|
|
518
|
+
}
|
|
519
|
+
return a;
|
|
520
|
+
}
|
|
521
|
+
function pe(e, t) {
|
|
522
|
+
return e.targetTouches && E(e.targetTouches, function(e) {
|
|
523
|
+
return t === e.identifier;
|
|
524
|
+
}) || e.changedTouches && E(e.changedTouches, function(e) {
|
|
525
|
+
return t === e.identifier;
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
function me(e) {
|
|
529
|
+
if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
|
530
|
+
if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
|
531
|
+
}
|
|
532
|
+
function he(e) {
|
|
533
|
+
if (e) {
|
|
534
|
+
var t = e.getElementById("react-draggable-style-el");
|
|
535
|
+
t || (t = e.createElement("style"), t.type = "text/css", t.id = "react-draggable-style-el", t.innerHTML = ".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n", t.innerHTML += ".react-draggable-transparent-selection *::selection {all: inherit;}\n", e.getElementsByTagName("head")[0].appendChild(t)), e.body && _e(e.body, "react-draggable-transparent-selection");
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
function G(e) {
|
|
539
|
+
try {
|
|
540
|
+
e && e.body && ve(e.body, "react-draggable-transparent-selection"), e.selection ? e.selection.empty() : window.getSelection().removeAllRanges();
|
|
541
|
+
} catch {}
|
|
542
|
+
}
|
|
543
|
+
function ge() {
|
|
544
|
+
return I({ touchAction: "none" }, arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {});
|
|
545
|
+
}
|
|
546
|
+
function _e(e, t) {
|
|
547
|
+
e.classList ? e.classList.add(t) : e.className.match(RegExp("(?:^|\\s)" + t + "(?!\\S)")) || (e.className += " " + t);
|
|
548
|
+
}
|
|
549
|
+
function ve(e, t) {
|
|
550
|
+
e.classList ? e.classList.remove(t) : e.className = e.className.replace(RegExp("(?:^|\\s)" + t + "(?!\\S)", "g"), "");
|
|
551
|
+
}
|
|
552
|
+
function ye(e, t, n) {
|
|
553
|
+
if (!e.props.bounds) return [t, n];
|
|
554
|
+
var r = e.props.bounds;
|
|
555
|
+
r = typeof r == "string" ? r : Ce(r);
|
|
556
|
+
var i = Y(e);
|
|
557
|
+
if (typeof r == "string") {
|
|
558
|
+
var a = i.ownerDocument, o = a.defaultView, s = void 0;
|
|
559
|
+
if (s = r === "parent" ? i.parentNode : a.querySelector(r), !(s instanceof o.HTMLElement)) throw Error("Bounds selector \"" + r + "\" could not find an element.");
|
|
560
|
+
var c = o.getComputedStyle(i), l = o.getComputedStyle(s);
|
|
561
|
+
r = {
|
|
562
|
+
left: -i.offsetLeft + k(l.paddingLeft) + k(c.marginLeft),
|
|
563
|
+
top: -i.offsetTop + k(l.paddingTop) + k(c.marginTop),
|
|
564
|
+
right: le(s) - se(i) - i.offsetLeft + k(l.paddingRight) - k(c.marginRight),
|
|
565
|
+
bottom: ce(s) - oe(i) - i.offsetTop + k(l.paddingBottom) - k(c.marginBottom)
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
return O(r.right) && (t = Math.min(t, r.right)), O(r.bottom) && (n = Math.min(n, r.bottom)), O(r.left) && (t = Math.max(t, r.left)), O(r.top) && (n = Math.max(n, r.top)), [t, n];
|
|
569
|
+
}
|
|
570
|
+
function be(e, t, n) {
|
|
571
|
+
return [Math.round(t / e[0]) * e[0], Math.round(n / e[1]) * e[1]];
|
|
572
|
+
}
|
|
573
|
+
function xe(e) {
|
|
574
|
+
return e.props.axis === "both" || e.props.axis === "x";
|
|
575
|
+
}
|
|
576
|
+
function Se(e) {
|
|
577
|
+
return e.props.axis === "both" || e.props.axis === "y";
|
|
578
|
+
}
|
|
579
|
+
function K(e, t, n) {
|
|
580
|
+
var r = typeof t == "number" ? pe(e, t) : null;
|
|
581
|
+
if (typeof t == "number" && !r) return null;
|
|
582
|
+
var i = Y(n), a = n.props.offsetParent || i.offsetParent || i.ownerDocument.body;
|
|
583
|
+
return ue(r || e, a);
|
|
584
|
+
}
|
|
585
|
+
function q(e, t, n) {
|
|
586
|
+
var r = e.state, i = !O(r.lastX), a = Y(e);
|
|
587
|
+
return i ? {
|
|
588
|
+
node: a,
|
|
589
|
+
deltaX: 0,
|
|
590
|
+
deltaY: 0,
|
|
591
|
+
lastX: t,
|
|
592
|
+
lastY: n,
|
|
593
|
+
x: t,
|
|
594
|
+
y: n
|
|
595
|
+
} : {
|
|
596
|
+
node: a,
|
|
597
|
+
deltaX: t - r.lastX,
|
|
598
|
+
deltaY: n - r.lastY,
|
|
599
|
+
lastX: r.lastX,
|
|
600
|
+
lastY: r.lastY,
|
|
601
|
+
x: t,
|
|
602
|
+
y: n
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function J(e, t) {
|
|
606
|
+
var n = e.props.scale;
|
|
607
|
+
return {
|
|
608
|
+
node: t.node,
|
|
609
|
+
x: e.state.x + t.deltaX / n,
|
|
610
|
+
y: e.state.y + t.deltaY / n,
|
|
611
|
+
deltaX: t.deltaX / n,
|
|
612
|
+
deltaY: t.deltaY / n,
|
|
613
|
+
lastX: e.state.x,
|
|
614
|
+
lastY: e.state.y
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function Ce(e) {
|
|
618
|
+
return {
|
|
619
|
+
left: e.left,
|
|
620
|
+
top: e.top,
|
|
621
|
+
right: e.right,
|
|
622
|
+
bottom: e.bottom
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function Y(t) {
|
|
626
|
+
var n = e.findDOMNode(t);
|
|
627
|
+
if (!n) throw Error("<DraggableCore>: Unmounted during event!");
|
|
628
|
+
return n;
|
|
629
|
+
}
|
|
630
|
+
var X = {
|
|
631
|
+
touch: {
|
|
632
|
+
start: "touchstart",
|
|
633
|
+
move: "touchmove",
|
|
634
|
+
stop: "touchend"
|
|
635
|
+
},
|
|
636
|
+
mouse: {
|
|
637
|
+
start: "mousedown",
|
|
638
|
+
move: "mousemove",
|
|
639
|
+
stop: "mouseup"
|
|
640
|
+
}
|
|
641
|
+
}, Z = X.mouse, Q = function(n) {
|
|
642
|
+
L(r, n);
|
|
643
|
+
function r() {
|
|
644
|
+
var t, n, i, a;
|
|
645
|
+
N(this, r);
|
|
646
|
+
var o = [...arguments];
|
|
647
|
+
return a = (n = (i = R(this, (t = r.__proto__ || Object.getPrototypeOf(r)).call.apply(t, [this].concat(o))), i), i.state = {
|
|
648
|
+
dragging: !1,
|
|
649
|
+
lastX: NaN,
|
|
650
|
+
lastY: NaN,
|
|
651
|
+
touchIdentifier: null
|
|
652
|
+
}, i.handleDragStart = function(t) {
|
|
653
|
+
if (i.props.onMouseDown(t), !i.props.allowAnyClick && typeof t.button == "number" && t.button !== 0) return !1;
|
|
654
|
+
var n = e.findDOMNode(i);
|
|
655
|
+
if (!n || !n.ownerDocument || !n.ownerDocument.body) throw Error("<DraggableCore> not mounted on DragStart!");
|
|
656
|
+
var r = n.ownerDocument;
|
|
657
|
+
if (!(i.props.disabled || !(t.target instanceof r.defaultView.Node) || i.props.handle && !V(t.target, i.props.handle, n) || i.props.cancel && V(t.target, i.props.cancel, n))) {
|
|
658
|
+
var a = me(t);
|
|
659
|
+
i.setState({ touchIdentifier: a });
|
|
660
|
+
var o = K(t, a, i);
|
|
661
|
+
if (o != null) {
|
|
662
|
+
var s = o.x, c = o.y, l = q(i, s, c);
|
|
663
|
+
i.props.onStart, i.props.onStart(t, l) !== !1 && (i.props.enableUserSelectHack && he(r), i.setState({
|
|
664
|
+
dragging: !0,
|
|
665
|
+
lastX: s,
|
|
666
|
+
lastY: c
|
|
667
|
+
}), H(r, Z.move, i.handleDrag), H(r, Z.stop, i.handleDragStop));
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}, i.handleDrag = function(e) {
|
|
671
|
+
e.type === "touchmove" && e.preventDefault();
|
|
672
|
+
var t = K(e, i.state.touchIdentifier, i);
|
|
673
|
+
if (t != null) {
|
|
674
|
+
var n = t.x, r = t.y;
|
|
675
|
+
if (Array.isArray(i.props.grid)) {
|
|
676
|
+
var a = n - i.state.lastX, o = r - i.state.lastY, s = z(be(i.props.grid, a, o), 2);
|
|
677
|
+
if (a = s[0], o = s[1], !a && !o) return;
|
|
678
|
+
n = i.state.lastX + a, r = i.state.lastY + o;
|
|
679
|
+
}
|
|
680
|
+
var c = q(i, n, r);
|
|
681
|
+
if (i.props.onDrag(e, c) === !1) {
|
|
682
|
+
try {
|
|
683
|
+
i.handleDragStop(new MouseEvent("mouseup"));
|
|
684
|
+
} catch {
|
|
685
|
+
var l = document.createEvent("MouseEvents");
|
|
686
|
+
l.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), i.handleDragStop(l);
|
|
687
|
+
}
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
i.setState({
|
|
691
|
+
lastX: n,
|
|
692
|
+
lastY: r
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
}, i.handleDragStop = function(t) {
|
|
696
|
+
if (i.state.dragging) {
|
|
697
|
+
var n = K(t, i.state.touchIdentifier, i);
|
|
698
|
+
if (n != null) {
|
|
699
|
+
var r = n.x, a = n.y, o = q(i, r, a), s = e.findDOMNode(i);
|
|
700
|
+
s && i.props.enableUserSelectHack && G(s.ownerDocument), i.setState({
|
|
701
|
+
dragging: !1,
|
|
702
|
+
lastX: NaN,
|
|
703
|
+
lastY: NaN
|
|
704
|
+
}), i.props.onStop(t, o), s && (U(s.ownerDocument, Z.move, i.handleDrag), U(s.ownerDocument, Z.stop, i.handleDragStop));
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}, i.onMouseDown = function(e) {
|
|
708
|
+
return Z = X.mouse, i.handleDragStart(e);
|
|
709
|
+
}, i.onMouseUp = function(e) {
|
|
710
|
+
return Z = X.mouse, i.handleDragStop(e);
|
|
711
|
+
}, i.onTouchStart = function(e) {
|
|
712
|
+
return Z = X.touch, i.handleDragStart(e);
|
|
713
|
+
}, i.onTouchEnd = function(e) {
|
|
714
|
+
return Z = X.touch, i.handleDragStop(e);
|
|
715
|
+
}, n), R(i, a);
|
|
716
|
+
}
|
|
717
|
+
return P(r, [{
|
|
718
|
+
key: "componentWillUnmount",
|
|
719
|
+
value: function() {
|
|
720
|
+
var t = e.findDOMNode(this);
|
|
721
|
+
if (t) {
|
|
722
|
+
var n = t.ownerDocument;
|
|
723
|
+
U(n, X.mouse.move, this.handleDrag), U(n, X.touch.move, this.handleDrag), U(n, X.mouse.stop, this.handleDragStop), U(n, X.touch.stop, this.handleDragStop), this.props.enableUserSelectHack && G(n);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}, {
|
|
727
|
+
key: "render",
|
|
728
|
+
value: function() {
|
|
729
|
+
return t.cloneElement(t.Children.only(this.props.children), {
|
|
730
|
+
style: ge(this.props.children.props.style),
|
|
731
|
+
onMouseDown: this.onMouseDown,
|
|
732
|
+
onTouchStart: this.onTouchStart,
|
|
733
|
+
onMouseUp: this.onMouseUp,
|
|
734
|
+
onTouchEnd: this.onTouchEnd
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}]), r;
|
|
738
|
+
}(t.Component);
|
|
739
|
+
Q.displayName = "DraggableCore", Q.propTypes = {
|
|
740
|
+
allowAnyClick: w.bool,
|
|
741
|
+
disabled: w.bool,
|
|
742
|
+
enableUserSelectHack: w.bool,
|
|
743
|
+
offsetParent: function(e, t) {
|
|
744
|
+
if (e[t] && e[t].nodeType !== 1) throw Error("Draggable's offsetParent must be a DOM Node.");
|
|
745
|
+
},
|
|
746
|
+
grid: w.arrayOf(w.number),
|
|
747
|
+
scale: w.number,
|
|
748
|
+
handle: w.string,
|
|
749
|
+
cancel: w.string,
|
|
750
|
+
onStart: w.func,
|
|
751
|
+
onDrag: w.func,
|
|
752
|
+
onStop: w.func,
|
|
753
|
+
onMouseDown: w.func,
|
|
754
|
+
className: A,
|
|
755
|
+
style: A,
|
|
756
|
+
transform: A
|
|
757
|
+
}, Q.defaultProps = {
|
|
758
|
+
allowAnyClick: !1,
|
|
759
|
+
cancel: null,
|
|
760
|
+
disabled: !1,
|
|
761
|
+
enableUserSelectHack: !0,
|
|
762
|
+
offsetParent: null,
|
|
763
|
+
handle: null,
|
|
764
|
+
grid: null,
|
|
765
|
+
transform: null,
|
|
766
|
+
onStart: function() {},
|
|
767
|
+
onDrag: function() {},
|
|
768
|
+
onStop: function() {},
|
|
769
|
+
onMouseDown: function() {}
|
|
770
|
+
};
|
|
771
|
+
var $ = function(n) {
|
|
772
|
+
L(r, n);
|
|
773
|
+
function r(e) {
|
|
774
|
+
N(this, r);
|
|
775
|
+
var t = R(this, (r.__proto__ || Object.getPrototypeOf(r)).call(this, e));
|
|
776
|
+
return t.onDragStart = function(e, n) {
|
|
777
|
+
if (t.props.onStart(e, J(t, n)) === !1) return !1;
|
|
778
|
+
t.setState({
|
|
779
|
+
dragging: !0,
|
|
780
|
+
dragged: !0
|
|
781
|
+
});
|
|
782
|
+
}, t.onDrag = function(e, n) {
|
|
783
|
+
if (!t.state.dragging) return !1;
|
|
784
|
+
var r = J(t, n), i = {
|
|
785
|
+
x: r.x,
|
|
786
|
+
y: r.y
|
|
787
|
+
};
|
|
788
|
+
if (t.props.bounds) {
|
|
789
|
+
var a = i.x, o = i.y;
|
|
790
|
+
i.x += t.state.slackX, i.y += t.state.slackY;
|
|
791
|
+
var s = z(ye(t, i.x, i.y), 2), c = s[0], l = s[1];
|
|
792
|
+
i.x = c, i.y = l, i.slackX = t.state.slackX + (a - i.x), i.slackY = t.state.slackY + (o - i.y), r.x = i.x, r.y = i.y, r.deltaX = i.x - t.state.x, r.deltaY = i.y - t.state.y;
|
|
793
|
+
}
|
|
794
|
+
if (t.props.onDrag(e, r) === !1) return !1;
|
|
795
|
+
t.setState(i);
|
|
796
|
+
}, t.onDragStop = function(e, n) {
|
|
797
|
+
if (!t.state.dragging || t.props.onStop(e, J(t, n)) === !1) return !1;
|
|
798
|
+
var r = {
|
|
799
|
+
dragging: !1,
|
|
800
|
+
slackX: 0,
|
|
801
|
+
slackY: 0
|
|
802
|
+
};
|
|
803
|
+
if (t.props.position) {
|
|
804
|
+
var i = t.props.position, a = i.x, o = i.y;
|
|
805
|
+
r.x = a, r.y = o;
|
|
806
|
+
}
|
|
807
|
+
t.setState(r);
|
|
808
|
+
}, t.state = {
|
|
809
|
+
dragging: !1,
|
|
810
|
+
dragged: !1,
|
|
811
|
+
x: e.position ? e.position.x : e.defaultPosition.x,
|
|
812
|
+
y: e.position ? e.position.y : e.defaultPosition.y,
|
|
813
|
+
slackX: 0,
|
|
814
|
+
slackY: 0,
|
|
815
|
+
isElementSVG: !1
|
|
816
|
+
}, e.position && !(e.onDrag || e.onStop) && 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."), t;
|
|
817
|
+
}
|
|
818
|
+
return P(r, [
|
|
819
|
+
{
|
|
820
|
+
key: "componentDidMount",
|
|
821
|
+
value: function() {
|
|
822
|
+
window.SVGElement !== void 0 && e.findDOMNode(this) instanceof window.SVGElement && this.setState({ isElementSVG: !0 });
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
key: "componentWillReceiveProps",
|
|
827
|
+
value: function(e) {
|
|
828
|
+
e.position && (!this.props.position || e.position.x !== this.props.position.x || e.position.y !== this.props.position.y) && this.setState({
|
|
829
|
+
x: e.position.x,
|
|
830
|
+
y: e.position.y
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
key: "componentWillUnmount",
|
|
836
|
+
value: function() {
|
|
837
|
+
this.setState({ dragging: !1 });
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
key: "render",
|
|
842
|
+
value: function() {
|
|
843
|
+
var e, n = {}, r = null, i = !this.props.position || this.state.dragging, a = this.props.position || this.props.defaultPosition, o = {
|
|
844
|
+
x: xe(this) && i ? this.state.x : a.x,
|
|
845
|
+
y: Se(this) && i ? this.state.y : a.y
|
|
846
|
+
};
|
|
847
|
+
this.state.isElementSVG ? r = fe(o, this.props.positionOffset) : n = de(o, this.props.positionOffset);
|
|
848
|
+
var s = this.props, c = s.defaultClassName, l = s.defaultClassNameDragging, u = s.defaultClassNameDragged, d = t.Children.only(this.props.children), f = T(d.props.className || "", c, (e = {}, F(e, l, this.state.dragging), F(e, u, this.state.dragged), e));
|
|
849
|
+
return t.createElement(Q, I({}, this.props, {
|
|
850
|
+
onStart: this.onDragStart,
|
|
851
|
+
onDrag: this.onDrag,
|
|
852
|
+
onStop: this.onDragStop
|
|
853
|
+
}), t.cloneElement(d, {
|
|
854
|
+
className: f,
|
|
855
|
+
style: I({}, d.props.style, n),
|
|
856
|
+
transform: r
|
|
857
|
+
}));
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
]), r;
|
|
861
|
+
}(t.Component);
|
|
862
|
+
return $.displayName = "Draggable", $.propTypes = I({}, Q.propTypes, {
|
|
863
|
+
axis: w.oneOf([
|
|
864
|
+
"both",
|
|
865
|
+
"x",
|
|
866
|
+
"y",
|
|
867
|
+
"none"
|
|
868
|
+
]),
|
|
869
|
+
bounds: w.oneOfType([
|
|
870
|
+
w.shape({
|
|
871
|
+
left: w.number,
|
|
872
|
+
right: w.number,
|
|
873
|
+
top: w.number,
|
|
874
|
+
bottom: w.number
|
|
875
|
+
}),
|
|
876
|
+
w.string,
|
|
877
|
+
w.oneOf([!1])
|
|
878
|
+
]),
|
|
879
|
+
defaultClassName: w.string,
|
|
880
|
+
defaultClassNameDragging: w.string,
|
|
881
|
+
defaultClassNameDragged: w.string,
|
|
882
|
+
defaultPosition: w.shape({
|
|
883
|
+
x: w.number,
|
|
884
|
+
y: w.number
|
|
885
|
+
}),
|
|
886
|
+
positionOffset: w.shape({
|
|
887
|
+
x: w.oneOfType([w.number, w.string]),
|
|
888
|
+
y: w.oneOfType([w.number, w.string])
|
|
889
|
+
}),
|
|
890
|
+
position: w.shape({
|
|
891
|
+
x: w.number,
|
|
892
|
+
y: w.number
|
|
893
|
+
}),
|
|
894
|
+
className: A,
|
|
895
|
+
style: A,
|
|
896
|
+
transform: A
|
|
897
|
+
}), $.defaultProps = I({}, Q.defaultProps, {
|
|
898
|
+
axis: "both",
|
|
899
|
+
bounds: !1,
|
|
900
|
+
defaultClassName: "react-draggable",
|
|
901
|
+
defaultClassNameDragging: "react-draggable-dragging",
|
|
902
|
+
defaultClassNameDragged: "react-draggable-dragged",
|
|
903
|
+
defaultPosition: {
|
|
904
|
+
x: 0,
|
|
905
|
+
y: 0
|
|
906
|
+
},
|
|
907
|
+
position: null,
|
|
908
|
+
scale: 1
|
|
909
|
+
}), $.default = $, $.DraggableCore = Q, $;
|
|
910
|
+
}));
|
|
911
|
+
}));
|
|
912
|
+
//#endregion
|
|
913
|
+
export default n();
|
|
914
|
+
export { n as require_react_draggable };
|