zmdms-webui 2.5.2 → 2.5.4
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/es/_virtual/_commonjsHelpers.js +1 -29
- package/dist/es/_virtual/index2.js +2 -2
- package/dist/es/canvastable/canvasTable.js +26 -13
- package/dist/es/canvastable/hooks/useAutoHeight.js +41 -5
- package/dist/es/canvastable/interface.d.ts +10 -2
- package/dist/es/canvastable/utils/formatHelpers.js +1 -1
- package/dist/es/modal/useDraggable.js +1 -1
- package/dist/es/node_modules/immutability-helper/index.js +1 -1
- package/dist/es/node_modules/rc-util/es/Dom/findDOMNode.js +2 -2
- package/dist/es/node_modules/react-is/cjs/react-is.development.js +1 -1
- package/dist/es/node_modules/react-is/cjs/react-is.production.min.js +1 -1
- package/dist/es/node_modules/react-is/index.js +1 -1
- package/package.json +2 -2
- package/dist/es/_virtual/Draggable.js +0 -3
- package/dist/es/_virtual/DraggableCore.js +0 -3
- package/dist/es/_virtual/cjs.js +0 -3
- package/dist/es/_virtual/clsx.m.js +0 -6
- package/dist/es/_virtual/domFns.js +0 -3
- package/dist/es/_virtual/getPrefix.js +0 -3
- package/dist/es/_virtual/index4.js +0 -3
- package/dist/es/_virtual/index5.js +0 -3
- package/dist/es/_virtual/log.js +0 -3
- package/dist/es/_virtual/positionFns.js +0 -3
- package/dist/es/_virtual/react-is.development2.js +0 -3
- package/dist/es/_virtual/react-is.production.min2.js +0 -3
- package/dist/es/_virtual/shims.js +0 -3
- package/dist/es/node_modules/object-assign/index.js +0 -99
- package/dist/es/node_modules/prop-types/checkPropTypes.js +0 -115
- package/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -74
- package/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -625
- package/dist/es/node_modules/prop-types/index.js +0 -28
- package/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -21
- package/dist/es/node_modules/prop-types/lib/has.js +0 -11
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -190
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -26
- package/dist/es/node_modules/prop-types/node_modules/react-is/index.js +0 -19
- package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +0 -474
- package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +0 -580
- package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +0 -20
- package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +0 -361
- package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +0 -85
- package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +0 -10
- package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +0 -214
- package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +0 -64
|
@@ -1,580 +0,0 @@
|
|
|
1
|
-
import { __exports as DraggableCore$1 } from '../../../../_virtual/DraggableCore.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 './utils/domFns.js';
|
|
6
|
-
import './utils/positionFns.js';
|
|
7
|
-
import './utils/shims.js';
|
|
8
|
-
import './utils/log.js';
|
|
9
|
-
import { __exports as shims } from '../../../../_virtual/shims.js';
|
|
10
|
-
import { __exports as log } from '../../../../_virtual/log.js';
|
|
11
|
-
import { __exports as domFns } from '../../../../_virtual/domFns.js';
|
|
12
|
-
import { __exports as positionFns } from '../../../../_virtual/positionFns.js';
|
|
13
|
-
|
|
14
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(DraggableCore$1, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
DraggableCore$1.default = void 0;
|
|
20
|
-
|
|
21
|
-
var React = _interopRequireWildcard(React__default);
|
|
22
|
-
|
|
23
|
-
var _propTypes = _interopRequireDefault(propTypesExports);
|
|
24
|
-
|
|
25
|
-
var _reactDom = _interopRequireDefault(require$$2);
|
|
26
|
-
|
|
27
|
-
var _domFns = domFns;
|
|
28
|
-
|
|
29
|
-
var _positionFns = positionFns;
|
|
30
|
-
|
|
31
|
-
var _shims = shims;
|
|
32
|
-
|
|
33
|
-
var _log = _interopRequireDefault(log);
|
|
34
|
-
|
|
35
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
-
|
|
37
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
|
-
|
|
39
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
40
|
-
|
|
41
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
42
|
-
|
|
43
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
44
|
-
|
|
45
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
46
|
-
|
|
47
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
48
|
-
|
|
49
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
50
|
-
|
|
51
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
52
|
-
|
|
53
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
54
|
-
|
|
55
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
56
|
-
|
|
57
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
58
|
-
|
|
59
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
60
|
-
|
|
61
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
62
|
-
|
|
63
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
64
|
-
|
|
65
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
66
|
-
|
|
67
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
68
|
-
|
|
69
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
70
|
-
|
|
71
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
72
|
-
|
|
73
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
74
|
-
|
|
75
|
-
// Simple abstraction for dragging events names.
|
|
76
|
-
var eventsFor = {
|
|
77
|
-
touch: {
|
|
78
|
-
start: 'touchstart',
|
|
79
|
-
move: 'touchmove',
|
|
80
|
-
stop: 'touchend'
|
|
81
|
-
},
|
|
82
|
-
mouse: {
|
|
83
|
-
start: 'mousedown',
|
|
84
|
-
move: 'mousemove',
|
|
85
|
-
stop: 'mouseup'
|
|
86
|
-
}
|
|
87
|
-
}; // Default to mouse events.
|
|
88
|
-
|
|
89
|
-
var dragEventFor = eventsFor.mouse;
|
|
90
|
-
/*:: type DraggableCoreState = {
|
|
91
|
-
dragging: boolean,
|
|
92
|
-
lastX: number,
|
|
93
|
-
lastY: number,
|
|
94
|
-
touchIdentifier: ?number
|
|
95
|
-
};*/
|
|
96
|
-
|
|
97
|
-
/*:: export type DraggableData = {
|
|
98
|
-
node: HTMLElement,
|
|
99
|
-
x: number, y: number,
|
|
100
|
-
deltaX: number, deltaY: number,
|
|
101
|
-
lastX: number, lastY: number,
|
|
102
|
-
};*/
|
|
103
|
-
|
|
104
|
-
/*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/
|
|
105
|
-
|
|
106
|
-
/*:: export type ControlPosition = {x: number, y: number};*/
|
|
107
|
-
|
|
108
|
-
/*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
|
|
109
|
-
|
|
110
|
-
/*:: export type DraggableCoreDefaultProps = {
|
|
111
|
-
allowAnyClick: boolean,
|
|
112
|
-
disabled: boolean,
|
|
113
|
-
enableUserSelectHack: boolean,
|
|
114
|
-
onStart: DraggableEventHandler,
|
|
115
|
-
onDrag: DraggableEventHandler,
|
|
116
|
-
onStop: DraggableEventHandler,
|
|
117
|
-
onMouseDown: (e: MouseEvent) => void,
|
|
118
|
-
scale: number,
|
|
119
|
-
};*/
|
|
120
|
-
|
|
121
|
-
/*:: export type DraggableCoreProps = {
|
|
122
|
-
...DraggableCoreDefaultProps,
|
|
123
|
-
cancel: string,
|
|
124
|
-
children: ReactElement<any>,
|
|
125
|
-
offsetParent: HTMLElement,
|
|
126
|
-
grid: [number, number],
|
|
127
|
-
handle: string,
|
|
128
|
-
nodeRef?: ?React.ElementRef<any>,
|
|
129
|
-
};*/
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
// Define <DraggableCore>.
|
|
133
|
-
//
|
|
134
|
-
// <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
|
|
135
|
-
// work well with libraries that require more control over the element.
|
|
136
|
-
//
|
|
137
|
-
var DraggableCore = /*#__PURE__*/function (_React$Component) {
|
|
138
|
-
_inherits(DraggableCore, _React$Component);
|
|
139
|
-
|
|
140
|
-
var _super = _createSuper(DraggableCore);
|
|
141
|
-
|
|
142
|
-
function DraggableCore() {
|
|
143
|
-
var _this;
|
|
144
|
-
|
|
145
|
-
_classCallCheck(this, DraggableCore);
|
|
146
|
-
|
|
147
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
148
|
-
args[_key] = arguments[_key];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
152
|
-
|
|
153
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
154
|
-
dragging: false,
|
|
155
|
-
// Used while dragging to determine deltas.
|
|
156
|
-
lastX: NaN,
|
|
157
|
-
lastY: NaN,
|
|
158
|
-
touchIdentifier: null
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
_defineProperty(_assertThisInitialized(_this), "mounted", false);
|
|
162
|
-
|
|
163
|
-
_defineProperty(_assertThisInitialized(_this), "handleDragStart", function (e) {
|
|
164
|
-
// Make it possible to attach event handlers on top of this one.
|
|
165
|
-
_this.props.onMouseDown(e); // Only accept left-clicks.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false; // Get nodes. Be sure to grab relative document (could be iframed)
|
|
169
|
-
|
|
170
|
-
var thisNode = _this.findDOMNode();
|
|
171
|
-
|
|
172
|
-
if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
|
|
173
|
-
throw new Error('<DraggableCore> not mounted on DragStart!');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
var ownerDocument = thisNode.ownerDocument; // Short circuit if handle or cancel prop was provided and selector doesn't match.
|
|
177
|
-
|
|
178
|
-
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)) {
|
|
179
|
-
return;
|
|
180
|
-
} // Prevent scrolling on mobile devices, like ipad/iphone.
|
|
181
|
-
// Important that this is after handle/cancel.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (e.type === 'touchstart') e.preventDefault(); // Set touch identifier in component state if this is a touch event. This allows us to
|
|
185
|
-
// distinguish between individual touches on multitouch screens by identifying which
|
|
186
|
-
// touchpoint was set to this element.
|
|
187
|
-
|
|
188
|
-
var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
|
|
189
|
-
|
|
190
|
-
_this.setState({
|
|
191
|
-
touchIdentifier: touchIdentifier
|
|
192
|
-
}); // Get the current drag point from the event. This is used as the offset.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _assertThisInitialized(_this));
|
|
196
|
-
if (position == null) return; // not possible but satisfies flow
|
|
197
|
-
|
|
198
|
-
var x = position.x,
|
|
199
|
-
y = position.y; // Create an event object with all the data parents need to make a decision here.
|
|
200
|
-
|
|
201
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
|
|
202
|
-
(0, _log.default)('DraggableCore: handleDragStart: %j', coreEvent); // Call event handler. If it returns explicit false, cancel.
|
|
203
|
-
|
|
204
|
-
(0, _log.default)('calling', _this.props.onStart);
|
|
205
|
-
|
|
206
|
-
var shouldUpdate = _this.props.onStart(e, coreEvent);
|
|
207
|
-
|
|
208
|
-
if (shouldUpdate === false || _this.mounted === false) return; // Add a style to the body to disable user-select. This prevents text from
|
|
209
|
-
// being selected all over the page.
|
|
210
|
-
|
|
211
|
-
if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument); // Initiate dragging. Set the current x and y as offsets
|
|
212
|
-
// so we know how much we've moved during the drag. This allows us
|
|
213
|
-
// to drag elements around even if they have been moved, without issue.
|
|
214
|
-
|
|
215
|
-
_this.setState({
|
|
216
|
-
dragging: true,
|
|
217
|
-
lastX: x,
|
|
218
|
-
lastY: y
|
|
219
|
-
}); // Add events to the document directly so we catch when the user's mouse/touch moves outside of
|
|
220
|
-
// this element. We use different events depending on whether or not we have detected that this
|
|
221
|
-
// is a touch-capable device.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
|
|
225
|
-
(0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
_defineProperty(_assertThisInitialized(_this), "handleDrag", function (e) {
|
|
229
|
-
// Get the current drag point from the event. This is used as the offset.
|
|
230
|
-
var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
|
|
231
|
-
if (position == null) return;
|
|
232
|
-
var x = position.x,
|
|
233
|
-
y = position.y; // Snap to grid if prop has been provided
|
|
234
|
-
|
|
235
|
-
if (Array.isArray(_this.props.grid)) {
|
|
236
|
-
var deltaX = x - _this.state.lastX,
|
|
237
|
-
deltaY = y - _this.state.lastY;
|
|
238
|
-
|
|
239
|
-
var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
|
|
240
|
-
|
|
241
|
-
var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
|
|
242
|
-
|
|
243
|
-
deltaX = _snapToGrid2[0];
|
|
244
|
-
deltaY = _snapToGrid2[1];
|
|
245
|
-
if (!deltaX && !deltaY) return; // skip useless drag
|
|
246
|
-
|
|
247
|
-
x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
|
|
251
|
-
(0, _log.default)('DraggableCore: handleDrag: %j', coreEvent); // Call event handler. If it returns explicit false, trigger end.
|
|
252
|
-
|
|
253
|
-
var shouldUpdate = _this.props.onDrag(e, coreEvent);
|
|
254
|
-
|
|
255
|
-
if (shouldUpdate === false || _this.mounted === false) {
|
|
256
|
-
try {
|
|
257
|
-
// $FlowIgnore
|
|
258
|
-
_this.handleDragStop(new MouseEvent('mouseup'));
|
|
259
|
-
} catch (err) {
|
|
260
|
-
// Old browsers
|
|
261
|
-
var event = ((document.createEvent('MouseEvents')
|
|
262
|
-
/*: any*/
|
|
263
|
-
)
|
|
264
|
-
/*: MouseTouchEvent*/
|
|
265
|
-
); // I see why this insanity was deprecated
|
|
266
|
-
// $FlowIgnore
|
|
267
|
-
|
|
268
|
-
event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
269
|
-
|
|
270
|
-
_this.handleDragStop(event);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
_this.setState({
|
|
277
|
-
lastX: x,
|
|
278
|
-
lastY: y
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
_defineProperty(_assertThisInitialized(_this), "handleDragStop", function (e) {
|
|
283
|
-
if (!_this.state.dragging) return;
|
|
284
|
-
var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
|
|
285
|
-
if (position == null) return;
|
|
286
|
-
var x = position.x,
|
|
287
|
-
y = position.y; // Snap to grid if prop has been provided
|
|
288
|
-
|
|
289
|
-
if (Array.isArray(_this.props.grid)) {
|
|
290
|
-
var deltaX = x - _this.state.lastX || 0;
|
|
291
|
-
var deltaY = y - _this.state.lastY || 0;
|
|
292
|
-
|
|
293
|
-
var _snapToGrid3 = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
|
|
294
|
-
|
|
295
|
-
var _snapToGrid4 = _slicedToArray(_snapToGrid3, 2);
|
|
296
|
-
|
|
297
|
-
deltaX = _snapToGrid4[0];
|
|
298
|
-
deltaY = _snapToGrid4[1];
|
|
299
|
-
x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y); // Call event handler
|
|
303
|
-
|
|
304
|
-
var shouldContinue = _this.props.onStop(e, coreEvent);
|
|
305
|
-
|
|
306
|
-
if (shouldContinue === false || _this.mounted === false) return false;
|
|
307
|
-
|
|
308
|
-
var thisNode = _this.findDOMNode();
|
|
309
|
-
|
|
310
|
-
if (thisNode) {
|
|
311
|
-
// Remove user-select hack
|
|
312
|
-
if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
(0, _log.default)('DraggableCore: handleDragStop: %j', coreEvent); // Reset the el.
|
|
316
|
-
|
|
317
|
-
_this.setState({
|
|
318
|
-
dragging: false,
|
|
319
|
-
lastX: NaN,
|
|
320
|
-
lastY: NaN
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
if (thisNode) {
|
|
324
|
-
// Remove event handlers
|
|
325
|
-
(0, _log.default)('DraggableCore: Removing handlers');
|
|
326
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
|
|
327
|
-
(0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (e) {
|
|
332
|
-
dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
|
|
333
|
-
|
|
334
|
-
return _this.handleDragStart(e);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseUp", function (e) {
|
|
338
|
-
dragEventFor = eventsFor.mouse;
|
|
339
|
-
return _this.handleDragStop(e);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
_defineProperty(_assertThisInitialized(_this), "onTouchStart", function (e) {
|
|
343
|
-
// We're on a touch device now, so change the event handlers
|
|
344
|
-
dragEventFor = eventsFor.touch;
|
|
345
|
-
return _this.handleDragStart(e);
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
_defineProperty(_assertThisInitialized(_this), "onTouchEnd", function (e) {
|
|
349
|
-
// We're on a touch device now, so change the event handlers
|
|
350
|
-
dragEventFor = eventsFor.touch;
|
|
351
|
-
return _this.handleDragStop(e);
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
return _this;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
_createClass(DraggableCore, [{
|
|
358
|
-
key: "componentDidMount",
|
|
359
|
-
value: function componentDidMount() {
|
|
360
|
-
this.mounted = true; // Touch handlers must be added with {passive: false} to be cancelable.
|
|
361
|
-
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
|
|
362
|
-
|
|
363
|
-
var thisNode = this.findDOMNode();
|
|
364
|
-
|
|
365
|
-
if (thisNode) {
|
|
366
|
-
(0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
367
|
-
passive: false
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, {
|
|
372
|
-
key: "componentWillUnmount",
|
|
373
|
-
value: function componentWillUnmount() {
|
|
374
|
-
this.mounted = false; // Remove any leftover event handlers. Remove both touch and mouse handlers in case
|
|
375
|
-
// some browser quirk caused a touch event to fire during a mouse move, or vice versa.
|
|
376
|
-
|
|
377
|
-
var thisNode = this.findDOMNode();
|
|
378
|
-
|
|
379
|
-
if (thisNode) {
|
|
380
|
-
var ownerDocument = thisNode.ownerDocument;
|
|
381
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
|
|
382
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
|
|
383
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
|
|
384
|
-
(0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
|
|
385
|
-
(0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
|
|
386
|
-
passive: false
|
|
387
|
-
});
|
|
388
|
-
if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
|
|
389
|
-
}
|
|
390
|
-
} // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
|
|
391
|
-
// the underlying DOM node ourselves. See the README for more information.
|
|
392
|
-
|
|
393
|
-
}, {
|
|
394
|
-
key: "findDOMNode",
|
|
395
|
-
value: function findDOMNode()
|
|
396
|
-
/*: ?HTMLElement*/
|
|
397
|
-
{
|
|
398
|
-
var _this$props, _this$props2, _this$props2$nodeRef;
|
|
399
|
-
|
|
400
|
-
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);
|
|
401
|
-
}
|
|
402
|
-
}, {
|
|
403
|
-
key: "render",
|
|
404
|
-
value: function render()
|
|
405
|
-
/*: React.Element<any>*/
|
|
406
|
-
{
|
|
407
|
-
// Reuse the child provided
|
|
408
|
-
// This makes it flexible to use whatever element is wanted (div, ul, etc)
|
|
409
|
-
return /*#__PURE__*/React.cloneElement(React.Children.only(this.props.children), {
|
|
410
|
-
// Note: mouseMove handler is attached to document so it will still function
|
|
411
|
-
// when the user drags quickly and leaves the bounds of the element.
|
|
412
|
-
onMouseDown: this.onMouseDown,
|
|
413
|
-
onMouseUp: this.onMouseUp,
|
|
414
|
-
// onTouchStart is added on `componentDidMount` so they can be added with
|
|
415
|
-
// {passive: false}, which allows it to cancel. See
|
|
416
|
-
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
|
|
417
|
-
onTouchEnd: this.onTouchEnd
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}]);
|
|
421
|
-
|
|
422
|
-
return DraggableCore;
|
|
423
|
-
}(React.Component);
|
|
424
|
-
|
|
425
|
-
DraggableCore$1.default = DraggableCore;
|
|
426
|
-
|
|
427
|
-
_defineProperty(DraggableCore, "displayName", 'DraggableCore');
|
|
428
|
-
|
|
429
|
-
_defineProperty(DraggableCore, "propTypes", {
|
|
430
|
-
/**
|
|
431
|
-
* `allowAnyClick` allows dragging using any mouse button.
|
|
432
|
-
* By default, we only accept the left button.
|
|
433
|
-
*
|
|
434
|
-
* Defaults to `false`.
|
|
435
|
-
*/
|
|
436
|
-
allowAnyClick: _propTypes.default.bool,
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* `disabled`, if true, stops the <Draggable> from dragging. All handlers,
|
|
440
|
-
* with the exception of `onMouseDown`, will not fire.
|
|
441
|
-
*/
|
|
442
|
-
disabled: _propTypes.default.bool,
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* By default, we add 'user-select:none' attributes to the document body
|
|
446
|
-
* to prevent ugly text selection during drag. If this is causing problems
|
|
447
|
-
* for your app, set this to `false`.
|
|
448
|
-
*/
|
|
449
|
-
enableUserSelectHack: _propTypes.default.bool,
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* `offsetParent`, if set, uses the passed DOM node to compute drag offsets
|
|
453
|
-
* instead of using the parent node.
|
|
454
|
-
*/
|
|
455
|
-
offsetParent: function offsetParent(props
|
|
456
|
-
/*: DraggableCoreProps*/
|
|
457
|
-
, propName
|
|
458
|
-
/*: $Keys<DraggableCoreProps>*/
|
|
459
|
-
) {
|
|
460
|
-
if (props[propName] && props[propName].nodeType !== 1) {
|
|
461
|
-
throw new Error('Draggable\'s offsetParent must be a DOM Node.');
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* `grid` specifies the x and y that dragging should snap to.
|
|
467
|
-
*/
|
|
468
|
-
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* `handle` specifies a selector to be used as the handle that initiates drag.
|
|
472
|
-
*
|
|
473
|
-
* Example:
|
|
474
|
-
*
|
|
475
|
-
* ```jsx
|
|
476
|
-
* let App = React.createClass({
|
|
477
|
-
* render: function () {
|
|
478
|
-
* return (
|
|
479
|
-
* <Draggable handle=".handle">
|
|
480
|
-
* <div>
|
|
481
|
-
* <div className="handle">Click me to drag</div>
|
|
482
|
-
* <div>This is some other content</div>
|
|
483
|
-
* </div>
|
|
484
|
-
* </Draggable>
|
|
485
|
-
* );
|
|
486
|
-
* }
|
|
487
|
-
* });
|
|
488
|
-
* ```
|
|
489
|
-
*/
|
|
490
|
-
handle: _propTypes.default.string,
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* `cancel` specifies a selector to be used to prevent drag initialization.
|
|
494
|
-
*
|
|
495
|
-
* Example:
|
|
496
|
-
*
|
|
497
|
-
* ```jsx
|
|
498
|
-
* let App = React.createClass({
|
|
499
|
-
* render: function () {
|
|
500
|
-
* return(
|
|
501
|
-
* <Draggable cancel=".cancel">
|
|
502
|
-
* <div>
|
|
503
|
-
* <div className="cancel">You can't drag from here</div>
|
|
504
|
-
* <div>Dragging here works fine</div>
|
|
505
|
-
* </div>
|
|
506
|
-
* </Draggable>
|
|
507
|
-
* );
|
|
508
|
-
* }
|
|
509
|
-
* });
|
|
510
|
-
* ```
|
|
511
|
-
*/
|
|
512
|
-
cancel: _propTypes.default.string,
|
|
513
|
-
|
|
514
|
-
/* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
|
|
515
|
-
* Unfortunately, in order for <Draggable> to work properly, we need raw access
|
|
516
|
-
* to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
|
|
517
|
-
* as in this example:
|
|
518
|
-
*
|
|
519
|
-
* function MyComponent() {
|
|
520
|
-
* const nodeRef = React.useRef(null);
|
|
521
|
-
* return (
|
|
522
|
-
* <Draggable nodeRef={nodeRef}>
|
|
523
|
-
* <div ref={nodeRef}>Example Target</div>
|
|
524
|
-
* </Draggable>
|
|
525
|
-
* );
|
|
526
|
-
* }
|
|
527
|
-
*
|
|
528
|
-
* This can be used for arbitrarily nested components, so long as the ref ends up
|
|
529
|
-
* pointing to the actual child DOM node and not a custom component.
|
|
530
|
-
*/
|
|
531
|
-
nodeRef: _propTypes.default.object,
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Called when dragging starts.
|
|
535
|
-
* If this function returns the boolean false, dragging will be canceled.
|
|
536
|
-
*/
|
|
537
|
-
onStart: _propTypes.default.func,
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Called while dragging.
|
|
541
|
-
* If this function returns the boolean false, dragging will be canceled.
|
|
542
|
-
*/
|
|
543
|
-
onDrag: _propTypes.default.func,
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Called when dragging stops.
|
|
547
|
-
* If this function returns the boolean false, the drag will remain active.
|
|
548
|
-
*/
|
|
549
|
-
onStop: _propTypes.default.func,
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* A workaround option which can be passed if onMouseDown needs to be accessed,
|
|
553
|
-
* since it'll always be blocked (as there is internal use of onMouseDown)
|
|
554
|
-
*/
|
|
555
|
-
onMouseDown: _propTypes.default.func,
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* `scale`, if set, applies scaling while dragging an element
|
|
559
|
-
*/
|
|
560
|
-
scale: _propTypes.default.number,
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* These properties should be defined on the child, not here.
|
|
564
|
-
*/
|
|
565
|
-
className: _shims.dontSetMe,
|
|
566
|
-
style: _shims.dontSetMe,
|
|
567
|
-
transform: _shims.dontSetMe
|
|
568
|
-
});
|
|
569
|
-
|
|
570
|
-
_defineProperty(DraggableCore, "defaultProps", {
|
|
571
|
-
allowAnyClick: false,
|
|
572
|
-
// by default only accept left click
|
|
573
|
-
disabled: false,
|
|
574
|
-
enableUserSelectHack: true,
|
|
575
|
-
onStart: function onStart() {},
|
|
576
|
-
onDrag: function onDrag() {},
|
|
577
|
-
onStop: function onStop() {},
|
|
578
|
-
onMouseDown: function onMouseDown() {},
|
|
579
|
-
scale: 1
|
|
580
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs } from '../../../../_virtual/_commonjsHelpers.js';
|
|
2
|
-
import { __module as cjs } from '../../../../_virtual/cjs.js';
|
|
3
|
-
import './Draggable.js';
|
|
4
|
-
import { __exports as Draggable$2 } from '../../../../_virtual/Draggable.js';
|
|
5
|
-
|
|
6
|
-
var _require = Draggable$2,
|
|
7
|
-
Draggable = _require.default,
|
|
8
|
-
DraggableCore = _require.DraggableCore; // Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
|
|
9
|
-
// See https://github.com/mzabriskie/react-draggable/pull/254
|
|
10
|
-
// and https://github.com/mzabriskie/react-draggable/issues/266
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
cjs.exports = Draggable;
|
|
14
|
-
cjs.exports.default = Draggable;
|
|
15
|
-
cjs.exports.DraggableCore = DraggableCore;
|
|
16
|
-
|
|
17
|
-
var cjsExports = cjs.exports;
|
|
18
|
-
var Draggable$1 = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
|
19
|
-
|
|
20
|
-
export { Draggable$1 as default };
|