@lingk/sync 0.0.83 → 0.0.84

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.
@@ -46,7 +46,7 @@ module.exports =
46
46
  /***/ 0:
47
47
  /***/ function(module, exports, __webpack_require__) {
48
48
 
49
- module.exports = __webpack_require__(158);
49
+ module.exports = __webpack_require__(157);
50
50
 
51
51
 
52
52
  /***/ },
@@ -65,1626 +65,6 @@ module.exports =
65
65
 
66
66
  /***/ },
67
67
 
68
- /***/ 8:
69
- /***/ function(module, exports) {
70
-
71
- module.exports = require("react-dom");
72
-
73
- /***/ },
74
-
75
- /***/ 18:
76
- /***/ function(module, exports, __webpack_require__) {
77
-
78
- (function webpackUniversalModuleDefinition(root, factory) {
79
- if(true)
80
- module.exports = factory(__webpack_require__(2), __webpack_require__(8));
81
- else if(typeof define === 'function' && define.amd)
82
- define(["react", "react-dom"], factory);
83
- else if(typeof exports === 'object')
84
- exports["ReactDraggable"] = factory(require("react"), require("react-dom"));
85
- else
86
- root["ReactDraggable"] = factory(root["React"], root["ReactDOM"]);
87
- })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {
88
- return /******/ (function(modules) { // webpackBootstrap
89
- /******/ // The module cache
90
- /******/ var installedModules = {};
91
- /******/
92
- /******/ // The require function
93
- /******/ function __webpack_require__(moduleId) {
94
- /******/
95
- /******/ // Check if module is in cache
96
- /******/ if(installedModules[moduleId])
97
- /******/ return installedModules[moduleId].exports;
98
- /******/
99
- /******/ // Create a new module (and put it into the cache)
100
- /******/ var module = installedModules[moduleId] = {
101
- /******/ exports: {},
102
- /******/ id: moduleId,
103
- /******/ loaded: false
104
- /******/ };
105
- /******/
106
- /******/ // Execute the module function
107
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
108
- /******/
109
- /******/ // Flag the module as loaded
110
- /******/ module.loaded = true;
111
- /******/
112
- /******/ // Return the exports of the module
113
- /******/ return module.exports;
114
- /******/ }
115
- /******/
116
- /******/
117
- /******/ // expose the modules object (__webpack_modules__)
118
- /******/ __webpack_require__.m = modules;
119
- /******/
120
- /******/ // expose the module cache
121
- /******/ __webpack_require__.c = installedModules;
122
- /******/
123
- /******/ // __webpack_public_path__
124
- /******/ __webpack_require__.p = "";
125
- /******/
126
- /******/ // Load entry module and return exports
127
- /******/ return __webpack_require__(0);
128
- /******/ })
129
- /************************************************************************/
130
- /******/ ([
131
- /* 0 */
132
- /***/ function(module, exports, __webpack_require__) {
133
-
134
- 'use strict';
135
-
136
- module.exports = __webpack_require__(1).default;
137
- module.exports.DraggableCore = __webpack_require__(9).default;
138
-
139
- /***/ },
140
- /* 1 */
141
- /***/ function(module, exports, __webpack_require__) {
142
-
143
- 'use strict';
144
-
145
- Object.defineProperty(exports, "__esModule", {
146
- value: true
147
- });
148
-
149
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
150
-
151
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
152
-
153
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
154
-
155
- var _react = __webpack_require__(2);
156
-
157
- var _react2 = _interopRequireDefault(_react);
158
-
159
- var _reactDom = __webpack_require__(3);
160
-
161
- var _reactDom2 = _interopRequireDefault(_reactDom);
162
-
163
- var _classnames = __webpack_require__(4);
164
-
165
- var _classnames2 = _interopRequireDefault(_classnames);
166
-
167
- var _domFns = __webpack_require__(5);
168
-
169
- var _positionFns = __webpack_require__(8);
170
-
171
- var _shims = __webpack_require__(6);
172
-
173
- var _DraggableCore = __webpack_require__(9);
174
-
175
- var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
176
-
177
- var _log = __webpack_require__(11);
178
-
179
- var _log2 = _interopRequireDefault(_log);
180
-
181
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
182
-
183
- 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; }
184
-
185
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
186
-
187
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
188
-
189
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
190
- // $FlowIgnore
191
-
192
-
193
- /*:: import type {DraggableEventHandler} from './utils/types';*/
194
- /*:: type DraggableState = {
195
- dragging: boolean,
196
- dragged: boolean,
197
- x: number, y: number,
198
- slackX: number, slackY: number,
199
- isElementSVG: boolean
200
- };*/
201
-
202
-
203
- //
204
- // Define <Draggable>
205
- //
206
-
207
- /*:: type ConstructorProps = {
208
- position: { x: number, y: number },
209
- defaultPosition: { x: number, y: number }
210
- };*/
211
-
212
- var Draggable = function (_React$Component) {
213
- _inherits(Draggable, _React$Component);
214
-
215
- function Draggable(props /*: ConstructorProps*/) {
216
- _classCallCheck(this, Draggable);
217
-
218
- var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
219
-
220
- _this.onDragStart = function (e, coreData) {
221
- (0, _log2.default)('Draggable: onDragStart: %j', coreData);
222
-
223
- // Short-circuit if user's callback killed it.
224
- var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData));
225
- // Kills start event on core as well, so move handlers are never bound.
226
- if (shouldStart === false) return false;
227
-
228
- _this.setState({ dragging: true, dragged: true });
229
- };
230
-
231
- _this.onDrag = function (e, coreData) {
232
- if (!_this.state.dragging) return false;
233
- (0, _log2.default)('Draggable: onDrag: %j', coreData);
234
-
235
- var uiData = (0, _positionFns.createDraggableData)(_this, coreData);
236
-
237
- var newState /*: $Shape<DraggableState>*/ = {
238
- x: uiData.x,
239
- y: uiData.y
240
- };
241
-
242
- // Keep within bounds.
243
- if (_this.props.bounds) {
244
- // Save original x and y.
245
- var _x = newState.x,
246
- _y = newState.y;
247
-
248
- // Add slack to the values used to calculate bound position. This will ensure that if
249
- // we start removing slack, the element won't react to it right away until it's been
250
- // completely removed.
251
-
252
- newState.x += _this.state.slackX;
253
- newState.y += _this.state.slackY;
254
-
255
- // Get bound position. This will ceil/floor the x and y within the boundaries.
256
- // $FlowBug
257
-
258
- // Recalculate slack by noting how much was shaved by the boundPosition handler.
259
- var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y);
260
-
261
- var _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2);
262
-
263
- newState.x = _getBoundPosition2[0];
264
- newState.y = _getBoundPosition2[1];
265
- newState.slackX = _this.state.slackX + (_x - newState.x);
266
- newState.slackY = _this.state.slackY + (_y - newState.y);
267
-
268
- // Update the event we fire to reflect what really happened after bounds took effect.
269
- uiData.x = _x;
270
- uiData.y = _y;
271
- uiData.deltaX = newState.x - _this.state.x;
272
- uiData.deltaY = newState.y - _this.state.y;
273
- }
274
-
275
- // Short-circuit if user's callback killed it.
276
- var shouldUpdate = _this.props.onDrag(e, uiData);
277
- if (shouldUpdate === false) return false;
278
-
279
- _this.setState(newState);
280
- };
281
-
282
- _this.onDragStop = function (e, coreData) {
283
- if (!_this.state.dragging) return false;
284
-
285
- // Short-circuit if user's callback killed it.
286
- var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData));
287
- if (shouldStop === false) return false;
288
-
289
- (0, _log2.default)('Draggable: onDragStop: %j', coreData);
290
-
291
- var newState /*: $Shape<DraggableState>*/ = {
292
- dragging: false,
293
- slackX: 0,
294
- slackY: 0
295
- };
296
-
297
- // If this is a controlled component, the result of this operation will be to
298
- // revert back to the old position. We expect a handler on `onDragStop`, at the least.
299
- var controlled = Boolean(_this.props.position);
300
- if (controlled) {
301
- var _this$props$position = _this.props.position,
302
- _x2 = _this$props$position.x,
303
- _y2 = _this$props$position.y;
304
-
305
- newState.x = _x2;
306
- newState.y = _y2;
307
- }
308
-
309
- _this.setState(newState);
310
- };
311
-
312
- _this.state = {
313
- // Whether or not we are currently dragging.
314
- dragging: false,
315
-
316
- // Whether or not we have been dragged before.
317
- dragged: false,
318
-
319
- // Current transform x and y.
320
- x: props.position ? props.position.x : props.defaultPosition.x,
321
- y: props.position ? props.position.y : props.defaultPosition.y,
322
-
323
- // Used for compensating for out-of-bounds drags
324
- slackX: 0, slackY: 0,
325
-
326
- // Can only determine if SVG after mounting
327
- isElementSVG: false
328
- };
329
- return _this;
330
- }
331
-
332
- _createClass(Draggable, [{
333
- key: 'componentWillMount',
334
- value: function componentWillMount() {
335
- if (this.props.position && !(this.props.onDrag || this.props.onStop)) {
336
- // eslint-disable-next-line
337
- 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.');
338
- }
339
- }
340
- }, {
341
- key: 'componentDidMount',
342
- value: function componentDidMount() {
343
- // Check to see if the element passed is an instanceof SVGElement
344
- if (typeof SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof SVGElement) {
345
- this.setState({ isElementSVG: true });
346
- }
347
- }
348
- }, {
349
- key: 'componentWillReceiveProps',
350
- value: function componentWillReceiveProps(nextProps /*: Object*/) {
351
- // Set x/y if position has changed
352
- if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
353
- this.setState({ x: nextProps.position.x, y: nextProps.position.y });
354
- }
355
- }
356
- }, {
357
- key: 'componentWillUnmount',
358
- value: function componentWillUnmount() {
359
- this.setState({ dragging: false }); // prevents invariant if unmounted while dragging
360
- }
361
- }, {
362
- key: 'render',
363
- value: function render() /*: React.Element<any>*/ {
364
- var _classNames;
365
-
366
- var style = {},
367
- svgTransform = null;
368
-
369
- // If this is controlled, we don't want to move it - unless it's dragging.
370
- var controlled = Boolean(this.props.position);
371
- var draggable = !controlled || this.state.dragging;
372
-
373
- var position = this.props.position || this.props.defaultPosition;
374
- var transformOpts = {
375
- // Set left if horizontal drag is enabled
376
- x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x,
377
-
378
- // Set top if vertical drag is enabled
379
- y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y
380
- };
381
-
382
- // If this element was SVG, we use the `transform` attribute.
383
- if (this.state.isElementSVG) {
384
- svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
385
- } else {
386
- // Add a CSS transform to move the element around. This allows us to move the element around
387
- // without worrying about whether or not it is relatively or absolutely positioned.
388
- // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
389
- // has a clean slate.
390
- style = (0, _domFns.createCSSTransform)(transformOpts);
391
- }
392
-
393
- var _props = this.props,
394
- defaultClassName = _props.defaultClassName,
395
- defaultClassNameDragging = _props.defaultClassNameDragging,
396
- defaultClassNameDragged = _props.defaultClassNameDragged;
397
-
398
- // Mark with class while dragging
399
-
400
- var className = (0, _classnames2.default)(this.props.children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
401
-
402
- // Reuse the child provided
403
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
404
- return _react2.default.createElement(
405
- _DraggableCore2.default,
406
- _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
407
- _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
408
- className: className,
409
- style: _extends({}, this.props.children.props.style, style),
410
- transform: svgTransform
411
- })
412
- );
413
- }
414
- }]);
415
-
416
- return Draggable;
417
- }(_react2.default.Component);
418
-
419
- Draggable.displayName = 'Draggable';
420
- Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
421
-
422
- /**
423
- * `axis` determines which axis the draggable can move.
424
- *
425
- * Note that all callbacks will still return data as normal. This only
426
- * controls flushing to the DOM.
427
- *
428
- * 'both' allows movement horizontally and vertically.
429
- * 'x' limits movement to horizontal axis.
430
- * 'y' limits movement to vertical axis.
431
- * 'none' limits all movement.
432
- *
433
- * Defaults to 'both'.
434
- */
435
- axis: _react.PropTypes.oneOf(['both', 'x', 'y', 'none']),
436
-
437
- /**
438
- * `bounds` determines the range of movement available to the element.
439
- * Available values are:
440
- *
441
- * 'parent' restricts movement within the Draggable's parent node.
442
- *
443
- * Alternatively, pass an object with the following properties, all of which are optional:
444
- *
445
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
446
- *
447
- * All values are in px.
448
- *
449
- * Example:
450
- *
451
- * ```jsx
452
- * let App = React.createClass({
453
- * render: function () {
454
- * return (
455
- * <Draggable bounds={{right: 300, bottom: 300}}>
456
- * <div>Content</div>
457
- * </Draggable>
458
- * );
459
- * }
460
- * });
461
- * ```
462
- */
463
- bounds: _react.PropTypes.oneOfType([_react.PropTypes.shape({
464
- left: _react.PropTypes.number,
465
- right: _react.PropTypes.number,
466
- top: _react.PropTypes.number,
467
- bottom: _react.PropTypes.number
468
- }), _react.PropTypes.string, _react.PropTypes.oneOf([false])]),
469
-
470
- defaultClassName: _react.PropTypes.string,
471
- defaultClassNameDragging: _react.PropTypes.string,
472
- defaultClassNameDragged: _react.PropTypes.string,
473
-
474
- /**
475
- * `defaultPosition` specifies the x and y that the dragged item should start at
476
- *
477
- * Example:
478
- *
479
- * ```jsx
480
- * let App = React.createClass({
481
- * render: function () {
482
- * return (
483
- * <Draggable defaultPosition={{x: 25, y: 25}}>
484
- * <div>I start with transformX: 25px and transformY: 25px;</div>
485
- * </Draggable>
486
- * );
487
- * }
488
- * });
489
- * ```
490
- */
491
- defaultPosition: _react.PropTypes.shape({
492
- x: _react.PropTypes.number,
493
- y: _react.PropTypes.number
494
- }),
495
-
496
- /**
497
- * `position`, if present, defines the current position of the element.
498
- *
499
- * This is similar to how form elements in React work - if no `position` is supplied, the component
500
- * is uncontrolled.
501
- *
502
- * Example:
503
- *
504
- * ```jsx
505
- * let App = React.createClass({
506
- * render: function () {
507
- * return (
508
- * <Draggable position={{x: 25, y: 25}}>
509
- * <div>I start with transformX: 25px and transformY: 25px;</div>
510
- * </Draggable>
511
- * );
512
- * }
513
- * });
514
- * ```
515
- */
516
- position: _react.PropTypes.shape({
517
- x: _react.PropTypes.number,
518
- y: _react.PropTypes.number
519
- }),
520
-
521
- /**
522
- * These properties should be defined on the child, not here.
523
- */
524
- className: _shims.dontSetMe,
525
- style: _shims.dontSetMe,
526
- transform: _shims.dontSetMe
527
- });
528
- Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
529
- axis: 'both',
530
- bounds: false,
531
- defaultClassName: 'react-draggable',
532
- defaultClassNameDragging: 'react-draggable-dragging',
533
- defaultClassNameDragged: 'react-draggable-dragged',
534
- defaultPosition: { x: 0, y: 0 },
535
- position: null
536
- });
537
- exports.default = Draggable;
538
-
539
- /***/ },
540
- /* 2 */
541
- /***/ function(module, exports) {
542
-
543
- module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
544
-
545
- /***/ },
546
- /* 3 */
547
- /***/ function(module, exports) {
548
-
549
- module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
550
-
551
- /***/ },
552
- /* 4 */
553
- /***/ function(module, exports, __webpack_require__) {
554
-
555
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
556
- Copyright (c) 2016 Jed Watson.
557
- Licensed under the MIT License (MIT), see
558
- http://jedwatson.github.io/classnames
559
- */
560
- /* global define */
561
-
562
- (function () {
563
- 'use strict';
564
-
565
- var hasOwn = {}.hasOwnProperty;
566
-
567
- function classNames () {
568
- var classes = [];
569
-
570
- for (var i = 0; i < arguments.length; i++) {
571
- var arg = arguments[i];
572
- if (!arg) continue;
573
-
574
- var argType = typeof arg;
575
-
576
- if (argType === 'string' || argType === 'number') {
577
- classes.push(arg);
578
- } else if (Array.isArray(arg)) {
579
- classes.push(classNames.apply(null, arg));
580
- } else if (argType === 'object') {
581
- for (var key in arg) {
582
- if (hasOwn.call(arg, key) && arg[key]) {
583
- classes.push(key);
584
- }
585
- }
586
- }
587
- }
588
-
589
- return classes.join(' ');
590
- }
591
-
592
- if (typeof module !== 'undefined' && module.exports) {
593
- module.exports = classNames;
594
- } else if (true) {
595
- // register as 'classnames', consistent with npm package name
596
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
597
- return classNames;
598
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
599
- } else {
600
- window.classNames = classNames;
601
- }
602
- }());
603
-
604
-
605
- /***/ },
606
- /* 5 */
607
- /***/ function(module, exports, __webpack_require__) {
608
-
609
- 'use strict';
610
-
611
- Object.defineProperty(exports, "__esModule", {
612
- value: true
613
- });
614
-
615
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
616
-
617
- exports.matchesSelector = matchesSelector;
618
- exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
619
- exports.addEvent = addEvent;
620
- exports.removeEvent = removeEvent;
621
- exports.outerHeight = outerHeight;
622
- exports.outerWidth = outerWidth;
623
- exports.innerHeight = innerHeight;
624
- exports.innerWidth = innerWidth;
625
- exports.offsetXYFromParent = offsetXYFromParent;
626
- exports.createCSSTransform = createCSSTransform;
627
- exports.createSVGTransform = createSVGTransform;
628
- exports.getTouch = getTouch;
629
- exports.getTouchIdentifier = getTouchIdentifier;
630
- exports.addUserSelectStyles = addUserSelectStyles;
631
- exports.removeUserSelectStyles = removeUserSelectStyles;
632
- exports.styleHacks = styleHacks;
633
-
634
- var _shims = __webpack_require__(6);
635
-
636
- var _getPrefix = __webpack_require__(7);
637
-
638
- var _getPrefix2 = _interopRequireDefault(_getPrefix);
639
-
640
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
641
-
642
- 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; }
643
-
644
- /*:: import type {ControlPosition} from './types';*/
645
-
646
-
647
- var matchesSelectorFunc = '';
648
- function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
649
- if (!matchesSelectorFunc) {
650
- matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
651
- // $FlowIgnore: Doesn't think elements are indexable
652
- return (0, _shims.isFunction)(el[method]);
653
- });
654
- }
655
-
656
- // $FlowIgnore: Doesn't think elements are indexable
657
- return el[matchesSelectorFunc].call(el, selector);
658
- }
659
-
660
- // Works up the tree to the draggable itself attempting to match selector.
661
- function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
662
- var node = el;
663
- do {
664
- if (matchesSelector(node, selector)) return true;
665
- if (node === baseNode) return false;
666
- node = node.parentNode;
667
- } while (node);
668
-
669
- return false;
670
- }
671
-
672
- function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
673
- if (!el) {
674
- return;
675
- }
676
- if (el.attachEvent) {
677
- el.attachEvent('on' + event, handler);
678
- } else if (el.addEventListener) {
679
- el.addEventListener(event, handler, true);
680
- } else {
681
- // $FlowIgnore: Doesn't think elements are indexable
682
- el['on' + event] = handler;
683
- }
684
- }
685
-
686
- function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
687
- if (!el) {
688
- return;
689
- }
690
- if (el.detachEvent) {
691
- el.detachEvent('on' + event, handler);
692
- } else if (el.removeEventListener) {
693
- el.removeEventListener(event, handler, true);
694
- } else {
695
- // $FlowIgnore: Doesn't think elements are indexable
696
- el['on' + event] = null;
697
- }
698
- }
699
-
700
- function outerHeight(node /*: HTMLElement*/) /*: number*/ {
701
- // This is deliberately excluding margin for our calculations, since we are using
702
- // offsetTop which is including margin. See getBoundPosition
703
- var height = node.clientHeight;
704
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
705
- height += (0, _shims.int)(computedStyle.borderTopWidth);
706
- height += (0, _shims.int)(computedStyle.borderBottomWidth);
707
- return height;
708
- }
709
-
710
- function outerWidth(node /*: HTMLElement*/) /*: number*/ {
711
- // This is deliberately excluding margin for our calculations, since we are using
712
- // offsetLeft which is including margin. See getBoundPosition
713
- var width = node.clientWidth;
714
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
715
- width += (0, _shims.int)(computedStyle.borderLeftWidth);
716
- width += (0, _shims.int)(computedStyle.borderRightWidth);
717
- return width;
718
- }
719
- function innerHeight(node /*: HTMLElement*/) /*: number*/ {
720
- var height = node.clientHeight;
721
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
722
- height -= (0, _shims.int)(computedStyle.paddingTop);
723
- height -= (0, _shims.int)(computedStyle.paddingBottom);
724
- return height;
725
- }
726
-
727
- function innerWidth(node /*: HTMLElement*/) /*: number*/ {
728
- var width = node.clientWidth;
729
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
730
- width -= (0, _shims.int)(computedStyle.paddingLeft);
731
- width -= (0, _shims.int)(computedStyle.paddingRight);
732
- return width;
733
- }
734
-
735
- // Get from offsetParent
736
- function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ {
737
- var isBody = offsetParent === offsetParent.ownerDocument.body;
738
- var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect();
739
-
740
- var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
741
- var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
742
-
743
- return { x: x, y: y };
744
- }
745
-
746
- function createCSSTransform(_ref) /*: Object*/ {
747
- var x = _ref.x,
748
- y = _ref.y;
749
-
750
- // Replace unitless items with px
751
- return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
752
- }
753
-
754
- function createSVGTransform(_ref3) /*: string*/ {
755
- var x = _ref3.x,
756
- y = _ref3.y;
757
-
758
- return 'translate(' + x + ',' + y + ')';
759
- }
760
-
761
- function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ {
762
- return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
763
- return identifier === t.identifier;
764
- }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
765
- return identifier === t.identifier;
766
- });
767
- }
768
-
769
- function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ {
770
- if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
771
- if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
772
- }
773
-
774
- // User-select Hacks:
775
- //
776
- // Useful for preventing blue highlights all over everything when dragging.
777
- var userSelectPrefix = (0, _getPrefix.getPrefix)('user-select');
778
- var userSelect = (0, _getPrefix.browserPrefixToStyle)('user-select', userSelectPrefix);
779
- var userSelectStyle = ';' + userSelect + ': none;';
780
- var userSelectReplaceRegExp = new RegExp(';?' + userSelect + ': none;'); // leading ; not present on IE
781
-
782
- // Note we're passing `document` b/c we could be iframed
783
- function addUserSelectStyles(body /*: HTMLElement*/) {
784
- var style = body.getAttribute('style') || '';
785
- body.setAttribute('style', style + userSelectStyle);
786
- }
787
-
788
- function removeUserSelectStyles(body /*: HTMLElement*/) {
789
- var style = body.getAttribute('style') || '';
790
- body.setAttribute('style', style.replace(userSelectReplaceRegExp, ''));
791
- }
792
-
793
- function styleHacks() /*: Object*/ {
794
- var childStyle /*: Object*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
795
-
796
- // Workaround IE pointer events; see #51
797
- // https://github.com/mzabriskie/react-draggable/issues/51#issuecomment-103488278
798
- return _extends({
799
- touchAction: 'none'
800
- }, childStyle);
801
- }
802
-
803
- /***/ },
804
- /* 6 */
805
- /***/ function(module, exports) {
806
-
807
- 'use strict';
808
-
809
- Object.defineProperty(exports, "__esModule", {
810
- value: true
811
- });
812
- exports.findInArray = findInArray;
813
- exports.isFunction = isFunction;
814
- exports.isNum = isNum;
815
- exports.int = int;
816
- exports.dontSetMe = dontSetMe;
817
-
818
- // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
819
- function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
820
- for (var i = 0, length = array.length; i < length; i++) {
821
- if (callback.apply(callback, [array[i], i, array])) return array[i];
822
- }
823
- }
824
-
825
- function isFunction(func /*: any*/) /*: boolean*/ {
826
- return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
827
- }
828
-
829
- function isNum(num /*: any*/) /*: boolean*/ {
830
- return typeof num === 'number' && !isNaN(num);
831
- }
832
-
833
- function int(a /*: string*/) /*: number*/ {
834
- return parseInt(a, 10);
835
- }
836
-
837
- function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
838
- if (props[propName]) {
839
- return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
840
- }
841
- }
842
-
843
- /***/ },
844
- /* 7 */
845
- /***/ function(module, exports) {
846
-
847
- 'use strict';
848
-
849
- Object.defineProperty(exports, "__esModule", {
850
- value: true
851
- });
852
- exports.getPrefix = getPrefix;
853
- exports.browserPrefixToKey = browserPrefixToKey;
854
- exports.browserPrefixToStyle = browserPrefixToStyle;
855
- var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
856
- function getPrefix() /*: string*/ {
857
- var prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
858
-
859
- // Checking specifically for 'window.document' is for pseudo-browser server-side
860
- // environments that define 'window' as the global context.
861
- // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
862
- if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
863
-
864
- var style = window.document.documentElement.style;
865
-
866
- if (prop in style) return '';
867
-
868
- for (var i = 0; i < prefixes.length; i++) {
869
- if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
870
- }
871
-
872
- return '';
873
- }
874
-
875
- function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
876
- return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
877
- }
878
-
879
- function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ {
880
- return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
881
- }
882
-
883
- function kebabToTitleCase(str /*: string*/) /*: string*/ {
884
- var out = '';
885
- var shouldCapitalize = true;
886
- for (var i = 0; i < str.length; i++) {
887
- if (shouldCapitalize) {
888
- out += str[i].toUpperCase();
889
- shouldCapitalize = false;
890
- } else if (str[i] === '-') {
891
- shouldCapitalize = true;
892
- } else {
893
- out += str[i];
894
- }
895
- }
896
- return out;
897
- }
898
-
899
- // Default export is the prefix itself, like 'Moz', 'Webkit', etc
900
- // Note that you may have to re-test for certain things; for instance, Chrome 50
901
- // can handle unprefixed `transform`, but not unprefixed `user-select`
902
- exports.default = getPrefix();
903
-
904
- /***/ },
905
- /* 8 */
906
- /***/ function(module, exports, __webpack_require__) {
907
-
908
- 'use strict';
909
-
910
- Object.defineProperty(exports, "__esModule", {
911
- value: true
912
- });
913
- exports.getBoundPosition = getBoundPosition;
914
- exports.snapToGrid = snapToGrid;
915
- exports.canDragX = canDragX;
916
- exports.canDragY = canDragY;
917
- exports.getControlPosition = getControlPosition;
918
- exports.createCoreData = createCoreData;
919
- exports.createDraggableData = createDraggableData;
920
-
921
- var _shims = __webpack_require__(6);
922
-
923
- var _reactDom = __webpack_require__(3);
924
-
925
- var _reactDom2 = _interopRequireDefault(_reactDom);
926
-
927
- var _domFns = __webpack_require__(5);
928
-
929
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
930
-
931
- /*:: import type Draggable from '../Draggable';*/
932
- /*:: import type {Bounds, ControlPosition, DraggableData} from './types';*/
933
- /*:: import type DraggableCore from '../DraggableCore';*/
934
- function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ {
935
- // If no bounds, short-circuit and move on
936
- if (!draggable.props.bounds) return [x, y];
937
-
938
- // Clone new bounds
939
- var bounds = draggable.props.bounds;
940
-
941
- bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
942
- var node = _reactDom2.default.findDOMNode(draggable);
943
-
944
- if (typeof bounds === 'string') {
945
- var ownerDocument = node.ownerDocument;
946
-
947
- var ownerWindow = ownerDocument.defaultView;
948
- var boundNode = void 0;
949
- if (bounds === 'parent') {
950
- boundNode = node.parentNode;
951
- } else {
952
- boundNode = ownerDocument.querySelector(bounds);
953
- if (!boundNode) throw new Error('Bounds selector "' + bounds + '" could not find an element.');
954
- }
955
- var nodeStyle = ownerWindow.getComputedStyle(node);
956
- var boundNodeStyle = ownerWindow.getComputedStyle(boundNode);
957
- // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
958
- bounds = {
959
- left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.borderLeftWidth) + (0, _shims.int)(nodeStyle.marginLeft),
960
- top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.borderTopWidth) + (0, _shims.int)(nodeStyle.marginTop),
961
- right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft,
962
- bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop
963
- };
964
- }
965
-
966
- // Keep x and y below right and bottom limits...
967
- if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
968
- if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
969
-
970
- // But above left and top limits.
971
- if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
972
- if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
973
-
974
- return [x, y];
975
- }
976
-
977
- function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ {
978
- var x = Math.round(pendingX / grid[0]) * grid[0];
979
- var y = Math.round(pendingY / grid[1]) * grid[1];
980
- return [x, y];
981
- }
982
-
983
- function canDragX(draggable /*: Draggable*/) /*: boolean*/ {
984
- return draggable.props.axis === 'both' || draggable.props.axis === 'x';
985
- }
986
-
987
- function canDragY(draggable /*: Draggable*/) /*: boolean*/ {
988
- return draggable.props.axis === 'both' || draggable.props.axis === 'y';
989
- }
990
-
991
- // Get {x, y} positions from event.
992
- function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ {
993
- var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
994
- if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
995
- var node = _reactDom2.default.findDOMNode(draggableCore);
996
- // User can provide an offsetParent if desired.
997
- var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
998
- return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent);
999
- }
1000
-
1001
- // Create an data object exposed by <DraggableCore>'s events
1002
- function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
1003
- var state = draggable.state;
1004
- var isStart = !(0, _shims.isNum)(state.lastX);
1005
-
1006
- if (isStart) {
1007
- // If this is our first move, use the x and y as last coords.
1008
- return {
1009
- node: _reactDom2.default.findDOMNode(draggable),
1010
- deltaX: 0, deltaY: 0,
1011
- lastX: x, lastY: y,
1012
- x: x, y: y
1013
- };
1014
- } else {
1015
- // Otherwise calculate proper values.
1016
- return {
1017
- node: _reactDom2.default.findDOMNode(draggable),
1018
- deltaX: x - state.lastX, deltaY: y - state.lastY,
1019
- lastX: state.lastX, lastY: state.lastY,
1020
- x: x, y: y
1021
- };
1022
- }
1023
- }
1024
-
1025
- // Create an data exposed by <Draggable>'s events
1026
- function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ {
1027
- return {
1028
- node: coreData.node,
1029
- x: draggable.state.x + coreData.deltaX,
1030
- y: draggable.state.y + coreData.deltaY,
1031
- deltaX: coreData.deltaX,
1032
- deltaY: coreData.deltaY,
1033
- lastX: draggable.state.x,
1034
- lastY: draggable.state.y
1035
- };
1036
- }
1037
-
1038
- // A lot faster than stringify/parse
1039
- function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {
1040
- return {
1041
- left: bounds.left,
1042
- top: bounds.top,
1043
- right: bounds.right,
1044
- bottom: bounds.bottom
1045
- };
1046
- }
1047
-
1048
- /***/ },
1049
- /* 9 */
1050
- /***/ function(module, exports, __webpack_require__) {
1051
-
1052
- /* WEBPACK VAR INJECTION */(function(process) {'use strict';
1053
-
1054
- Object.defineProperty(exports, "__esModule", {
1055
- value: true
1056
- });
1057
-
1058
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
1059
-
1060
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1061
-
1062
- var _react = __webpack_require__(2);
1063
-
1064
- var _react2 = _interopRequireDefault(_react);
1065
-
1066
- var _reactDom = __webpack_require__(3);
1067
-
1068
- var _reactDom2 = _interopRequireDefault(_reactDom);
1069
-
1070
- var _domFns = __webpack_require__(5);
1071
-
1072
- var _positionFns = __webpack_require__(8);
1073
-
1074
- var _shims = __webpack_require__(6);
1075
-
1076
- var _log = __webpack_require__(11);
1077
-
1078
- var _log2 = _interopRequireDefault(_log);
1079
-
1080
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1081
-
1082
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1083
-
1084
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1085
-
1086
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1087
-
1088
- // Simple abstraction for dragging events names.
1089
- /*:: import type {EventHandler} from './utils/types';*/
1090
- var eventsFor = {
1091
- touch: {
1092
- start: 'touchstart',
1093
- move: 'touchmove',
1094
- stop: 'touchend'
1095
- },
1096
- mouse: {
1097
- start: 'mousedown',
1098
- move: 'mousemove',
1099
- stop: 'mouseup'
1100
- }
1101
- };
1102
-
1103
- // Default to mouse events.
1104
- var dragEventFor = eventsFor.mouse;
1105
-
1106
- //
1107
- // Define <DraggableCore>.
1108
- //
1109
- // <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
1110
- // work well with libraries that require more control over the element.
1111
- //
1112
-
1113
- /*:: type CoreState = {
1114
- dragging: boolean,
1115
- lastX: number,
1116
- lastY: number,
1117
- touchIdentifier: ?number
1118
- };*/
1119
-
1120
- var DraggableCore = function (_React$Component) {
1121
- _inherits(DraggableCore, _React$Component);
1122
-
1123
- function DraggableCore() {
1124
- var _ref;
1125
-
1126
- var _temp, _this, _ret;
1127
-
1128
- _classCallCheck(this, DraggableCore);
1129
-
1130
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1131
- args[_key] = arguments[_key];
1132
- }
1133
-
1134
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
1135
- dragging: false,
1136
- // Used while dragging to determine deltas.
1137
- lastX: NaN, lastY: NaN,
1138
- touchIdentifier: null
1139
- }, _this.handleDragStart = function (e) {
1140
- // Make it possible to attach event handlers on top of this one.
1141
- _this.props.onMouseDown(e);
1142
-
1143
- // Only accept left-clicks.
1144
- if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
1145
-
1146
- // Get nodes. Be sure to grab relative document (could be iframed)
1147
- var domNode = _reactDom2.default.findDOMNode(_this);
1148
- var ownerDocument = domNode.ownerDocument;
1149
-
1150
- // Short circuit if handle or cancel prop was provided and selector doesn't match.
1151
-
1152
- if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, domNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, domNode)) {
1153
- return;
1154
- }
1155
-
1156
- // Set touch identifier in component state if this is a touch event. This allows us to
1157
- // distinguish between individual touches on multitouch screens by identifying which
1158
- // touchpoint was set to this element.
1159
- var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
1160
- _this.setState({ touchIdentifier: touchIdentifier });
1161
-
1162
- // Get the current drag point from the event. This is used as the offset.
1163
- var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this);
1164
- if (position == null) return; // not possible but satisfies flow
1165
- var x = position.x,
1166
- y = position.y;
1167
-
1168
- // Create an event object with all the data parents need to make a decision here.
1169
-
1170
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
1171
-
1172
- (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent);
1173
-
1174
- // Call event handler. If it returns explicit false, cancel.
1175
- (0, _log2.default)('calling', _this.props.onStart);
1176
- var shouldUpdate = _this.props.onStart(e, coreEvent);
1177
- if (shouldUpdate === false) return;
1178
-
1179
- // Add a style to the body to disable user-select. This prevents text from
1180
- // being selected all over the page.
1181
- if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument.body);
1182
-
1183
- // Initiate dragging. Set the current x and y as offsets
1184
- // so we know how much we've moved during the drag. This allows us
1185
- // to drag elements around even if they have been moved, without issue.
1186
- _this.setState({
1187
- dragging: true,
1188
-
1189
- lastX: x,
1190
- lastY: y
1191
- });
1192
-
1193
- // Add events to the document directly so we catch when the user's mouse/touch moves outside of
1194
- // this element. We use different events depending on whether or not we have detected that this
1195
- // is a touch-capable device.
1196
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
1197
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
1198
- }, _this.handleDrag = function (e) {
1199
-
1200
- // Prevent scrolling on mobile devices, like ipad/iphone.
1201
- if (e.type === 'touchmove') e.preventDefault();
1202
-
1203
- // Get the current drag point from the event. This is used as the offset.
1204
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
1205
- if (position == null) return;
1206
- var x = position.x,
1207
- y = position.y;
1208
-
1209
- // Snap to grid if prop has been provided
1210
-
1211
- if (x !== x) debugger;
1212
-
1213
- if (Array.isArray(_this.props.grid)) {
1214
- var deltaX = x - _this.state.lastX,
1215
- deltaY = y - _this.state.lastY;
1216
-
1217
- var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
1218
-
1219
- var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
1220
-
1221
- deltaX = _snapToGrid2[0];
1222
- deltaY = _snapToGrid2[1];
1223
-
1224
- if (!deltaX && !deltaY) return; // skip useless drag
1225
- x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
1226
- }
1227
-
1228
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
1229
-
1230
- (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent);
1231
-
1232
- // Call event handler. If it returns explicit false, trigger end.
1233
- var shouldUpdate = _this.props.onDrag(e, coreEvent);
1234
- if (shouldUpdate === false) {
1235
- try {
1236
- // $FlowIgnore
1237
- _this.handleDragStop(new MouseEvent('mouseup'));
1238
- } catch (err) {
1239
- // Old browsers
1240
- var event = ((document.createEvent('MouseEvents') /*: any*/) /*: MouseTouchEvent*/);
1241
- // I see why this insanity was deprecated
1242
- // $FlowIgnore
1243
- event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1244
- _this.handleDragStop(event);
1245
- }
1246
- return;
1247
- }
1248
-
1249
- _this.setState({
1250
- lastX: x,
1251
- lastY: y
1252
- });
1253
- }, _this.handleDragStop = function (e) {
1254
- if (!_this.state.dragging) return;
1255
-
1256
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
1257
- if (position == null) return;
1258
- var x = position.x,
1259
- y = position.y;
1260
-
1261
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
1262
-
1263
- var _ReactDOM$findDOMNode = _reactDom2.default.findDOMNode(_this),
1264
- ownerDocument = _ReactDOM$findDOMNode.ownerDocument;
1265
-
1266
- // Remove user-select hack
1267
-
1268
-
1269
- if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body);
1270
-
1271
- (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent);
1272
-
1273
- // Reset the el.
1274
- _this.setState({
1275
- dragging: false,
1276
- lastX: NaN,
1277
- lastY: NaN
1278
- });
1279
-
1280
- // Call event handler
1281
- _this.props.onStop(e, coreEvent);
1282
-
1283
- // Remove event handlers
1284
- (0, _log2.default)('DraggableCore: Removing handlers');
1285
- (0, _domFns.removeEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
1286
- (0, _domFns.removeEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
1287
- }, _this.onMouseDown = function (e) {
1288
- dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
1289
-
1290
- return _this.handleDragStart(e);
1291
- }, _this.onMouseUp = function (e) {
1292
- dragEventFor = eventsFor.mouse;
1293
-
1294
- return _this.handleDragStop(e);
1295
- }, _this.onTouchStart = function (e) {
1296
- // We're on a touch device now, so change the event handlers
1297
- dragEventFor = eventsFor.touch;
1298
-
1299
- return _this.handleDragStart(e);
1300
- }, _this.onTouchEnd = function (e) {
1301
- // We're on a touch device now, so change the event handlers
1302
- dragEventFor = eventsFor.touch;
1303
-
1304
- return _this.handleDragStop(e);
1305
- }, _temp), _possibleConstructorReturn(_this, _ret);
1306
- }
1307
-
1308
- _createClass(DraggableCore, [{
1309
- key: 'componentWillUnmount',
1310
- value: function componentWillUnmount() {
1311
- // Remove any leftover event handlers. Remove both touch and mouse handlers in case
1312
- // some browser quirk caused a touch event to fire during a mouse move, or vice versa.
1313
- var _ReactDOM$findDOMNode2 = _reactDom2.default.findDOMNode(this),
1314
- ownerDocument = _ReactDOM$findDOMNode2.ownerDocument;
1315
-
1316
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
1317
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
1318
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
1319
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
1320
- if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body);
1321
- }
1322
-
1323
- // Same as onMouseDown (start drag), but now consider this a touch device.
1324
-
1325
- }, {
1326
- key: 'render',
1327
- value: function render() /*: React.Element<any>*/ {
1328
- // Reuse the child provided
1329
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
1330
- return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
1331
- style: (0, _domFns.styleHacks)(this.props.children.props.style),
1332
-
1333
- // Note: mouseMove handler is attached to document so it will still function
1334
- // when the user drags quickly and leaves the bounds of the element.
1335
- onMouseDown: this.onMouseDown,
1336
- onTouchStart: this.onTouchStart,
1337
- onMouseUp: this.onMouseUp,
1338
- onTouchEnd: this.onTouchEnd
1339
- });
1340
- }
1341
- }]);
1342
-
1343
- return DraggableCore;
1344
- }(_react2.default.Component);
1345
-
1346
- DraggableCore.displayName = 'DraggableCore';
1347
- DraggableCore.propTypes = {
1348
- /**
1349
- * `allowAnyClick` allows dragging using any mouse button.
1350
- * By default, we only accept the left button.
1351
- *
1352
- * Defaults to `false`.
1353
- */
1354
- allowAnyClick: _react.PropTypes.bool,
1355
-
1356
- /**
1357
- * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
1358
- * with the exception of `onMouseDown`, will not fire.
1359
- */
1360
- disabled: _react.PropTypes.bool,
1361
-
1362
- /**
1363
- * By default, we add 'user-select:none' attributes to the document body
1364
- * to prevent ugly text selection during drag. If this is causing problems
1365
- * for your app, set this to `false`.
1366
- */
1367
- enableUserSelectHack: _react.PropTypes.bool,
1368
-
1369
- /**
1370
- * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
1371
- * instead of using the parent node.
1372
- */
1373
- offsetParent: function offsetParent(props, propName) {
1374
- if (process.browser && props[propName] && props[propName].nodeType !== 1) {
1375
- throw new Error('Draggable\'s offsetParent must be a DOM Node.');
1376
- }
1377
- },
1378
-
1379
- /**
1380
- * `grid` specifies the x and y that dragging should snap to.
1381
- */
1382
- grid: _react.PropTypes.arrayOf(_react.PropTypes.number),
1383
-
1384
- /**
1385
- * `handle` specifies a selector to be used as the handle that initiates drag.
1386
- *
1387
- * Example:
1388
- *
1389
- * ```jsx
1390
- * let App = React.createClass({
1391
- * render: function () {
1392
- * return (
1393
- * <Draggable handle=".handle">
1394
- * <div>
1395
- * <div className="handle">Click me to drag</div>
1396
- * <div>This is some other content</div>
1397
- * </div>
1398
- * </Draggable>
1399
- * );
1400
- * }
1401
- * });
1402
- * ```
1403
- */
1404
- handle: _react.PropTypes.string,
1405
-
1406
- /**
1407
- * `cancel` specifies a selector to be used to prevent drag initialization.
1408
- *
1409
- * Example:
1410
- *
1411
- * ```jsx
1412
- * let App = React.createClass({
1413
- * render: function () {
1414
- * return(
1415
- * <Draggable cancel=".cancel">
1416
- * <div>
1417
- * <div className="cancel">You can't drag from here</div>
1418
- * <div>Dragging here works fine</div>
1419
- * </div>
1420
- * </Draggable>
1421
- * );
1422
- * }
1423
- * });
1424
- * ```
1425
- */
1426
- cancel: _react.PropTypes.string,
1427
-
1428
- /**
1429
- * Called when dragging starts.
1430
- * If this function returns the boolean false, dragging will be canceled.
1431
- */
1432
- onStart: _react.PropTypes.func,
1433
-
1434
- /**
1435
- * Called while dragging.
1436
- * If this function returns the boolean false, dragging will be canceled.
1437
- */
1438
- onDrag: _react.PropTypes.func,
1439
-
1440
- /**
1441
- * Called when dragging stops.
1442
- * If this function returns the boolean false, the drag will remain active.
1443
- */
1444
- onStop: _react.PropTypes.func,
1445
-
1446
- /**
1447
- * A workaround option which can be passed if onMouseDown needs to be accessed,
1448
- * since it'll always be blocked (as there is internal use of onMouseDown)
1449
- */
1450
- onMouseDown: _react.PropTypes.func,
1451
-
1452
- /**
1453
- * These properties should be defined on the child, not here.
1454
- */
1455
- className: _shims.dontSetMe,
1456
- style: _shims.dontSetMe,
1457
- transform: _shims.dontSetMe
1458
- };
1459
- DraggableCore.defaultProps = {
1460
- allowAnyClick: false, // by default only accept left click
1461
- cancel: null,
1462
- disabled: false,
1463
- enableUserSelectHack: true,
1464
- offsetParent: null,
1465
- handle: null,
1466
- grid: null,
1467
- transform: null,
1468
- onStart: function onStart() {},
1469
- onDrag: function onDrag() {},
1470
- onStop: function onStop() {},
1471
- onMouseDown: function onMouseDown() {}
1472
- };
1473
- exports.default = DraggableCore;
1474
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
1475
-
1476
- /***/ },
1477
- /* 10 */
1478
- /***/ function(module, exports) {
1479
-
1480
- // shim for using process in browser
1481
- var process = module.exports = {};
1482
-
1483
- // cached from whatever global is present so that test runners that stub it
1484
- // don't break things. But we need to wrap it in a try catch in case it is
1485
- // wrapped in strict mode code which doesn't define any globals. It's inside a
1486
- // function because try/catches deoptimize in certain engines.
1487
-
1488
- var cachedSetTimeout;
1489
- var cachedClearTimeout;
1490
-
1491
- function defaultSetTimout() {
1492
- throw new Error('setTimeout has not been defined');
1493
- }
1494
- function defaultClearTimeout () {
1495
- throw new Error('clearTimeout has not been defined');
1496
- }
1497
- (function () {
1498
- try {
1499
- if (typeof setTimeout === 'function') {
1500
- cachedSetTimeout = setTimeout;
1501
- } else {
1502
- cachedSetTimeout = defaultSetTimout;
1503
- }
1504
- } catch (e) {
1505
- cachedSetTimeout = defaultSetTimout;
1506
- }
1507
- try {
1508
- if (typeof clearTimeout === 'function') {
1509
- cachedClearTimeout = clearTimeout;
1510
- } else {
1511
- cachedClearTimeout = defaultClearTimeout;
1512
- }
1513
- } catch (e) {
1514
- cachedClearTimeout = defaultClearTimeout;
1515
- }
1516
- } ())
1517
- function runTimeout(fun) {
1518
- if (cachedSetTimeout === setTimeout) {
1519
- //normal enviroments in sane situations
1520
- return setTimeout(fun, 0);
1521
- }
1522
- // if setTimeout wasn't available but was latter defined
1523
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1524
- cachedSetTimeout = setTimeout;
1525
- return setTimeout(fun, 0);
1526
- }
1527
- try {
1528
- // when when somebody has screwed with setTimeout but no I.E. maddness
1529
- return cachedSetTimeout(fun, 0);
1530
- } catch(e){
1531
- try {
1532
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1533
- return cachedSetTimeout.call(null, fun, 0);
1534
- } catch(e){
1535
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
1536
- return cachedSetTimeout.call(this, fun, 0);
1537
- }
1538
- }
1539
-
1540
-
1541
- }
1542
- function runClearTimeout(marker) {
1543
- if (cachedClearTimeout === clearTimeout) {
1544
- //normal enviroments in sane situations
1545
- return clearTimeout(marker);
1546
- }
1547
- // if clearTimeout wasn't available but was latter defined
1548
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1549
- cachedClearTimeout = clearTimeout;
1550
- return clearTimeout(marker);
1551
- }
1552
- try {
1553
- // when when somebody has screwed with setTimeout but no I.E. maddness
1554
- return cachedClearTimeout(marker);
1555
- } catch (e){
1556
- try {
1557
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1558
- return cachedClearTimeout.call(null, marker);
1559
- } catch (e){
1560
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
1561
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1562
- return cachedClearTimeout.call(this, marker);
1563
- }
1564
- }
1565
-
1566
-
1567
-
1568
- }
1569
- var queue = [];
1570
- var draining = false;
1571
- var currentQueue;
1572
- var queueIndex = -1;
1573
-
1574
- function cleanUpNextTick() {
1575
- if (!draining || !currentQueue) {
1576
- return;
1577
- }
1578
- draining = false;
1579
- if (currentQueue.length) {
1580
- queue = currentQueue.concat(queue);
1581
- } else {
1582
- queueIndex = -1;
1583
- }
1584
- if (queue.length) {
1585
- drainQueue();
1586
- }
1587
- }
1588
-
1589
- function drainQueue() {
1590
- if (draining) {
1591
- return;
1592
- }
1593
- var timeout = runTimeout(cleanUpNextTick);
1594
- draining = true;
1595
-
1596
- var len = queue.length;
1597
- while(len) {
1598
- currentQueue = queue;
1599
- queue = [];
1600
- while (++queueIndex < len) {
1601
- if (currentQueue) {
1602
- currentQueue[queueIndex].run();
1603
- }
1604
- }
1605
- queueIndex = -1;
1606
- len = queue.length;
1607
- }
1608
- currentQueue = null;
1609
- draining = false;
1610
- runClearTimeout(timeout);
1611
- }
1612
-
1613
- process.nextTick = function (fun) {
1614
- var args = new Array(arguments.length - 1);
1615
- if (arguments.length > 1) {
1616
- for (var i = 1; i < arguments.length; i++) {
1617
- args[i - 1] = arguments[i];
1618
- }
1619
- }
1620
- queue.push(new Item(fun, args));
1621
- if (queue.length === 1 && !draining) {
1622
- runTimeout(drainQueue);
1623
- }
1624
- };
1625
-
1626
- // v8 likes predictible objects
1627
- function Item(fun, array) {
1628
- this.fun = fun;
1629
- this.array = array;
1630
- }
1631
- Item.prototype.run = function () {
1632
- this.fun.apply(null, this.array);
1633
- };
1634
- process.title = 'browser';
1635
- process.browser = true;
1636
- process.env = {};
1637
- process.argv = [];
1638
- process.version = ''; // empty string to avoid regexp issues
1639
- process.versions = {};
1640
-
1641
- function noop() {}
1642
-
1643
- process.on = noop;
1644
- process.addListener = noop;
1645
- process.once = noop;
1646
- process.off = noop;
1647
- process.removeListener = noop;
1648
- process.removeAllListeners = noop;
1649
- process.emit = noop;
1650
-
1651
- process.binding = function (name) {
1652
- throw new Error('process.binding is not supported');
1653
- };
1654
-
1655
- process.cwd = function () { return '/' };
1656
- process.chdir = function (dir) {
1657
- throw new Error('process.chdir is not supported');
1658
- };
1659
- process.umask = function() { return 0; };
1660
-
1661
-
1662
- /***/ },
1663
- /* 11 */
1664
- /***/ function(module, exports, __webpack_require__) {
1665
-
1666
- "use strict";
1667
-
1668
- Object.defineProperty(exports, "__esModule", {
1669
- value: true
1670
- });
1671
- exports.default = log;
1672
-
1673
- /*eslint no-console:0*/
1674
- function log() {
1675
- var _console;
1676
-
1677
- if ((undefined)) (_console = console).log.apply(_console, arguments);
1678
- }
1679
-
1680
- /***/ }
1681
- /******/ ])
1682
- });
1683
- ;
1684
- //# sourceMappingURL=react-draggable.js.map
1685
-
1686
- /***/ },
1687
-
1688
68
  /***/ 148:
