zmdms-webui 2.5.1 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/es/_virtual/index2.js +2 -2
  2. package/dist/es/modal/useDraggable.js +1 -1
  3. package/dist/es/node_modules/immutability-helper/index.js +1 -1
  4. package/dist/es/node_modules/rc-util/es/Dom/findDOMNode.js +2 -2
  5. package/dist/es/node_modules/react-is/cjs/react-is.development.js +1 -1
  6. package/dist/es/node_modules/react-is/cjs/react-is.production.min.js +1 -1
  7. package/dist/es/node_modules/react-is/index.js +1 -1
  8. package/package.json +2 -2
  9. package/dist/es/_virtual/Draggable.js +0 -3
  10. package/dist/es/_virtual/DraggableCore.js +0 -3
  11. package/dist/es/_virtual/cjs.js +0 -3
  12. package/dist/es/_virtual/clsx.js +0 -3
  13. package/dist/es/_virtual/domFns.js +0 -3
  14. package/dist/es/_virtual/getPrefix.js +0 -3
  15. package/dist/es/_virtual/index4.js +0 -3
  16. package/dist/es/_virtual/index5.js +0 -3
  17. package/dist/es/_virtual/log.js +0 -3
  18. package/dist/es/_virtual/positionFns.js +0 -3
  19. package/dist/es/_virtual/react-is.development2.js +0 -3
  20. package/dist/es/_virtual/react-is.production.min2.js +0 -3
  21. package/dist/es/_virtual/shims.js +0 -3
  22. package/dist/es/node_modules/object-assign/index.js +0 -99
  23. package/dist/es/node_modules/prop-types/checkPropTypes.js +0 -115
  24. package/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -74
  25. package/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -625
  26. package/dist/es/node_modules/prop-types/index.js +0 -28
  27. package/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -21
  28. package/dist/es/node_modules/prop-types/lib/has.js +0 -11
  29. package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -190
  30. package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -26
  31. package/dist/es/node_modules/prop-types/node_modules/react-is/index.js +0 -19
  32. package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +0 -412
  33. package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +0 -453
  34. package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +0 -21
  35. package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +0 -237
  36. package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +0 -52
  37. package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +0 -9
  38. package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +0 -155
  39. package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +0 -33
  40. package/dist/es/node_modules/react-draggable/node_modules/clsx/dist/clsx.js +0 -7