1689
69
  /***/ function(module, exports, __webpack_require__) {
1690
70
 
@@ -1694,359 +74,6 @@ module.exports =
1694
74
  value: true
1695
75
  });
1696
76
 
1697
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1698
-
1699
- var _react = __webpack_require__(2);
1700
-
1701
- var _react2 = _interopRequireDefault(_react);
1702
-
1703
- var _reactDraggable = __webpack_require__(18);
1704
-
1705
- var _reactDraggable2 = _interopRequireDefault(_reactDraggable);
1706
-
1707
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1708
-
1709
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1710
-
1711
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1712
-
1713
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1714
-
1715
- var BundleTable = function (_Component) {
1716
- _inherits(BundleTable, _Component);
1717
-
1718
- function BundleTable() {
1719
- _classCallCheck(this, BundleTable);
1720
-
1721
- var _this = _possibleConstructorReturn(this, (BundleTable.__proto__ || Object.getPrototypeOf(BundleTable)).call(this));
1722
-
1723
- _this.state = {
1724
- yPositions: [],
1725
- currentlyBeingDragged: null,
1726
- zIndexes: []
1727
- };
1728
- _this.handleDragStart = _this.handleDragStart.bind(_this);
1729
- _this.handleDrag = _this.handleDrag.bind(_this);
1730
- _this.handleDragEnd = _this.handleDragEnd.bind(_this);
1731
- _this.raiseUp = _this.raiseUp.bind(_this);
1732
- return _this;
1733
- }
1734
-
1735
- _createClass(BundleTable, [{
1736
- key: 'raiseUp',
1737
- value: function raiseUp(index) {
1738
- var resourceGroups = this.props.resourceGroups;
1739
-
1740
- var zIndexes = [];
1741
- resourceGroups.forEach(function (g, i) {
1742
- zIndexes[i] = i === index ? 6000 : 1;
1743
- });
1744
- this.setState({ zIndexes: zIndexes });
1745
- }
1746
- }, {
1747
- key: 'handleDragStart',
1748
- value: function handleDragStart(e, v, i) {
1749
- var _this2 = this;
1750
-
1751
- this.setState({ currentlyBeingDragged: i });
1752
- var resourceGroups = this.props.resourceGroups;
1753
-
1754
- this.elementReorders = [];
1755
- var yPositions = [];
1756
- resourceGroups.forEach(function (g, i) {
1757
- _this2.elementReorders[i] = 0;
1758
- yPositions[i] = 0;
1759
- });
1760
- this.setState({ yPositions: yPositions });
1761
- this.finalDelta = 0;
1762
- }
1763
- }, {
1764
- key: 'handleDrag',
1765
- value: function handleDrag(e, v) {
1766
- var i = this.state.currentlyBeingDragged;
1767
- var overlap = 15;
1768
- var height = 50;
1769
-
1770
- if (v.y > overlap - height && v.y < height - overlap) {
1771
- this.elementReorders = this.elementReorders.map(function (e) {
1772
- return 0;
1773
- });
1774
- this.finalDelta = 0;
1775
- } else if (v.y >= height - overlap) {
1776
- for (var j = 1; j < this.elementReorders.length; j++) {
1777
- if (v.y >= j * height - overlap && v.y < (j + 1) * height - overlap) {
1778
- this.finalDelta = j;
1779
- for (var k = 0; k < this.elementReorders.length; k++) {
1780
- this.elementReorders[k] = k > i && k - i - 1 < j ? -1 : 0;
1781
- }
1782
- }
1783
- }
1784
- } else if (v.y <= overlap - height) {
1785
- for (var jj = 1; jj < this.elementReorders.length; jj++) {
1786
- if (v.y <= jj * -height + overlap && v.y > (jj + 1) * -height + overlap) {
1787
- this.finalDelta = -jj;
1788
- for (var kk = 0; kk < this.elementReorders.length; kk++) {
1789
- this.elementReorders[kk] = kk < i && i - kk - 1 < jj ? 1 : 0;
1790
- }
1791
- }
1792
- }
1793
- }
1794
-
1795
- var yPositions = this.elementReorders.map(function (n, i) {
1796
- return n * height;
1797
- });
1798
- if (!this.arraysEqual(yPositions, this.state.yPositions)) {
1799
- this.setState({ yPositions: yPositions });
1800
- }
1801
- }
1802
- }, {
1803
- key: 'arraysEqual',
1804
- value: function arraysEqual(arr1, arr2) {
1805
- if (arr1.length !== arr2.length) return false;
1806
- for (var i = arr1.length; i--;) {
1807
- if (arr1[i] !== arr2[i]) return false;
1808
- }
1809
- return true;
1810
- }
1811
- }, {
1812
- key: 'handleDragEnd',
1813
- value: function handleDragEnd() {
1814
- var i = this.state.currentlyBeingDragged;
1815
- if (this.finalDelta) {
1816
- this.props.changeGroupOrder(i, i + this.finalDelta);
1817
- }
1818
- this.setState({ yPositions: this.elementReorders.map(function () {
1819
- return 0;
1820
- }) });
1821
- }
1822
- }, {
1823
- key: 'render',
1824
- value: function render() {
1825
- var _this3 = this;
1826
-
1827
- var _props = this.props,
1828
- resourceGroups = _props.resourceGroups,
1829
- resourceGroupIndex = _props.resourceGroupIndex,
1830
- removeResourceGroup = _props.removeResourceGroup,
1831
- openConnectionModal = _props.openConnectionModal,
1832
- clickTableRow = _props.clickTableRow,
1833
- step = _props.step;
1834
-
1835
- /*var childs;
1836
- if(React.Children.count(children) > 0){
1837
- childs = React.Children.toArray(children)
1838
- } else {
1839
- return <div/>
1840
- }*/
1841
-
1842
- /*return(
1843
- <div>
1844
- <br/>
1845
- <div style={{fontSize:'16px'}}>Object Mappings</div>
1846
- <Table bordered wrapperStyle={{overflow:'visible'}}>
1847
- <TableHeader>
1848
- <TableRow>
1849
- <TableHeaderColumn>Source Objects</TableHeaderColumn>
1850
- <TableHeaderColumn>Connection</TableHeaderColumn>
1851
- <TableHeaderColumn>Target Object</TableHeaderColumn>
1852
- <TableHeaderColumn></TableHeaderColumn>
1853
- </TableRow>
1854
- </TableHeader>
1855
- <TableBody>
1856
- {resourceGroups && resourceGroups.map((group, i)=>
1857
- <TableRow key={i} onClick={()=>clickTableRow(i)}
1858
- style={{background: i===resourceGroupIndex ? '#f4f6f9' : 'white', cursor:'pointer'}}>
1859
- <TableRowColumn>
1860
- {React.Children.count(children) > 0 ?
1861
- React.cloneElement(
1862
- childs[0], { group }
1863
- )
1864
- : null}
1865
- </TableRowColumn>
1866
- <TableRowColumn>
1867
- {React.Children.count(children) > 1 ?
1868
- React.cloneElement(
1869
- childs[1], { group, i, showConnectionModal }
1870
- )
1871
- : null}
1872
- </TableRowColumn>
1873
- <TableRowColumn truncate={false}>
1874
- {React.Children.count(children) > 2 ?
1875
- React.cloneElement(
1876
- childs[2], { group, i }
1877
- )
1878
- : null}
1879
- </TableRowColumn>
1880
- <TableRowColumn>
1881
- {React.Children.count(children) > 3 ?
1882
- React.cloneElement(
1883
- childs[3], { group, i, removeResourceGroup, resourceGroups }
1884
- )
1885
- : null}
1886
- </TableRowColumn>
1887
- </TableRow>
1888
- )}
1889
- </TableBody>
1890
- </Table>
1891
- <div>
1892
- </div>
1893
- </div>
1894
- )*/
1895
-
1896
- return _react2.default.createElement(
1897
- 'div',
1898
- null,
1899
- _react2.default.createElement('br', null),
1900
- _react2.default.createElement(
1901
- 'div',
1902
- { className: 'bundle-table-header' },
1903
- _react2.default.createElement(
1904
- 'div',
1905
- { style: { display: 'inline-block', width: '50%' } },
1906
- 'Source Objects'
1907
- ),
1908
- _react2.default.createElement(
1909
- 'div',
1910
- { style: { display: 'inline-block', width: '120px' } },
1911
- 'Connection'
1912
- ),
1913
- _react2.default.createElement(
1914
- 'div',
1915
- { style: { display: 'inline-block', width: 'calc(50% - 120px)' } },
1916
- 'Destination Objects'
1917
- )
1918
- ),
1919
- _react2.default.createElement(
1920
- 'div',
1921
- { className: 'bundle-table-body' },
1922
- resourceGroups && resourceGroups.map(function (group, i) {
1923
-
1924
- var linked = false;
1925
- if (group.customExternalKeys) {
1926
- if (group.sourceKeys && group.sourceKeys.length > 0 && group.destinationKeys && group.destinationKeys.length > 0) {
1927
- linked = true;
1928
- }
1929
- } else {
1930
- if (group.lingkSourceKey) {
1931
- linked = true;
1932
- }
1933
- }
1934
-
1935
- return _react2.default.createElement(
1936
- _reactDraggable2.default,
1937
- { axis: 'y', bounds: 'parent', key: i, handle: '.dragon', position: { x: 0, y: _this3.state.yPositions[i] },
1938
- onStart: function onStart(e, v) {
1939
- return _this3.handleDragStart(e, v, i);
1940
- }, onDrag: _this3.handleDrag, onStop: _this3.handleDragEnd },
1941
- _react2.default.createElement(
1942
- 'div',
1943
- { className: 'bundle-table-row', key: i, style: { background: i === resourceGroupIndex ? '#f4f6f9' : 'white' }, onClick: function onClick() {
1944
- return clickTableRow(i);
1945
- } },
1946
- _react2.default.createElement(
1947
- 'div',
1948
- { className: 'bundle-table-dragger' },
1949
- _react2.default.createElement(
1950
- 'div',
1951
- { style: { display: 'inline-block', width: '50%', verticalAlign: 'top', paddingTop: 5 } },
1952
- _react2.default.createElement(
1953
- 'div',
1954
- { style: { display: 'inline-block', verticalAlign: 'top', marginRight: 8, cursor: 'pointer' },
1955
- className: 'dragon' },
1956
- _react2.default.createElement(
1957
- 'svg',
1958
- { width: '24', height: '24', viewBox: '0 0 24 24' },
1959
- _react2.default.createElement('path', { d: 'M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z' })
1960
- )
1961
- ),
1962
- _react2.default.createElement(
1963
- 'div',
1964
- { style: { paddingTop: 3, display: 'inline-block', overflow: 'hidden',
1965
- textOverflow: 'ellipsis', maxWidth: 'calc(100% - 32px)', whiteSpace: 'nowrap' } },
1966
- group.resources && group.resources.map(function (rsc, ii) {
1967
- return _react2.default.createElement(
1968
- 'span',
1969
- { key: ii },
1970
- ii !== 0 && _react2.default.createElement(
1971
- 'strong',
1972
- null,
1973
- '+ '
1974
- ),
1975
- _react2.default.createElement(
1976
- 'span',
1977
- { style: { fontWeight: ii === 0 ? 'bold' : 'normal', whiteSpace: 'nowrap', color: ii === 0 || rsc.primaryKeyName && rsc.joinKeyName ? '#16325c' : '#c23934' } },
1978
- rsc.provider === step.destinationProvider ? rsc.name + ' (' + step.destinationProvider + ')' : rsc.name,
1979
- '\xA0'
1980
- )
1981
- );
1982
- })
1983
- )
1984
- ),
1985
- _react2.default.createElement(
1986
- 'div',
1987
- { style: { display: 'inline-block', verticalAlign: 'top', width: '120px' } },
1988
- group && group.resources && group.resources.length > 0 ? _react2.default.createElement(
1989
- 'div',
1990
- { className: 'connect-resource-group', onClick: function onClick(e) {
1991
- e.stopPropagation();
1992
- openConnectionModal(group, i);
1993
- }, style: { paddingTop: linked ? 5 : 6 } },
1994
- linked ? _react2.default.createElement(
1995
- 'svg',
1996
- { fill: '#000000', width: '29', height: '24', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' },
1997
- _react2.default.createElement('path', { d: 'M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z' })
1998
- ) : _react2.default.createElement(
1999
- 'svg',
2000
- { fill: '#AAAAAA', width: '24', height: '19', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' },
2001
- _react2.default.createElement('path', { d: 'M2,5.27L3.28,4L20,20.72L18.73,22L14.73,18H13V16.27L9.73,13H8V11.27L5.5,8.76C4.5,9.5 3.9,10.68 3.9,12C3.9,14.26 5.74,16.1 8,16.1H11V18H8A6,6 0 0,1 2,12C2,10.16 2.83,8.5 4.14,7.41L2,5.27M16,6A6,6 0 0,1 22,12C22,14.21 20.8,16.15 19,17.19L17.6,15.77C19.07,15.15 20.1,13.7 20.1,12C20.1,9.73 18.26,7.9 16,7.9H13V6H16M8,6H11V7.9H9.72L7.82,6H8M16,11V13H14.82L12.82,11H16Z' })
2002
- )
2003
- ) : null
2004
- ),
2005
- _react2.default.createElement(
2006
- 'div',
2007
- { style: { display: 'inline-block', verticalAlign: 'top', width: 'calc(50% - 120px)' } },
2008
- _react2.default.createElement(
2009
- 'div',
2010
- { className: 'remove-resource-group', onClick: function onClick(e) {
2011
- return removeResourceGroup(e, i);
2012
- } },
2013
- _react2.default.createElement(
2014
- 'svg',
2015
- { xmlns: 'http://www.w3.org/2000/svg', style: { width: 18, height: 18 }, viewBox: '0 0 60 60' },
2016
- _react2.default.createElement('path', { d: 'M 15.674663,15.572746 L 44.587629,44.485711 M 45.118838,15.420972 L 15.522889,45.016920' })
2017
- )
2018
- ),
2019
- _react2.default.createElement(
2020
- 'strong',
2021
- { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'block', paddingTop: 8 } },
2022
- group.name
2023
- )
2024
- )
2025
- )
2026
- )
2027
- );
2028
- })
2029
- )
2030
- );
2031
- }
2032
- }]);
2033
-
2034
- return BundleTable;
2035
- }(_react.Component);
2036
-
2037
- exports.default = BundleTable;
2038
-
2039
- /***/ },
2040
-
2041
- /***/ 149:
2042
- /***/ function(module, exports, __webpack_require__) {
2043
-
2044
- 'use strict';
2045
-
2046
- Object.defineProperty(exports, "__esModule", {
2047
- value: true
2048
- });
2049
-
2050
77
  var _react = __webpack_require__(2);
2051
78
 
2052
79
  var _react2 = _interopRequireDefault(_react);
@@ -2063,7 +90,7 @@ module.exports =
2063
90
 
2064
91
  /***/ },
2065
92
 
2066
- /***/ 150:
93
+ /***/ 149:
2067
94
  /***/ function(module, exports, __webpack_require__) {
2068
95
 
2069
96
  'use strict';
@@ -2088,7 +115,7 @@ module.exports =
2088
115
 
2089
116
  /***/ },
2090
117
 
2091
- /***/ 151:
118
+ /***/ 150:
2092
119
  /***/ function(module, exports, __webpack_require__) {
2093
120
 
2094
121
  'use strict';
@@ -2204,7 +231,7 @@ module.exports =
2204
231
 
2205
232
  /***/ },
2206
233
 
2207
- /***/ 152:
234
+ /***/ 151:
2208
235
  /***/ function(module, exports, __webpack_require__) {
2209
236
 
2210
237
  'use strict';
@@ -2264,7 +291,7 @@ module.exports =
2264
291
 
2265
292
  /***/ },
2266
293
 
2267
- /***/ 153:
294
+ /***/ 152:
2268
295
  /***/ function(module, exports, __webpack_require__) {
2269
296
 
2270
297
  'use strict';
@@ -2289,7 +316,7 @@ module.exports =
2289
316
 
2290
317
  /***/ },
2291
318
 
2292
- /***/ 154:
319
+ /***/ 153:
2293
320
  /***/ function(module, exports, __webpack_require__) {
2294
321
 
2295
322
  'use strict';
@@ -2414,7 +441,7 @@ module.exports =
2414
441
 
2415
442
  /***/ },