@@ -1,190 +0,0 @@
1
- import { __exports as reactIs_development } from '../../../../../_virtual/react-is.development.js';
2
-
3
- /** @license React v16.13.1
4
- * react-is.development.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */
11
-
12
- var hasRequiredReactIs_development;
13
-
14
- function requireReactIs_development () {
15
- if (hasRequiredReactIs_development) return reactIs_development;
16
- hasRequiredReactIs_development = 1;
17
-
18
-
19
-
20
- if (process.env.NODE_ENV !== "production") {
21
- (function() {
22
-
23
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
24
- // nor polyfill, then a plain number is used for performance.
25
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
26
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
27
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
28
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
29
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
30
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
33
- // (unstable) APIs that have been removed. Can we remove the symbols?
34
-
35
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
36
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
37
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
38
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
39
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
40
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
41
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
42
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
43
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
44
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
45
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
46
-
47
- function isValidElementType(type) {
48
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
49
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
50
- }
51
-
52
- function typeOf(object) {
53
- if (typeof object === 'object' && object !== null) {
54
- var $$typeof = object.$$typeof;
55
-
56
- switch ($$typeof) {
57
- case REACT_ELEMENT_TYPE:
58
- var type = object.type;
59
-
60
- switch (type) {
61
- case REACT_ASYNC_MODE_TYPE:
62
- case REACT_CONCURRENT_MODE_TYPE:
63
- case REACT_FRAGMENT_TYPE:
64
- case REACT_PROFILER_TYPE:
65
- case REACT_STRICT_MODE_TYPE:
66
- case REACT_SUSPENSE_TYPE:
67
- return type;
68
-
69
- default:
70
- var $$typeofType = type && type.$$typeof;
71
-
72
- switch ($$typeofType) {
73
- case REACT_CONTEXT_TYPE:
74
- case REACT_FORWARD_REF_TYPE:
75
- case REACT_LAZY_TYPE:
76
- case REACT_MEMO_TYPE:
77
- case REACT_PROVIDER_TYPE:
78
- return $$typeofType;
79
-
80
- default:
81
- return $$typeof;
82
- }
83
-
84
- }
85
-
86
- case REACT_PORTAL_TYPE:
87
- return $$typeof;
88
- }
89
- }
90
-
91
- return undefined;
92
- } // AsyncMode is deprecated along with isAsyncMode
93
-
94
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
95
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
96
- var ContextConsumer = REACT_CONTEXT_TYPE;
97
- var ContextProvider = REACT_PROVIDER_TYPE;
98
- var Element = REACT_ELEMENT_TYPE;
99
- var ForwardRef = REACT_FORWARD_REF_TYPE;
100
- var Fragment = REACT_FRAGMENT_TYPE;
101
- var Lazy = REACT_LAZY_TYPE;
102
- var Memo = REACT_MEMO_TYPE;
103
- var Portal = REACT_PORTAL_TYPE;
104
- var Profiler = REACT_PROFILER_TYPE;
105
- var StrictMode = REACT_STRICT_MODE_TYPE;
106
- var Suspense = REACT_SUSPENSE_TYPE;
107
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
108
-
109
- function isAsyncMode(object) {
110
- {
111
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
112
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
113
-
114
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
115
- }
116
- }
117
-
118
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
119
- }
120
- function isConcurrentMode(object) {
121
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
122
- }
123
- function isContextConsumer(object) {
124
- return typeOf(object) === REACT_CONTEXT_TYPE;
125
- }
126
- function isContextProvider(object) {
127
- return typeOf(object) === REACT_PROVIDER_TYPE;
128
- }
129
- function isElement(object) {
130
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
131
- }
132
- function isForwardRef(object) {
133
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
134
- }
135
- function isFragment(object) {
136
- return typeOf(object) === REACT_FRAGMENT_TYPE;
137
- }
138
- function isLazy(object) {
139
- return typeOf(object) === REACT_LAZY_TYPE;
140
- }
141
- function isMemo(object) {
142
- return typeOf(object) === REACT_MEMO_TYPE;
143
- }
144
- function isPortal(object) {
145
- return typeOf(object) === REACT_PORTAL_TYPE;
146
- }
147
- function isProfiler(object) {
148
- return typeOf(object) === REACT_PROFILER_TYPE;
149
- }
150
- function isStrictMode(object) {
151
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
152
- }
153
- function isSuspense(object) {
154
- return typeOf(object) === REACT_SUSPENSE_TYPE;
155
- }
156
-
157
- reactIs_development.AsyncMode = AsyncMode;
158
- reactIs_development.ConcurrentMode = ConcurrentMode;
159
- reactIs_development.ContextConsumer = ContextConsumer;
160
- reactIs_development.ContextProvider = ContextProvider;
161
- reactIs_development.Element = Element;
162
- reactIs_development.ForwardRef = ForwardRef;
163
- reactIs_development.Fragment = Fragment;
164
- reactIs_development.Lazy = Lazy;
165
- reactIs_development.Memo = Memo;
166
- reactIs_development.Portal = Portal;
167
- reactIs_development.Profiler = Profiler;
168
- reactIs_development.StrictMode = StrictMode;
169
- reactIs_development.Suspense = Suspense;
170
- reactIs_development.isAsyncMode = isAsyncMode;
171
- reactIs_development.isConcurrentMode = isConcurrentMode;
172
- reactIs_development.isContextConsumer = isContextConsumer;
173
- reactIs_development.isContextProvider = isContextProvider;
174
- reactIs_development.isElement = isElement;
175
- reactIs_development.isForwardRef = isForwardRef;
176
- reactIs_development.isFragment = isFragment;
177
- reactIs_development.isLazy = isLazy;
178
- reactIs_development.isMemo = isMemo;
179
- reactIs_development.isPortal = isPortal;
180
- reactIs_development.isProfiler = isProfiler;
181
- reactIs_development.isStrictMode = isStrictMode;
182
- reactIs_development.isSuspense = isSuspense;
183
- reactIs_development.isValidElementType = isValidElementType;
184
- reactIs_development.typeOf = typeOf;
185
- })();
186
- }
187
- return reactIs_development;
188
- }
189
-
190
- export { requireReactIs_development as __require };
@@ -1,26 +0,0 @@
1
- import { __exports as reactIs_production_min } from '../../../../../_virtual/react-is.production.min.js';
2
-
3
- /** @license React v16.13.1
4
- * react-is.production.min.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */
11
-
12
- var hasRequiredReactIs_production_min;
13
-
14
- function requireReactIs_production_min () {
15
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
16
- hasRequiredReactIs_production_min = 1;
17
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
18
- Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
19
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
20
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
21
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
22
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
23
- return reactIs_production_min;
24
- }
25
-
26
- export { requireReactIs_production_min as __require };
@@ -1,19 +0,0 @@
1
- import { __module as reactIs } from '../../../../_virtual/index3.js';
2
- import { __require as requireReactIs_production_min } from './cjs/react-is.production.min.js';
3
- import { __require as requireReactIs_development } from './cjs/react-is.development.js';
4
-
5
- var hasRequiredReactIs;
6
-
7
- function requireReactIs () {
8
- if (hasRequiredReactIs) return reactIs.exports;
9
- hasRequiredReactIs = 1;
10
-
11
- if (process.env.NODE_ENV === 'production') {
12
- reactIs.exports = requireReactIs_production_min();
13
- } else {
14
- reactIs.exports = requireReactIs_development();
15
- }
16
- return reactIs.exports;
17
- }
18
-
19
- export { requireReactIs as __require };
@@ -1,412 +0,0 @@
1
- import { __exports as Draggable } from '../../../../_virtual/Draggable.js';
2
- import React__default from 'react';
3
- import { p as propTypesExports } from '../../../prop-types/index.js';
4
- import require$$2 from 'react-dom';
5
- import { c as clsxExports } from '../../node_modules/clsx/dist/clsx.js';
6
- import './utils/domFns.js';
7
- import './utils/positionFns.js';
8
- import './utils/shims.js';
9
- import './DraggableCore.js';
10
- import './utils/log.js';
11
- import { __exports as domFns } from '../../../../_virtual/domFns.js';
12
- import { __exports as positionFns } from '../../../../_virtual/positionFns.js';
13
- import { __exports as shims } from '../../../../_virtual/shims.js';
14
- import { __exports as DraggableCore } from '../../../../_virtual/DraggableCore.js';
15
- import { __exports as log } from '../../../../_virtual/log.js';
16
-
17
- (function (exports) {
18
-
19
- Object.defineProperty(exports, "__esModule", {
20
- value: true
21
- });
22
- Object.defineProperty(exports, "DraggableCore", {
23
- enumerable: true,
24
- get: function () {
25
- return _DraggableCore.default;
26
- }
27
- });
28
- exports.default = void 0;
29
- var React = _interopRequireWildcard(React__default);
30
- var _propTypes = _interopRequireDefault(propTypesExports);
31
- var _reactDom = _interopRequireDefault(require$$2);
32
- var _clsx = clsxExports;
33
- var _domFns = domFns;
34
- var _positionFns = positionFns;
35
- var _shims = shims;
36
- var _DraggableCore = _interopRequireDefault(DraggableCore);
37
- var _log = _interopRequireDefault(log);
38
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
39
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
40
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
41
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
42
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
43
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*:: import type {ControlPosition, PositionOffsetControlPosition, DraggableCoreProps, DraggableCoreDefaultProps} from './DraggableCore';*/
44
- /*:: import type {Bounds, DraggableEventHandler} from './utils/types';*/
45
- /*:: import type {Element as ReactElement} from 'react';*/
46
- /*:: type DraggableState = {
47
- dragging: boolean,
48
- dragged: boolean,
49
- x: number, y: number,
50
- slackX: number, slackY: number,
51
- isElementSVG: boolean,
52
- prevPropsPosition: ?ControlPosition,
53
- };*/
54
- /*:: export type DraggableDefaultProps = {
55
- ...DraggableCoreDefaultProps,
56
- axis: 'both' | 'x' | 'y' | 'none',
57
- bounds: Bounds | string | false,
58
- defaultClassName: string,
59
- defaultClassNameDragging: string,
60
- defaultClassNameDragged: string,
61
- defaultPosition: ControlPosition,
62
- scale: number,
63
- };*/
64
- /*:: export type DraggableProps = {
65
- ...DraggableCoreProps,
66
- ...DraggableDefaultProps,
67
- positionOffset: PositionOffsetControlPosition,
68
- position: ControlPosition,
69
- };*/
70
- //
71
- // Define <Draggable>
72
- //
73
- class Draggable extends React.Component /*:: <DraggableProps, DraggableState>*/{
74
- // React 16.3+
75
- // Arity (props, state)
76
- static getDerivedStateFromProps(_ref /*:: */, _ref2 /*:: */) /*: ?Partial<DraggableState>*/{
77
- let {
78
- position
79
- } /*: DraggableProps*/ = _ref /*: DraggableProps*/;
80
- let {
81
- prevPropsPosition
82
- } /*: DraggableState*/ = _ref2 /*: DraggableState*/;
83
- // Set x/y if a new position is provided in props that is different than the previous.
84
- if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
85
- (0, _log.default)('Draggable: getDerivedStateFromProps %j', {
86
- position,
87
- prevPropsPosition
88
- });
89
- return {
90
- x: position.x,
91
- y: position.y,
92
- prevPropsPosition: {
93
- ...position
94
- }
95
- };
96
- }
97
- return null;
98
- }
99
- constructor(props /*: DraggableProps*/) {
100
- super(props);
101
- _defineProperty(this, "onDragStart", (e, coreData) => {
102
- (0, _log.default)('Draggable: onDragStart: %j', coreData);
103
-
104
- // Short-circuit if user's callback killed it.
105
- const shouldStart = this.props.onStart(e, (0, _positionFns.createDraggableData)(this, coreData));
106
- // Kills start event on core as well, so move handlers are never bound.
107
- if (shouldStart === false) return false;
108
- this.setState({
109
- dragging: true,
110
- dragged: true
111
- });
112
- });
113
- _defineProperty(this, "onDrag", (e, coreData) => {
114
- if (!this.state.dragging) return false;
115
- (0, _log.default)('Draggable: onDrag: %j', coreData);
116
- const uiData = (0, _positionFns.createDraggableData)(this, coreData);
117
- const newState = {
118
- x: uiData.x,
119
- y: uiData.y,
120
- slackX: 0,
121
- slackY: 0
122
- };
123
-
124
- // Keep within bounds.
125
- if (this.props.bounds) {
126
- // Save original x and y.
127
- const {
128
- x,
129
- y
130
- } = newState;
131
-
132
- // Add slack to the values used to calculate bound position. This will ensure that if
133
- // we start removing slack, the element won't react to it right away until it's been
134
- // completely removed.
135
- newState.x += this.state.slackX;
136
- newState.y += this.state.slackY;
137
-
138
- // Get bound position. This will ceil/floor the x and y within the boundaries.
139
- const [newStateX, newStateY] = (0, _positionFns.getBoundPosition)(this, newState.x, newState.y);
140
- newState.x = newStateX;
141
- newState.y = newStateY;
142
-
143
- // Recalculate slack by noting how much was shaved by the boundPosition handler.
144
- newState.slackX = this.state.slackX + (x - newState.x);
145
- newState.slackY = this.state.slackY + (y - newState.y);
146
-
147
- // Update the event we fire to reflect what really happened after bounds took effect.
148
- uiData.x = newState.x;
149
- uiData.y = newState.y;
150
- uiData.deltaX = newState.x - this.state.x;
151
- uiData.deltaY = newState.y - this.state.y;
152
- }
153
-
154
- // Short-circuit if user's callback killed it.
155
- const shouldUpdate = this.props.onDrag(e, uiData);
156
- if (shouldUpdate === false) return false;
157
- this.setState(newState);
158
- });
159
- _defineProperty(this, "onDragStop", (e, coreData) => {
160
- if (!this.state.dragging) return false;
161
-
162
- // Short-circuit if user's callback killed it.
163
- const shouldContinue = this.props.onStop(e, (0, _positionFns.createDraggableData)(this, coreData));
164
- if (shouldContinue === false) return false;
165
- (0, _log.default)('Draggable: onDragStop: %j', coreData);
166
- const newState /*: Partial<DraggableState>*/ = {
167
- dragging: false,
168
- slackX: 0,
169
- slackY: 0
170
- };
171
-
172
- // If this is a controlled component, the result of this operation will be to
173
- // revert back to the old position. We expect a handler on `onDragStop`, at the least.
174
- const controlled = Boolean(this.props.position);
175
- if (controlled) {
176
- const {
177
- x,
178
- y
179
- } = this.props.position;
180
- newState.x = x;
181
- newState.y = y;
182
- }
183
- this.setState(newState);
184
- });
185
- this.state = {
186
- // Whether or not we are currently dragging.
187
- dragging: false,
188
- // Whether or not we have been dragged before.
189
- dragged: false,
190
- // Current transform x and y.
191
- x: props.position ? props.position.x : props.defaultPosition.x,
192
- y: props.position ? props.position.y : props.defaultPosition.y,
193
- prevPropsPosition: {
194
- ...props.position
195
- },
196
- // Used for compensating for out-of-bounds drags
197
- slackX: 0,
198
- slackY: 0,
199
- // Can only determine if SVG after mounting
200
- isElementSVG: false
201
- };
202
- if (props.position && !(props.onDrag || props.onStop)) {
203
- // eslint-disable-next-line no-console
204
- 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.');
205
- }
206
- }
207
- componentDidMount() {
208
- // Check to see if the element passed is an instanceof SVGElement
209
- if (typeof window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {
210
- this.setState({
211
- isElementSVG: true
212
- });
213
- }
214
- }
215
- componentWillUnmount() {
216
- if (this.state.dragging) {
217
- this.setState({
218
- dragging: false
219
- }); // prevents invariant if unmounted while dragging
220
- }
221
- }
222
-
223
- // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
224
- // the underlying DOM node ourselves. See the README for more information.
225
- findDOMNode() /*: ?HTMLElement*/{
226
- return this.props?.nodeRef?.current ?? _reactDom.default.findDOMNode(this);
227
- }
228
- render() /*: ReactElement<any>*/{
229
- const {
230
- axis,
231
- bounds,
232
- children,
233
- defaultPosition,
234
- defaultClassName,
235
- defaultClassNameDragging,
236
- defaultClassNameDragged,
237
- position,
238
- positionOffset,
239
- scale,
240
- ...draggableCoreProps
241
- } = this.props;
242
- let style = {};
243
- let svgTransform = null;
244
-
245
- // If this is controlled, we don't want to move it - unless it's dragging.
246
- const controlled = Boolean(position);
247
- const draggable = !controlled || this.state.dragging;
248
- const validPosition = position || defaultPosition;
249
- const transformOpts = {
250
- // Set left if horizontal drag is enabled
251
- x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x,
252
- // Set top if vertical drag is enabled
253
- y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y
254
- };
255
-
256
- // If this element was SVG, we use the `transform` attribute.
257
- if (this.state.isElementSVG) {
258
- svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset);
259
- } else {
260
- // Add a CSS transform to move the element around. This allows us to move the element around
261
- // without worrying about whether or not it is relatively or absolutely positioned.
262
- // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
263
- // has a clean slate.
264
- style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset);
265
- }
266
-
267
- // Mark with class while dragging
268
- const className = (0, _clsx.clsx)(children.props.className || '', defaultClassName, {
269
- [defaultClassNameDragging]: this.state.dragging,
270
- [defaultClassNameDragged]: this.state.dragged
271
- });
272
-
273
- // Reuse the child provided
274
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
275
- return /*#__PURE__*/React.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
276
- onStart: this.onDragStart,
277
- onDrag: this.onDrag,
278
- onStop: this.onDragStop
279
- }), /*#__PURE__*/React.cloneElement(React.Children.only(children), {
280
- className: className,
281
- style: {
282
- ...children.props.style,
283
- ...style
284
- },
285
- transform: svgTransform
286
- }));
287
- }
288
- }
289
- exports.default = Draggable;
290
- _defineProperty(Draggable, "displayName", 'Draggable');
291
- _defineProperty(Draggable, "propTypes", {
292
- // Accepts all props <DraggableCore> accepts.
293
- ..._DraggableCore.default.propTypes,
294
- /**
295
- * `axis` determines which axis the draggable can move.
296
- *
297
- * Note that all callbacks will still return data as normal. This only
298
- * controls flushing to the DOM.
299
- *
300
- * 'both' allows movement horizontally and vertically.
301
- * 'x' limits movement to horizontal axis.
302
- * 'y' limits movement to vertical axis.
303
- * 'none' limits all movement.
304
- *
305
- * Defaults to 'both'.
306
- */
307
- axis: _propTypes.default.oneOf(['both', 'x', 'y', 'none']),
308
- /**
309
- * `bounds` determines the range of movement available to the element.
310
- * Available values are:
311
- *
312
- * 'parent' restricts movement within the Draggable's parent node.
313
- *
314
- * Alternatively, pass an object with the following properties, all of which are optional:
315
- *
316
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
317
- *
318
- * All values are in px.
319
- *
320
- * Example:
321
- *
322
- * ```jsx
323
- * let App = React.createClass({
324
- * render: function () {
325
- * return (
326
- * <Draggable bounds={{right: 300, bottom: 300}}>
327
- * <div>Content</div>
328
- * </Draggable>
329
- * );
330
- * }
331
- * });
332
- * ```
333
- */
334
- bounds: _propTypes.default.oneOfType([_propTypes.default.shape({
335
- left: _propTypes.default.number,
336
- right: _propTypes.default.number,
337
- top: _propTypes.default.number,
338
- bottom: _propTypes.default.number
339
- }), _propTypes.default.string, _propTypes.default.oneOf([false])]),
340
- defaultClassName: _propTypes.default.string,
341
- defaultClassNameDragging: _propTypes.default.string,
342
- defaultClassNameDragged: _propTypes.default.string,
343
- /**
344
- * `defaultPosition` specifies the x and y that the dragged item should start at
345
- *
346
- * Example:
347
- *
348
- * ```jsx
349
- * let App = React.createClass({
350
- * render: function () {
351
- * return (
352
- * <Draggable defaultPosition={{x: 25, y: 25}}>
353
- * <div>I start with transformX: 25px and transformY: 25px;</div>
354
- * </Draggable>
355
- * );
356
- * }
357
- * });
358
- * ```
359
- */
360
- defaultPosition: _propTypes.default.shape({
361
- x: _propTypes.default.number,
362
- y: _propTypes.default.number
363
- }),
364
- positionOffset: _propTypes.default.shape({
365
- x: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
366
- y: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
367
- }),
368
- /**
369
- * `position`, if present, defines the current position of the element.
370
- *
371
- * This is similar to how form elements in React work - if no `position` is supplied, the component
372
- * is uncontrolled.
373
- *
374
- * Example:
375
- *
376
- * ```jsx
377
- * let App = React.createClass({
378
- * render: function () {
379
- * return (
380
- * <Draggable position={{x: 25, y: 25}}>
381
- * <div>I start with transformX: 25px and transformY: 25px;</div>
382
- * </Draggable>
383
- * );
384
- * }
385
- * });
386
- * ```
387
- */
388
- position: _propTypes.default.shape({
389
- x: _propTypes.default.number,
390
- y: _propTypes.default.number
391
- }),
392
- /**
393
- * These properties should be defined on the child, not here.
394
- */
395
- className: _shims.dontSetMe,
396
- style: _shims.dontSetMe,
397
- transform: _shims.dontSetMe
398
- });
399
- _defineProperty(Draggable, "defaultProps", {
400
- ..._DraggableCore.default.defaultProps,
401
- axis: 'both',
402
- bounds: false,
403
- defaultClassName: 'react-draggable',
404
- defaultClassNameDragging: 'react-draggable-dragging',
405
- defaultClassNameDragged: 'react-draggable-dragged',
406
- defaultPosition: {
407
- x: 0,
408
- y: 0
409
- },
410
- scale: 1
411
- });
412
- } (Draggable));