2416
443
 
2417
- /***/ 155:
444
+ /***/ 154:
2418
445
  /***/ function(module, exports, __webpack_require__) {
2419
446
 
2420
447
  'use strict';
@@ -2464,7 +491,7 @@ module.exports =
2464
491
 
2465
492
  /***/ },
2466
493
 
2467
- /***/ 156:
494
+ /***/ 155:
2468
495
  /***/ function(module, exports, __webpack_require__) {
2469
496
 
2470
497
  'use strict';
@@ -2496,7 +523,7 @@ module.exports =
2496
523
 
2497
524
  /***/ },
2498
525
 
2499
- /***/ 157:
526
+ /***/ 156:
2500
527
  /***/ function(module, exports, __webpack_require__) {
2501
528
 
2502
529
  'use strict';
@@ -2546,7 +573,7 @@ module.exports =
2546
573
 
2547
574
  /***/ },
2548
575
 
2549
- /***/ 158:
576
+ /***/ 157:
2550
577
  /***/ function(module, exports, __webpack_require__) {
2551
578
 
2552
579
  'use strict';
@@ -2555,7 +582,7 @@ module.exports =
2555
582
  value: true
2556
583
  });
2557
584
 
2558
- var _Button = __webpack_require__(149);
585
+ var _Button = __webpack_require__(148);
2559
586
 
2560
587
  Object.defineProperty(exports, 'Button', {
2561
588
  enumerable: true,
@@ -2564,7 +591,7 @@ module.exports =
2564
591
  }
2565
592
  });
2566
593
 
2567
- var _Radio = __webpack_require__(153);
594
+ var _Radio = __webpack_require__(152);
2568
595
 
2569
596
  Object.defineProperty(exports, 'Radio', {
2570
597
  enumerable: true,
@@ -2573,7 +600,7 @@ module.exports =
2573
600
  }
2574
601
  });
2575
602
 
2576
- var _Input = __webpack_require__(150);
603
+ var _Input = __webpack_require__(149);
2577
604
 
2578
605
  Object.defineProperty(exports, 'Input', {
2579
606
  enumerable: true,
@@ -2582,7 +609,7 @@ module.exports =
2582
609
  }
2583
610
  });
2584
611
 
2585
- var _Select = __webpack_require__(154);
612
+ var _Select = __webpack_require__(153);
2586
613
 
2587
614
  Object.defineProperty(exports, 'Select', {
2588
615
  enumerable: true,
@@ -2591,7 +618,7 @@ module.exports =
2591
618
  }
2592
619
  });
2593
620
 
2594
- var _Tooltip = __webpack_require__(157);
621
+ var _Tooltip = __webpack_require__(156);
2595
622
 
2596
623
  Object.defineProperty(exports, 'Tooltip', {
2597
624
  enumerable: true,
@@ -2600,7 +627,7 @@ module.exports =
2600
627
  }
2601
628
  });
2602
629
 
2603
- var _Spinner = __webpack_require__(156);
630
+ var _Spinner = __webpack_require__(155);
2604
631
 
2605
632
  Object.defineProperty(exports, 'Spinner', {
2606
633
  enumerable: true,
@@ -2609,7 +636,7 @@ module.exports =
2609
636
  }
2610
637
  });
2611
638
 
2612
- var _Modal = __webpack_require__(152);
639
+ var _Modal = __webpack_require__(151);
2613
640
 
2614
641
  Object.defineProperty(exports, 'Modal', {
2615
642
  enumerable: true,
@@ -2618,7 +645,7 @@ module.exports =
2618
645
  }
2619
646
  });
2620
647
 
2621
- var _Sidebar = __webpack_require__(155);
648
+ var _Sidebar = __webpack_require__(154);
2622
649
 
2623
650
  Object.defineProperty(exports, 'Sidebar', {
2624
651
  enumerable: true,
@@ -2627,7 +654,7 @@ module.exports =
2627
654
  }
2628
655
  });
2629
656
 
2630
- var _MapTable = __webpack_require__(151);
657
+ var _MapTable = __webpack_require__(150);
2631
658
 
2632
659
  Object.defineProperty(exports, 'MapTable', {
2633
660
  enumerable: true,
@@ -2636,16 +663,7 @@ module.exports =
2636
663
  }
2637
664
  });
2638
665
 
2639
- var _BundleTable = __webpack_require__(148);
2640
-
2641
- Object.defineProperty(exports, 'BundleTable', {
2642
- enumerable: true,
2643
- get: function get() {
2644
- return _interopRequireDefault(_BundleTable).default;
2645
- }
2646
- });
2647
-
2648
- var _rfInput = __webpack_require__(159);
666
+ var _rfInput = __webpack_require__(158);
2649
667
 
2650
668
  Object.defineProperty(exports, 'rfInput', {
2651
669
  enumerable: true,
@@ -2654,7 +672,7 @@ module.exports =
2654
672
  }
2655
673
  });
2656
674
 
2657
- var _rfRadioGroup = __webpack_require__(160);
675
+ var _rfRadioGroup = __webpack_require__(159);
2658
676
 
2659
677
  Object.defineProperty(exports, 'rfRadioGroup', {
2660
678
  enumerable: true,
@@ -2663,7 +681,7 @@ module.exports =
2663
681
  }
2664
682
  });
2665
683
 
2666
- var _rfSelect = __webpack_require__(161);
684
+ var _rfSelect = __webpack_require__(160);
2667
685
 
2668
686
  Object.defineProperty(exports, 'rfSelect', {
2669
687
  enumerable: true,
@@ -2672,7 +690,7 @@ module.exports =
2672
690
  }
2673
691
  });
2674
692
 
2675
- var _theme = __webpack_require__(239);
693
+ var _theme = __webpack_require__(237);
2676
694
 
2677
695
  Object.defineProperty(exports, 'styles', {
2678
696
  enumerable: true,
@@ -2685,7 +703,7 @@ module.exports =
2685
703
 
2686
704
  /***/ },
2687
705
 
2688
- /***/ 159:
706
+ /***/ 158:
2689
707
  /***/ function(module, exports, __webpack_require__) {
2690
708
 
2691
709
  'use strict';
@@ -2736,7 +754,7 @@ module.exports =
2736
754
 
2737
755
  /***/ },
2738
756
 
2739
- /***/ 160:
757
+ /***/ 159:
2740
758
  /***/ function(module, exports, __webpack_require__) {
2741
759
 
2742
760
  'use strict';
@@ -2777,7 +795,7 @@ module.exports =
2777
795
 
2778
796
  /***/ },
2779
797
 
2780
- /***/ 161:
798
+ /***/ 160:
2781
799
  /***/ function(module, exports, __webpack_require__) {
2782
800
 
2783
801
  'use strict';
@@ -2850,7 +868,7 @@ module.exports =
2850
868
 
2851
869
  /***/ },
2852
870
 
2853
- /***/ 239:
871
+ /***/ 237:
2854
872
  /***/ function(module, exports) {
2855
873
 
2856
874
  // removed by extract-text-webpack-plugin