@innovastudio/contentbuilder 1.5.23 → 1.5.25
Sign up to get free protection for your applications and to get access to all the features.
@@ -14072,33 +14072,27 @@ const renderGridEditor = builder => {
|
|
14072
14072
|
};
|
14073
14073
|
|
14074
14074
|
/**!
|
14075
|
-
* Sortable 1.
|
14075
|
+
* Sortable 1.15.2
|
14076
14076
|
* @author RubaXa <trash@rubaxa.org>
|
14077
14077
|
* @author owenm <owen23355@gmail.com>
|
14078
14078
|
* @license MIT
|
14079
14079
|
*/
|
14080
14080
|
function ownKeys$1(object, enumerableOnly) {
|
14081
14081
|
var keys = Object.keys(object);
|
14082
|
-
|
14083
14082
|
if (Object.getOwnPropertySymbols) {
|
14084
14083
|
var symbols = Object.getOwnPropertySymbols(object);
|
14085
|
-
|
14086
14084
|
if (enumerableOnly) {
|
14087
14085
|
symbols = symbols.filter(function (sym) {
|
14088
14086
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
14089
14087
|
});
|
14090
14088
|
}
|
14091
|
-
|
14092
14089
|
keys.push.apply(keys, symbols);
|
14093
14090
|
}
|
14094
|
-
|
14095
14091
|
return keys;
|
14096
14092
|
}
|
14097
|
-
|
14098
14093
|
function _objectSpread2$1(target) {
|
14099
14094
|
for (var i = 1; i < arguments.length; i++) {
|
14100
14095
|
var source = arguments[i] != null ? arguments[i] : {};
|
14101
|
-
|
14102
14096
|
if (i % 2) {
|
14103
14097
|
ownKeys$1(Object(source), true).forEach(function (key) {
|
14104
14098
|
_defineProperty$1(target, key, source[key]);
|
@@ -14111,10 +14105,8 @@ function _objectSpread2$1(target) {
|
|
14111
14105
|
});
|
14112
14106
|
}
|
14113
14107
|
}
|
14114
|
-
|
14115
14108
|
return target;
|
14116
14109
|
}
|
14117
|
-
|
14118
14110
|
function _typeof$1(obj) {
|
14119
14111
|
"@babel/helpers - typeof";
|
14120
14112
|
|
@@ -14127,10 +14119,8 @@ function _typeof$1(obj) {
|
|
14127
14119
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
14128
14120
|
};
|
14129
14121
|
}
|
14130
|
-
|
14131
14122
|
return _typeof$1(obj);
|
14132
14123
|
}
|
14133
|
-
|
14134
14124
|
function _defineProperty$1(obj, key, value) {
|
14135
14125
|
if (key in obj) {
|
14136
14126
|
Object.defineProperty(obj, key, {
|
@@ -14142,53 +14132,40 @@ function _defineProperty$1(obj, key, value) {
|
|
14142
14132
|
} else {
|
14143
14133
|
obj[key] = value;
|
14144
14134
|
}
|
14145
|
-
|
14146
14135
|
return obj;
|
14147
14136
|
}
|
14148
|
-
|
14149
14137
|
function _extends() {
|
14150
14138
|
_extends = Object.assign || function (target) {
|
14151
14139
|
for (var i = 1; i < arguments.length; i++) {
|
14152
14140
|
var source = arguments[i];
|
14153
|
-
|
14154
14141
|
for (var key in source) {
|
14155
14142
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
14156
14143
|
target[key] = source[key];
|
14157
14144
|
}
|
14158
14145
|
}
|
14159
14146
|
}
|
14160
|
-
|
14161
14147
|
return target;
|
14162
14148
|
};
|
14163
|
-
|
14164
14149
|
return _extends.apply(this, arguments);
|
14165
14150
|
}
|
14166
|
-
|
14167
14151
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
14168
14152
|
if (source == null) return {};
|
14169
14153
|
var target = {};
|
14170
14154
|
var sourceKeys = Object.keys(source);
|
14171
14155
|
var key, i;
|
14172
|
-
|
14173
14156
|
for (i = 0; i < sourceKeys.length; i++) {
|
14174
14157
|
key = sourceKeys[i];
|
14175
14158
|
if (excluded.indexOf(key) >= 0) continue;
|
14176
14159
|
target[key] = source[key];
|
14177
14160
|
}
|
14178
|
-
|
14179
14161
|
return target;
|
14180
14162
|
}
|
14181
|
-
|
14182
14163
|
function _objectWithoutProperties(source, excluded) {
|
14183
14164
|
if (source == null) return {};
|
14184
|
-
|
14185
14165
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
14186
|
-
|
14187
14166
|
var key, i;
|
14188
|
-
|
14189
14167
|
if (Object.getOwnPropertySymbols) {
|
14190
14168
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
14191
|
-
|
14192
14169
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
14193
14170
|
key = sourceSymbolKeys[i];
|
14194
14171
|
if (excluded.indexOf(key) >= 0) continue;
|
@@ -14196,18 +14173,16 @@ function _objectWithoutProperties(source, excluded) {
|
|
14196
14173
|
target[key] = source[key];
|
14197
14174
|
}
|
14198
14175
|
}
|
14199
|
-
|
14200
14176
|
return target;
|
14201
14177
|
}
|
14202
14178
|
|
14203
|
-
var version$1 = "1.
|
14179
|
+
var version$1 = "1.15.2";
|
14204
14180
|
|
14205
14181
|
function userAgent(pattern) {
|
14206
14182
|
if (typeof window !== 'undefined' && window.navigator) {
|
14207
14183
|
return !! /*@__PURE__*/navigator.userAgent.match(pattern);
|
14208
14184
|
}
|
14209
14185
|
}
|
14210
|
-
|
14211
14186
|
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
|
14212
14187
|
var Edge = userAgent(/Edge/i);
|
14213
14188
|
var FireFox = userAgent(/firefox/i);
|
@@ -14219,23 +14194,15 @@ var captureMode = {
|
|
14219
14194
|
capture: false,
|
14220
14195
|
passive: false
|
14221
14196
|
};
|
14222
|
-
|
14223
14197
|
function on(el, event, fn) {
|
14224
14198
|
el.addEventListener(event, fn, !IE11OrLess && captureMode);
|
14225
14199
|
}
|
14226
|
-
|
14227
14200
|
function off(el, event, fn) {
|
14228
14201
|
el.removeEventListener(event, fn, !IE11OrLess && captureMode);
|
14229
14202
|
}
|
14230
|
-
|
14231
|
-
function matches(
|
14232
|
-
/**HTMLElement*/
|
14233
|
-
el,
|
14234
|
-
/**String*/
|
14235
|
-
selector) {
|
14203
|
+
function matches( /**HTMLElement*/el, /**String*/selector) {
|
14236
14204
|
if (!selector) return;
|
14237
14205
|
selector[0] === '>' && (selector = selector.substring(1));
|
14238
|
-
|
14239
14206
|
if (el) {
|
14240
14207
|
try {
|
14241
14208
|
if (el.matches) {
|
@@ -14249,39 +14216,25 @@ selector) {
|
|
14249
14216
|
return false;
|
14250
14217
|
}
|
14251
14218
|
}
|
14252
|
-
|
14253
14219
|
return false;
|
14254
14220
|
}
|
14255
|
-
|
14256
14221
|
function getParentOrHost(el) {
|
14257
14222
|
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
14258
14223
|
}
|
14259
|
-
|
14260
|
-
function closest(
|
14261
|
-
/**HTMLElement*/
|
14262
|
-
el,
|
14263
|
-
/**String*/
|
14264
|
-
selector,
|
14265
|
-
/**HTMLElement*/
|
14266
|
-
ctx, includeCTX) {
|
14224
|
+
function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
|
14267
14225
|
if (el) {
|
14268
14226
|
ctx = ctx || document;
|
14269
|
-
|
14270
14227
|
do {
|
14271
14228
|
if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
|
14272
14229
|
return el;
|
14273
14230
|
}
|
14274
|
-
|
14275
14231
|
if (el === ctx) break;
|
14276
14232
|
/* jshint boss:true */
|
14277
14233
|
} while (el = getParentOrHost(el));
|
14278
14234
|
}
|
14279
|
-
|
14280
14235
|
return null;
|
14281
14236
|
}
|
14282
|
-
|
14283
14237
|
var R_SPACE = /\s+/g;
|
14284
|
-
|
14285
14238
|
function toggleClass$1(el, name, state) {
|
14286
14239
|
if (el && name) {
|
14287
14240
|
if (el.classList) {
|
@@ -14292,10 +14245,8 @@ function toggleClass$1(el, name, state) {
|
|
14292
14245
|
}
|
14293
14246
|
}
|
14294
14247
|
}
|
14295
|
-
|
14296
14248
|
function css(el, prop, val) {
|
14297
14249
|
var style = el && el.style;
|
14298
|
-
|
14299
14250
|
if (style) {
|
14300
14251
|
if (val === void 0) {
|
14301
14252
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
@@ -14303,83 +14254,67 @@ function css(el, prop, val) {
|
|
14303
14254
|
} else if (el.currentStyle) {
|
14304
14255
|
val = el.currentStyle;
|
14305
14256
|
}
|
14306
|
-
|
14307
14257
|
return prop === void 0 ? val : val[prop];
|
14308
14258
|
} else {
|
14309
14259
|
if (!(prop in style) && prop.indexOf('webkit') === -1) {
|
14310
14260
|
prop = '-webkit-' + prop;
|
14311
14261
|
}
|
14312
|
-
|
14313
14262
|
style[prop] = val + (typeof val === 'string' ? '' : 'px');
|
14314
14263
|
}
|
14315
14264
|
}
|
14316
14265
|
}
|
14317
|
-
|
14318
14266
|
function matrix(el, selfOnly) {
|
14319
14267
|
var appliedTransforms = '';
|
14320
|
-
|
14321
14268
|
if (typeof el === 'string') {
|
14322
14269
|
appliedTransforms = el;
|
14323
14270
|
} else {
|
14324
14271
|
do {
|
14325
14272
|
var transform = css(el, 'transform');
|
14326
|
-
|
14327
14273
|
if (transform && transform !== 'none') {
|
14328
14274
|
appliedTransforms = transform + ' ' + appliedTransforms;
|
14329
14275
|
}
|
14330
14276
|
/* jshint boss:true */
|
14331
|
-
|
14332
14277
|
} while (!selfOnly && (el = el.parentNode));
|
14333
14278
|
}
|
14334
|
-
|
14335
14279
|
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
14336
14280
|
/*jshint -W056 */
|
14337
|
-
|
14338
14281
|
return matrixFn && new matrixFn(appliedTransforms);
|
14339
14282
|
}
|
14340
|
-
|
14341
14283
|
function find$2(ctx, tagName, iterator) {
|
14342
14284
|
if (ctx) {
|
14343
14285
|
var list = ctx.getElementsByTagName(tagName),
|
14344
|
-
|
14345
|
-
|
14346
|
-
|
14286
|
+
i = 0,
|
14287
|
+
n = list.length;
|
14347
14288
|
if (iterator) {
|
14348
14289
|
for (; i < n; i++) {
|
14349
14290
|
iterator(list[i], i);
|
14350
14291
|
}
|
14351
14292
|
}
|
14352
|
-
|
14353
14293
|
return list;
|
14354
14294
|
}
|
14355
|
-
|
14356
14295
|
return [];
|
14357
14296
|
}
|
14358
|
-
|
14359
14297
|
function getWindowScrollingElement() {
|
14360
14298
|
var scrollingElement = document.scrollingElement;
|
14361
|
-
|
14362
14299
|
if (scrollingElement) {
|
14363
14300
|
return scrollingElement;
|
14364
14301
|
} else {
|
14365
14302
|
return document.documentElement;
|
14366
14303
|
}
|
14367
14304
|
}
|
14368
|
-
/**
|
14369
|
-
* Returns the "bounding client rect" of given element
|
14370
|
-
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
14371
|
-
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
14372
|
-
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
14373
|
-
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
14374
|
-
* @param {[HTMLElement]} container The parent the element will be placed in
|
14375
|
-
* @return {Object} The boundingClientRect of el, with specified adjustments
|
14376
|
-
*/
|
14377
|
-
|
14378
14305
|
|
14306
|
+
/**
|
14307
|
+
* Returns the "bounding client rect" of given element
|
14308
|
+
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
14309
|
+
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
14310
|
+
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
14311
|
+
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
14312
|
+
* @param {[HTMLElement]} container The parent the element will be placed in
|
14313
|
+
* @return {Object} The boundingClientRect of el, with specified adjustments
|
14314
|
+
*/
|
14379
14315
|
function getRect$1(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
|
14380
14316
|
if (!el.getBoundingClientRect && el !== window) return;
|
14381
14317
|
var elRect, top, left, bottom, right, height, width;
|
14382
|
-
|
14383
14318
|
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
|
14384
14319
|
elRect = el.getBoundingClientRect();
|
14385
14320
|
top = elRect.top;
|
@@ -14396,17 +14331,18 @@ function getRect$1(el, relativeToContainingBlock, relativeToNonStaticParent, und
|
|
14396
14331
|
height = window.innerHeight;
|
14397
14332
|
width = window.innerWidth;
|
14398
14333
|
}
|
14399
|
-
|
14400
14334
|
if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
|
14401
14335
|
// Adjust for translate()
|
14402
|
-
container = container || el.parentNode;
|
14403
|
-
// Not needed on <= IE11
|
14336
|
+
container = container || el.parentNode;
|
14404
14337
|
|
14338
|
+
// solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
|
14339
|
+
// Not needed on <= IE11
|
14405
14340
|
if (!IE11OrLess) {
|
14406
14341
|
do {
|
14407
14342
|
if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
|
14408
|
-
var containerRect = container.getBoundingClientRect();
|
14343
|
+
var containerRect = container.getBoundingClientRect();
|
14409
14344
|
|
14345
|
+
// Set relative to edges of padding box of container
|
14410
14346
|
top -= containerRect.top + parseInt(css(container, 'border-top-width'));
|
14411
14347
|
left -= containerRect.left + parseInt(css(container, 'border-left-width'));
|
14412
14348
|
bottom = top + elRect.height;
|
@@ -14414,17 +14350,14 @@ function getRect$1(el, relativeToContainingBlock, relativeToNonStaticParent, und
|
|
14414
14350
|
break;
|
14415
14351
|
}
|
14416
14352
|
/* jshint boss:true */
|
14417
|
-
|
14418
14353
|
} while (container = container.parentNode);
|
14419
14354
|
}
|
14420
14355
|
}
|
14421
|
-
|
14422
14356
|
if (undoScale && el !== window) {
|
14423
14357
|
// Adjust for scale()
|
14424
14358
|
var elMatrix = matrix(container || el),
|
14425
|
-
|
14426
|
-
|
14427
|
-
|
14359
|
+
scaleX = elMatrix && elMatrix.a,
|
14360
|
+
scaleY = elMatrix && elMatrix.d;
|
14428
14361
|
if (elMatrix) {
|
14429
14362
|
top /= scaleY;
|
14430
14363
|
left /= scaleX;
|
@@ -14434,7 +14367,6 @@ function getRect$1(el, relativeToContainingBlock, relativeToNonStaticParent, und
|
|
14434
14367
|
right = left + width;
|
14435
14368
|
}
|
14436
14369
|
}
|
14437
|
-
|
14438
14370
|
return {
|
14439
14371
|
top: top,
|
14440
14372
|
left: left,
|
@@ -14444,165 +14376,140 @@ function getRect$1(el, relativeToContainingBlock, relativeToNonStaticParent, und
|
|
14444
14376
|
height: height
|
14445
14377
|
};
|
14446
14378
|
}
|
14447
|
-
/**
|
14448
|
-
* Checks if a side of an element is scrolled past a side of its parents
|
14449
|
-
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
14450
|
-
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
14451
|
-
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
14452
|
-
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
14453
|
-
*/
|
14454
|
-
|
14455
14379
|
|
14380
|
+
/**
|
14381
|
+
* Checks if a side of an element is scrolled past a side of its parents
|
14382
|
+
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
14383
|
+
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
14384
|
+
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
14385
|
+
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
14386
|
+
*/
|
14456
14387
|
function isScrolledPast(el, elSide, parentSide) {
|
14457
14388
|
var parent = getParentAutoScrollElement(el, true),
|
14458
|
-
|
14459
|
-
/* jshint boss:true */
|
14389
|
+
elSideVal = getRect$1(el)[elSide];
|
14460
14390
|
|
14391
|
+
/* jshint boss:true */
|
14461
14392
|
while (parent) {
|
14462
14393
|
var parentSideVal = getRect$1(parent)[parentSide],
|
14463
|
-
|
14464
|
-
|
14394
|
+
visible = void 0;
|
14465
14395
|
if (parentSide === 'top' || parentSide === 'left') {
|
14466
14396
|
visible = elSideVal >= parentSideVal;
|
14467
14397
|
} else {
|
14468
14398
|
visible = elSideVal <= parentSideVal;
|
14469
14399
|
}
|
14470
|
-
|
14471
14400
|
if (!visible) return parent;
|
14472
14401
|
if (parent === getWindowScrollingElement()) break;
|
14473
14402
|
parent = getParentAutoScrollElement(parent, false);
|
14474
14403
|
}
|
14475
|
-
|
14476
14404
|
return false;
|
14477
14405
|
}
|
14478
|
-
/**
|
14479
|
-
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
14480
|
-
* and non-draggable elements
|
14481
|
-
* @param {HTMLElement} el The parent element
|
14482
|
-
* @param {Number} childNum The index of the child
|
14483
|
-
* @param {Object} options Parent Sortable's options
|
14484
|
-
* @return {HTMLElement} The child at index childNum, or null if not found
|
14485
|
-
*/
|
14486
|
-
|
14487
14406
|
|
14407
|
+
/**
|
14408
|
+
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
14409
|
+
* and non-draggable elements
|
14410
|
+
* @param {HTMLElement} el The parent element
|
14411
|
+
* @param {Number} childNum The index of the child
|
14412
|
+
* @param {Object} options Parent Sortable's options
|
14413
|
+
* @return {HTMLElement} The child at index childNum, or null if not found
|
14414
|
+
*/
|
14488
14415
|
function getChild(el, childNum, options, includeDragEl) {
|
14489
14416
|
var currentChild = 0,
|
14490
|
-
|
14491
|
-
|
14492
|
-
|
14417
|
+
i = 0,
|
14418
|
+
children = el.children;
|
14493
14419
|
while (i < children.length) {
|
14494
14420
|
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
|
14495
14421
|
if (currentChild === childNum) {
|
14496
14422
|
return children[i];
|
14497
14423
|
}
|
14498
|
-
|
14499
14424
|
currentChild++;
|
14500
14425
|
}
|
14501
|
-
|
14502
14426
|
i++;
|
14503
14427
|
}
|
14504
|
-
|
14505
14428
|
return null;
|
14506
14429
|
}
|
14507
|
-
/**
|
14508
|
-
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
14509
|
-
* @param {HTMLElement} el Parent element
|
14510
|
-
* @param {selector} selector Any other elements that should be ignored
|
14511
|
-
* @return {HTMLElement} The last child, ignoring ghostEl
|
14512
|
-
*/
|
14513
|
-
|
14514
14430
|
|
14431
|
+
/**
|
14432
|
+
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
14433
|
+
* @param {HTMLElement} el Parent element
|
14434
|
+
* @param {selector} selector Any other elements that should be ignored
|
14435
|
+
* @return {HTMLElement} The last child, ignoring ghostEl
|
14436
|
+
*/
|
14515
14437
|
function lastChild(el, selector) {
|
14516
14438
|
var last = el.lastElementChild;
|
14517
|
-
|
14518
14439
|
while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
|
14519
14440
|
last = last.previousElementSibling;
|
14520
14441
|
}
|
14521
|
-
|
14522
14442
|
return last || null;
|
14523
14443
|
}
|
14524
|
-
/**
|
14525
|
-
* Returns the index of an element within its parent for a selected set of
|
14526
|
-
* elements
|
14527
|
-
* @param {HTMLElement} el
|
14528
|
-
* @param {selector} selector
|
14529
|
-
* @return {number}
|
14530
|
-
*/
|
14531
|
-
|
14532
14444
|
|
14445
|
+
/**
|
14446
|
+
* Returns the index of an element within its parent for a selected set of
|
14447
|
+
* elements
|
14448
|
+
* @param {HTMLElement} el
|
14449
|
+
* @param {selector} selector
|
14450
|
+
* @return {number}
|
14451
|
+
*/
|
14533
14452
|
function index(el, selector) {
|
14534
14453
|
var index = 0;
|
14535
|
-
|
14536
14454
|
if (!el || !el.parentNode) {
|
14537
14455
|
return -1;
|
14538
14456
|
}
|
14539
|
-
/* jshint boss:true */
|
14540
|
-
|
14541
14457
|
|
14458
|
+
/* jshint boss:true */
|
14542
14459
|
while (el = el.previousElementSibling) {
|
14543
14460
|
if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
|
14544
14461
|
index++;
|
14545
14462
|
}
|
14546
14463
|
}
|
14547
|
-
|
14548
14464
|
return index;
|
14549
14465
|
}
|
14550
|
-
/**
|
14551
|
-
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
14552
|
-
* The value is returned in real pixels.
|
14553
|
-
* @param {HTMLElement} el
|
14554
|
-
* @return {Array} Offsets in the format of [left, top]
|
14555
|
-
*/
|
14556
|
-
|
14557
14466
|
|
14467
|
+
/**
|
14468
|
+
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
14469
|
+
* The value is returned in real pixels.
|
14470
|
+
* @param {HTMLElement} el
|
14471
|
+
* @return {Array} Offsets in the format of [left, top]
|
14472
|
+
*/
|
14558
14473
|
function getRelativeScrollOffset(el) {
|
14559
14474
|
var offsetLeft = 0,
|
14560
|
-
|
14561
|
-
|
14562
|
-
|
14475
|
+
offsetTop = 0,
|
14476
|
+
winScroller = getWindowScrollingElement();
|
14563
14477
|
if (el) {
|
14564
14478
|
do {
|
14565
14479
|
var elMatrix = matrix(el),
|
14566
|
-
|
14567
|
-
|
14480
|
+
scaleX = elMatrix.a,
|
14481
|
+
scaleY = elMatrix.d;
|
14568
14482
|
offsetLeft += el.scrollLeft * scaleX;
|
14569
14483
|
offsetTop += el.scrollTop * scaleY;
|
14570
14484
|
} while (el !== winScroller && (el = el.parentNode));
|
14571
14485
|
}
|
14572
|
-
|
14573
14486
|
return [offsetLeft, offsetTop];
|
14574
14487
|
}
|
14575
|
-
/**
|
14576
|
-
* Returns the index of the object within the given array
|
14577
|
-
* @param {Array} arr Array that may or may not hold the object
|
14578
|
-
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
14579
|
-
* @return {Number} The index of the object in the array, or -1
|
14580
|
-
*/
|
14581
|
-
|
14582
14488
|
|
14489
|
+
/**
|
14490
|
+
* Returns the index of the object within the given array
|
14491
|
+
* @param {Array} arr Array that may or may not hold the object
|
14492
|
+
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
14493
|
+
* @return {Number} The index of the object in the array, or -1
|
14494
|
+
*/
|
14583
14495
|
function indexOfObject(arr, obj) {
|
14584
14496
|
for (var i in arr) {
|
14585
14497
|
if (!arr.hasOwnProperty(i)) continue;
|
14586
|
-
|
14587
14498
|
for (var key in obj) {
|
14588
14499
|
if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
|
14589
14500
|
}
|
14590
14501
|
}
|
14591
|
-
|
14592
14502
|
return -1;
|
14593
14503
|
}
|
14594
|
-
|
14595
14504
|
function getParentAutoScrollElement(el, includeSelf) {
|
14596
14505
|
// skip to window
|
14597
14506
|
if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
|
14598
14507
|
var elem = el;
|
14599
14508
|
var gotSelf = false;
|
14600
|
-
|
14601
14509
|
do {
|
14602
14510
|
// we don't need to get elem css if it isn't even overflowing in the first place (performance)
|
14603
14511
|
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
|
14604
14512
|
var elemCSS = css(elem);
|
14605
|
-
|
14606
14513
|
if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
|
14607
14514
|
if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
|
14608
14515
|
if (gotSelf || includeSelf) return elem;
|
@@ -14610,12 +14517,9 @@ function getParentAutoScrollElement(el, includeSelf) {
|
|
14610
14517
|
}
|
14611
14518
|
}
|
14612
14519
|
/* jshint boss:true */
|
14613
|
-
|
14614
14520
|
} while (elem = elem.parentNode);
|
14615
|
-
|
14616
14521
|
return getWindowScrollingElement();
|
14617
14522
|
}
|
14618
|
-
|
14619
14523
|
function extend(dst, src) {
|
14620
14524
|
if (dst && src) {
|
14621
14525
|
for (var key in src) {
|
@@ -14624,49 +14528,39 @@ function extend(dst, src) {
|
|
14624
14528
|
}
|
14625
14529
|
}
|
14626
14530
|
}
|
14627
|
-
|
14628
14531
|
return dst;
|
14629
14532
|
}
|
14630
|
-
|
14631
14533
|
function isRectEqual(rect1, rect2) {
|
14632
14534
|
return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
|
14633
14535
|
}
|
14634
|
-
|
14635
14536
|
var _throttleTimeout;
|
14636
|
-
|
14637
14537
|
function throttle$1(callback, ms) {
|
14638
14538
|
return function () {
|
14639
14539
|
if (!_throttleTimeout) {
|
14640
14540
|
var args = arguments,
|
14641
|
-
|
14642
|
-
|
14541
|
+
_this = this;
|
14643
14542
|
if (args.length === 1) {
|
14644
14543
|
callback.call(_this, args[0]);
|
14645
14544
|
} else {
|
14646
14545
|
callback.apply(_this, args);
|
14647
14546
|
}
|
14648
|
-
|
14649
14547
|
_throttleTimeout = setTimeout(function () {
|
14650
14548
|
_throttleTimeout = void 0;
|
14651
14549
|
}, ms);
|
14652
14550
|
}
|
14653
14551
|
};
|
14654
14552
|
}
|
14655
|
-
|
14656
14553
|
function cancelThrottle() {
|
14657
14554
|
clearTimeout(_throttleTimeout);
|
14658
14555
|
_throttleTimeout = void 0;
|
14659
14556
|
}
|
14660
|
-
|
14661
14557
|
function scrollBy(el, x, y) {
|
14662
14558
|
el.scrollLeft += x;
|
14663
14559
|
el.scrollTop += y;
|
14664
14560
|
}
|
14665
|
-
|
14666
14561
|
function clone(el) {
|
14667
14562
|
var Polymer = window.Polymer;
|
14668
14563
|
var $ = window.jQuery || window.Zepto;
|
14669
|
-
|
14670
14564
|
if (Polymer && Polymer.dom) {
|
14671
14565
|
return Polymer.dom(el).cloneNode(true);
|
14672
14566
|
} else if ($) {
|
@@ -14675,12 +14569,28 @@ function clone(el) {
|
|
14675
14569
|
return el.cloneNode(true);
|
14676
14570
|
}
|
14677
14571
|
}
|
14678
|
-
|
14572
|
+
function getChildContainingRectFromElement(container, options, ghostEl) {
|
14573
|
+
var rect = {};
|
14574
|
+
Array.from(container.children).forEach(function (child) {
|
14575
|
+
var _rect$left, _rect$top, _rect$right, _rect$bottom;
|
14576
|
+
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
|
14577
|
+
var childRect = getRect$1(child);
|
14578
|
+
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
|
14579
|
+
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
|
14580
|
+
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
|
14581
|
+
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
|
14582
|
+
});
|
14583
|
+
rect.width = rect.right - rect.left;
|
14584
|
+
rect.height = rect.bottom - rect.top;
|
14585
|
+
rect.x = rect.left;
|
14586
|
+
rect.y = rect.top;
|
14587
|
+
return rect;
|
14588
|
+
}
|
14679
14589
|
var expando = 'Sortable' + new Date().getTime();
|
14680
14590
|
|
14681
14591
|
function AnimationStateManager() {
|
14682
14592
|
var animationStates = [],
|
14683
|
-
|
14593
|
+
animationCallbackId;
|
14684
14594
|
return {
|
14685
14595
|
captureAnimationState: function captureAnimationState() {
|
14686
14596
|
animationStates = [];
|
@@ -14692,19 +14602,16 @@ function AnimationStateManager() {
|
|
14692
14602
|
target: child,
|
14693
14603
|
rect: getRect$1(child)
|
14694
14604
|
});
|
14605
|
+
var fromRect = _objectSpread2$1({}, animationStates[animationStates.length - 1].rect);
|
14695
14606
|
|
14696
|
-
|
14697
|
-
|
14698
|
-
|
14607
|
+
// If animating: compensate for current animation
|
14699
14608
|
if (child.thisAnimationDuration) {
|
14700
14609
|
var childMatrix = matrix(child, true);
|
14701
|
-
|
14702
14610
|
if (childMatrix) {
|
14703
14611
|
fromRect.top -= childMatrix.f;
|
14704
14612
|
fromRect.left -= childMatrix.e;
|
14705
14613
|
}
|
14706
14614
|
}
|
14707
|
-
|
14708
14615
|
child.fromRect = fromRect;
|
14709
14616
|
});
|
14710
14617
|
},
|
@@ -14718,54 +14625,47 @@ function AnimationStateManager() {
|
|
14718
14625
|
},
|
14719
14626
|
animateAll: function animateAll(callback) {
|
14720
14627
|
var _this = this;
|
14721
|
-
|
14722
14628
|
if (!this.options.animation) {
|
14723
14629
|
clearTimeout(animationCallbackId);
|
14724
14630
|
if (typeof callback === 'function') callback();
|
14725
14631
|
return;
|
14726
14632
|
}
|
14727
|
-
|
14728
14633
|
var animating = false,
|
14729
|
-
|
14634
|
+
animationTime = 0;
|
14730
14635
|
animationStates.forEach(function (state) {
|
14731
14636
|
var time = 0,
|
14732
|
-
|
14733
|
-
|
14734
|
-
|
14735
|
-
|
14736
|
-
|
14737
|
-
|
14738
|
-
|
14739
|
-
|
14637
|
+
target = state.target,
|
14638
|
+
fromRect = target.fromRect,
|
14639
|
+
toRect = getRect$1(target),
|
14640
|
+
prevFromRect = target.prevFromRect,
|
14641
|
+
prevToRect = target.prevToRect,
|
14642
|
+
animatingRect = state.rect,
|
14643
|
+
targetMatrix = matrix(target, true);
|
14740
14644
|
if (targetMatrix) {
|
14741
14645
|
// Compensate for current animation
|
14742
14646
|
toRect.top -= targetMatrix.f;
|
14743
14647
|
toRect.left -= targetMatrix.e;
|
14744
14648
|
}
|
14745
|
-
|
14746
14649
|
target.toRect = toRect;
|
14747
|
-
|
14748
14650
|
if (target.thisAnimationDuration) {
|
14749
14651
|
// Could also check if animatingRect is between fromRect and toRect
|
14750
|
-
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
14652
|
+
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
14653
|
+
// Make sure animatingRect is on line between toRect & fromRect
|
14751
14654
|
(animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
|
14752
14655
|
// If returning to same place as started from animation and on same axis
|
14753
14656
|
time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
|
14754
14657
|
}
|
14755
|
-
}
|
14756
|
-
|
14658
|
+
}
|
14757
14659
|
|
14660
|
+
// if fromRect != toRect: animate
|
14758
14661
|
if (!isRectEqual(toRect, fromRect)) {
|
14759
14662
|
target.prevFromRect = fromRect;
|
14760
14663
|
target.prevToRect = toRect;
|
14761
|
-
|
14762
14664
|
if (!time) {
|
14763
14665
|
time = _this.options.animation;
|
14764
14666
|
}
|
14765
|
-
|
14766
14667
|
_this.animate(target, animatingRect, toRect, time);
|
14767
14668
|
}
|
14768
|
-
|
14769
14669
|
if (time) {
|
14770
14670
|
animating = true;
|
14771
14671
|
animationTime = Math.max(animationTime, time);
|
@@ -14781,7 +14681,6 @@ function AnimationStateManager() {
|
|
14781
14681
|
}
|
14782
14682
|
});
|
14783
14683
|
clearTimeout(animationCallbackId);
|
14784
|
-
|
14785
14684
|
if (!animating) {
|
14786
14685
|
if (typeof callback === 'function') callback();
|
14787
14686
|
} else {
|
@@ -14789,7 +14688,6 @@ function AnimationStateManager() {
|
|
14789
14688
|
if (typeof callback === 'function') callback();
|
14790
14689
|
}, animationTime);
|
14791
14690
|
}
|
14792
|
-
|
14793
14691
|
animationStates = [];
|
14794
14692
|
},
|
14795
14693
|
animate: function animate(target, currentRect, toRect, duration) {
|
@@ -14797,10 +14695,10 @@ function AnimationStateManager() {
|
|
14797
14695
|
css(target, 'transition', '');
|
14798
14696
|
css(target, 'transform', '');
|
14799
14697
|
var elMatrix = matrix(this.el),
|
14800
|
-
|
14801
|
-
|
14802
|
-
|
14803
|
-
|
14698
|
+
scaleX = elMatrix && elMatrix.a,
|
14699
|
+
scaleY = elMatrix && elMatrix.d,
|
14700
|
+
translateX = (currentRect.left - toRect.left) / (scaleX || 1),
|
14701
|
+
translateY = (currentRect.top - toRect.top) / (scaleY || 1);
|
14804
14702
|
target.animatingX = !!translateX;
|
14805
14703
|
target.animatingY = !!translateY;
|
14806
14704
|
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
|
@@ -14820,11 +14718,9 @@ function AnimationStateManager() {
|
|
14820
14718
|
}
|
14821
14719
|
};
|
14822
14720
|
}
|
14823
|
-
|
14824
14721
|
function repaint(target) {
|
14825
14722
|
return target.offsetWidth;
|
14826
14723
|
}
|
14827
|
-
|
14828
14724
|
function calculateRealTime(animatingRect, fromRect, toRect, options) {
|
14829
14725
|
return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
|
14830
14726
|
}
|
@@ -14841,7 +14737,6 @@ var PluginManager = {
|
|
14841
14737
|
plugin[option] = defaults[option];
|
14842
14738
|
}
|
14843
14739
|
}
|
14844
|
-
|
14845
14740
|
plugins.forEach(function (p) {
|
14846
14741
|
if (p.pluginName === plugin.pluginName) {
|
14847
14742
|
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
|
@@ -14851,25 +14746,22 @@ var PluginManager = {
|
|
14851
14746
|
},
|
14852
14747
|
pluginEvent: function pluginEvent(eventName, sortable, evt) {
|
14853
14748
|
var _this = this;
|
14854
|
-
|
14855
14749
|
this.eventCanceled = false;
|
14856
|
-
|
14857
14750
|
evt.cancel = function () {
|
14858
14751
|
_this.eventCanceled = true;
|
14859
14752
|
};
|
14860
|
-
|
14861
14753
|
var eventNameGlobal = eventName + 'Global';
|
14862
14754
|
plugins.forEach(function (plugin) {
|
14863
|
-
if (!sortable[plugin.pluginName]) return;
|
14864
|
-
|
14755
|
+
if (!sortable[plugin.pluginName]) return;
|
14756
|
+
// Fire global events if it exists in this sortable
|
14865
14757
|
if (sortable[plugin.pluginName][eventNameGlobal]) {
|
14866
14758
|
sortable[plugin.pluginName][eventNameGlobal](_objectSpread2$1({
|
14867
14759
|
sortable: sortable
|
14868
14760
|
}, evt));
|
14869
|
-
}
|
14870
|
-
// and plugin has event defined
|
14871
|
-
|
14761
|
+
}
|
14872
14762
|
|
14763
|
+
// Only fire plugin event if plugin is enabled in this sortable,
|
14764
|
+
// and plugin has event defined
|
14873
14765
|
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
|
14874
14766
|
sortable[plugin.pluginName][eventName](_objectSpread2$1({
|
14875
14767
|
sortable: sortable
|
@@ -14884,15 +14776,14 @@ var PluginManager = {
|
|
14884
14776
|
var initialized = new plugin(sortable, el, sortable.options);
|
14885
14777
|
initialized.sortable = sortable;
|
14886
14778
|
initialized.options = sortable.options;
|
14887
|
-
sortable[pluginName] = initialized;
|
14779
|
+
sortable[pluginName] = initialized;
|
14888
14780
|
|
14781
|
+
// Add default options from plugin
|
14889
14782
|
_extends(defaults, initialized.defaults);
|
14890
14783
|
});
|
14891
|
-
|
14892
14784
|
for (var option in sortable.options) {
|
14893
14785
|
if (!sortable.options.hasOwnProperty(option)) continue;
|
14894
14786
|
var modified = this.modifyOption(sortable, option, sortable.options[option]);
|
14895
|
-
|
14896
14787
|
if (typeof modified !== 'undefined') {
|
14897
14788
|
sortable.options[option] = modified;
|
14898
14789
|
}
|
@@ -14902,7 +14793,6 @@ var PluginManager = {
|
|
14902
14793
|
var eventProperties = {};
|
14903
14794
|
plugins.forEach(function (plugin) {
|
14904
14795
|
if (typeof plugin.eventProperties !== 'function') return;
|
14905
|
-
|
14906
14796
|
_extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
|
14907
14797
|
});
|
14908
14798
|
return eventProperties;
|
@@ -14911,8 +14801,9 @@ var PluginManager = {
|
|
14911
14801
|
var modifiedValue;
|
14912
14802
|
plugins.forEach(function (plugin) {
|
14913
14803
|
// Plugin must exist on the Sortable
|
14914
|
-
if (!sortable[plugin.pluginName]) return;
|
14804
|
+
if (!sortable[plugin.pluginName]) return;
|
14915
14805
|
|
14806
|
+
// If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
|
14916
14807
|
if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
|
14917
14808
|
modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
|
14918
14809
|
}
|
@@ -14923,25 +14814,25 @@ var PluginManager = {
|
|
14923
14814
|
|
14924
14815
|
function dispatchEvent$1(_ref) {
|
14925
14816
|
var sortable = _ref.sortable,
|
14926
|
-
|
14927
|
-
|
14928
|
-
|
14929
|
-
|
14930
|
-
|
14931
|
-
|
14932
|
-
|
14933
|
-
|
14934
|
-
|
14935
|
-
|
14936
|
-
|
14937
|
-
|
14938
|
-
|
14817
|
+
rootEl = _ref.rootEl,
|
14818
|
+
name = _ref.name,
|
14819
|
+
targetEl = _ref.targetEl,
|
14820
|
+
cloneEl = _ref.cloneEl,
|
14821
|
+
toEl = _ref.toEl,
|
14822
|
+
fromEl = _ref.fromEl,
|
14823
|
+
oldIndex = _ref.oldIndex,
|
14824
|
+
newIndex = _ref.newIndex,
|
14825
|
+
oldDraggableIndex = _ref.oldDraggableIndex,
|
14826
|
+
newDraggableIndex = _ref.newDraggableIndex,
|
14827
|
+
originalEvent = _ref.originalEvent,
|
14828
|
+
putSortable = _ref.putSortable,
|
14829
|
+
extraEventProperties = _ref.extraEventProperties;
|
14939
14830
|
sortable = sortable || rootEl && rootEl[expando];
|
14940
14831
|
if (!sortable) return;
|
14941
14832
|
var evt,
|
14942
|
-
|
14943
|
-
|
14944
|
-
|
14833
|
+
options = sortable.options,
|
14834
|
+
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
|
14835
|
+
// Support for new CustomEvent feature
|
14945
14836
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
14946
14837
|
evt = new CustomEvent(name, {
|
14947
14838
|
bubbles: true,
|
@@ -14951,7 +14842,6 @@ function dispatchEvent$1(_ref) {
|
|
14951
14842
|
evt = document.createEvent('Event');
|
14952
14843
|
evt.initEvent(name, true, true);
|
14953
14844
|
}
|
14954
|
-
|
14955
14845
|
evt.to = toEl || rootEl;
|
14956
14846
|
evt.from = fromEl || rootEl;
|
14957
14847
|
evt.item = targetEl || rootEl;
|
@@ -14962,29 +14852,23 @@ function dispatchEvent$1(_ref) {
|
|
14962
14852
|
evt.newDraggableIndex = newDraggableIndex;
|
14963
14853
|
evt.originalEvent = originalEvent;
|
14964
14854
|
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
|
14965
|
-
|
14966
14855
|
var allEventProperties = _objectSpread2$1(_objectSpread2$1({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
|
14967
|
-
|
14968
14856
|
for (var option in allEventProperties) {
|
14969
14857
|
evt[option] = allEventProperties[option];
|
14970
14858
|
}
|
14971
|
-
|
14972
14859
|
if (rootEl) {
|
14973
14860
|
rootEl.dispatchEvent(evt);
|
14974
14861
|
}
|
14975
|
-
|
14976
14862
|
if (options[onName]) {
|
14977
14863
|
options[onName].call(sortable, evt);
|
14978
14864
|
}
|
14979
14865
|
}
|
14980
14866
|
|
14981
14867
|
var _excluded = ["evt"];
|
14982
|
-
|
14983
14868
|
var pluginEvent = function pluginEvent(eventName, sortable) {
|
14984
14869
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
14985
|
-
|
14986
|
-
|
14987
|
-
|
14870
|
+
originalEvent = _ref.evt,
|
14871
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
14988
14872
|
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2$1({
|
14989
14873
|
dragEl: dragEl,
|
14990
14874
|
parentEl: parentEl,
|
@@ -15019,7 +14903,6 @@ var pluginEvent = function pluginEvent(eventName, sortable) {
|
|
15019
14903
|
}
|
15020
14904
|
}, data));
|
15021
14905
|
};
|
15022
|
-
|
15023
14906
|
function _dispatchEvent(info) {
|
15024
14907
|
dispatchEvent$1(_objectSpread2$1({
|
15025
14908
|
putSortable: putSortable,
|
@@ -15032,62 +14915,61 @@ function _dispatchEvent(info) {
|
|
15032
14915
|
newDraggableIndex: newDraggableIndex
|
15033
14916
|
}, info));
|
15034
14917
|
}
|
15035
|
-
|
15036
14918
|
var dragEl,
|
15037
|
-
|
15038
|
-
|
15039
|
-
|
15040
|
-
|
15041
|
-
|
15042
|
-
|
15043
|
-
|
15044
|
-
|
15045
|
-
|
15046
|
-
|
15047
|
-
|
15048
|
-
|
15049
|
-
|
15050
|
-
|
15051
|
-
|
15052
|
-
|
15053
|
-
|
15054
|
-
|
15055
|
-
|
15056
|
-
|
15057
|
-
|
15058
|
-
|
15059
|
-
|
15060
|
-
|
15061
|
-
|
15062
|
-
|
15063
|
-
|
15064
|
-
|
15065
|
-
|
15066
|
-
ghostRelativeParent,
|
15067
|
-
|
15068
|
-
|
15069
|
-
|
15070
|
-
|
15071
|
-
|
14919
|
+
parentEl,
|
14920
|
+
ghostEl,
|
14921
|
+
rootEl,
|
14922
|
+
nextEl,
|
14923
|
+
lastDownEl,
|
14924
|
+
cloneEl,
|
14925
|
+
cloneHidden,
|
14926
|
+
oldIndex,
|
14927
|
+
newIndex,
|
14928
|
+
oldDraggableIndex,
|
14929
|
+
newDraggableIndex,
|
14930
|
+
activeGroup,
|
14931
|
+
putSortable,
|
14932
|
+
awaitingDragStarted = false,
|
14933
|
+
ignoreNextClick = false,
|
14934
|
+
sortables = [],
|
14935
|
+
tapEvt,
|
14936
|
+
touchEvt,
|
14937
|
+
lastDx,
|
14938
|
+
lastDy,
|
14939
|
+
tapDistanceLeft,
|
14940
|
+
tapDistanceTop,
|
14941
|
+
moved,
|
14942
|
+
lastTarget,
|
14943
|
+
lastDirection,
|
14944
|
+
pastFirstInvertThresh = false,
|
14945
|
+
isCircumstantialInvert = false,
|
14946
|
+
targetMoveDistance,
|
14947
|
+
// For positioning ghost absolutely
|
14948
|
+
ghostRelativeParent,
|
14949
|
+
ghostRelativeParentInitialScroll = [],
|
14950
|
+
// (left, top)
|
14951
|
+
|
14952
|
+
_silent = false,
|
14953
|
+
savedInputChecked = [];
|
15072
14954
|
|
14955
|
+
/** @const */
|
15073
14956
|
var documentExists = typeof document !== 'undefined',
|
15074
|
-
|
15075
|
-
|
15076
|
-
|
15077
|
-
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
15078
|
-
|
15079
|
-
|
15080
|
-
|
15081
|
-
|
15082
|
-
|
15083
|
-
|
15084
|
-
|
15085
|
-
|
15086
|
-
|
15087
|
-
|
15088
|
-
|
15089
|
-
|
15090
|
-
var elCSS = css(el),
|
14957
|
+
PositionGhostAbsolutely = IOS,
|
14958
|
+
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
|
14959
|
+
// This will not pass for IE9, because IE9 DnD only works on anchors
|
14960
|
+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
14961
|
+
supportCssPointerEvents = function () {
|
14962
|
+
if (!documentExists) return;
|
14963
|
+
// false when <= IE11
|
14964
|
+
if (IE11OrLess) {
|
14965
|
+
return false;
|
14966
|
+
}
|
14967
|
+
var el = document.createElement('x');
|
14968
|
+
el.style.cssText = 'pointer-events:auto';
|
14969
|
+
return el.style.pointerEvents === 'auto';
|
14970
|
+
}(),
|
14971
|
+
_detectDirection = function _detectDirection(el, options) {
|
14972
|
+
var elCSS = css(el),
|
15091
14973
|
elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
|
15092
14974
|
child1 = getChild(el, 0, options),
|
15093
14975
|
child2 = getChild(el, 1, options),
|
@@ -15095,103 +14977,93 @@ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in
|
|
15095
14977
|
secondChildCSS = child2 && css(child2),
|
15096
14978
|
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect$1(child1).width,
|
15097
14979
|
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect$1(child2).width;
|
15098
|
-
|
15099
|
-
|
15100
|
-
|
15101
|
-
|
15102
|
-
|
15103
|
-
|
15104
|
-
|
15105
|
-
|
15106
|
-
|
15107
|
-
|
15108
|
-
|
15109
|
-
|
15110
|
-
|
15111
|
-
|
15112
|
-
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
15113
|
-
},
|
15114
|
-
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
15115
|
-
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
14980
|
+
if (elCSS.display === 'flex') {
|
14981
|
+
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
|
14982
|
+
}
|
14983
|
+
if (elCSS.display === 'grid') {
|
14984
|
+
return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
|
14985
|
+
}
|
14986
|
+
if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
|
14987
|
+
var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
|
14988
|
+
return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
|
14989
|
+
}
|
14990
|
+
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
14991
|
+
},
|
14992
|
+
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
14993
|
+
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
15116
14994
|
dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
|
15117
14995
|
dragElOppLength = vertical ? dragRect.width : dragRect.height,
|
15118
14996
|
targetS1Opp = vertical ? targetRect.left : targetRect.top,
|
15119
14997
|
targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
|
15120
14998
|
targetOppLength = vertical ? targetRect.width : targetRect.height;
|
15121
|
-
|
15122
|
-
},
|
15123
|
-
|
15124
|
-
|
15125
|
-
|
15126
|
-
|
15127
|
-
|
15128
|
-
|
15129
|
-
|
15130
|
-
|
15131
|
-
|
15132
|
-
|
15133
|
-
|
15134
|
-
|
15135
|
-
var rect = getRect$1(sortable),
|
14999
|
+
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
15000
|
+
},
|
15001
|
+
/**
|
15002
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
15003
|
+
* @param {Number} x X position
|
15004
|
+
* @param {Number} y Y position
|
15005
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
15006
|
+
*/
|
15007
|
+
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
15008
|
+
var ret;
|
15009
|
+
sortables.some(function (sortable) {
|
15010
|
+
var threshold = sortable[expando].options.emptyInsertThreshold;
|
15011
|
+
if (!threshold || lastChild(sortable)) return;
|
15012
|
+
var rect = getRect$1(sortable),
|
15136
15013
|
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
|
15137
15014
|
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
|
15138
|
-
|
15139
|
-
|
15140
|
-
return ret = sortable;
|
15141
|
-
}
|
15142
|
-
});
|
15143
|
-
return ret;
|
15144
|
-
},
|
15145
|
-
_prepareGroup = function _prepareGroup(options) {
|
15146
|
-
function toFn(value, pull) {
|
15147
|
-
return function (to, from, dragEl, evt) {
|
15148
|
-
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
15149
|
-
|
15150
|
-
if (value == null && (pull || sameGroup)) {
|
15151
|
-
// Default pull value
|
15152
|
-
// Default pull and put value if same group
|
15153
|
-
return true;
|
15154
|
-
} else if (value == null || value === false) {
|
15155
|
-
return false;
|
15156
|
-
} else if (pull && value === 'clone') {
|
15157
|
-
return value;
|
15158
|
-
} else if (typeof value === 'function') {
|
15159
|
-
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
15160
|
-
} else {
|
15161
|
-
var otherGroup = (pull ? to : from).options.group.name;
|
15162
|
-
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
15015
|
+
if (insideHorizontally && insideVertically) {
|
15016
|
+
return ret = sortable;
|
15163
15017
|
}
|
15164
|
-
};
|
15165
|
-
|
15166
|
-
|
15167
|
-
|
15168
|
-
|
15169
|
-
|
15170
|
-
|
15171
|
-
|
15172
|
-
|
15173
|
-
|
15174
|
-
|
15175
|
-
|
15176
|
-
|
15177
|
-
|
15178
|
-
|
15179
|
-
|
15180
|
-
|
15181
|
-
}
|
15182
|
-
|
15183
|
-
|
15184
|
-
|
15185
|
-
|
15186
|
-
}
|
15187
|
-
|
15188
|
-
|
15189
|
-
|
15190
|
-
|
15191
|
-
|
15192
|
-
|
15018
|
+
});
|
15019
|
+
return ret;
|
15020
|
+
},
|
15021
|
+
_prepareGroup = function _prepareGroup(options) {
|
15022
|
+
function toFn(value, pull) {
|
15023
|
+
return function (to, from, dragEl, evt) {
|
15024
|
+
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
15025
|
+
if (value == null && (pull || sameGroup)) {
|
15026
|
+
// Default pull value
|
15027
|
+
// Default pull and put value if same group
|
15028
|
+
return true;
|
15029
|
+
} else if (value == null || value === false) {
|
15030
|
+
return false;
|
15031
|
+
} else if (pull && value === 'clone') {
|
15032
|
+
return value;
|
15033
|
+
} else if (typeof value === 'function') {
|
15034
|
+
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
15035
|
+
} else {
|
15036
|
+
var otherGroup = (pull ? to : from).options.group.name;
|
15037
|
+
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
15038
|
+
}
|
15039
|
+
};
|
15040
|
+
}
|
15041
|
+
var group = {};
|
15042
|
+
var originalGroup = options.group;
|
15043
|
+
if (!originalGroup || _typeof$1(originalGroup) != 'object') {
|
15044
|
+
originalGroup = {
|
15045
|
+
name: originalGroup
|
15046
|
+
};
|
15047
|
+
}
|
15048
|
+
group.name = originalGroup.name;
|
15049
|
+
group.checkPull = toFn(originalGroup.pull, true);
|
15050
|
+
group.checkPut = toFn(originalGroup.put);
|
15051
|
+
group.revertClone = originalGroup.revertClone;
|
15052
|
+
options.group = group;
|
15053
|
+
},
|
15054
|
+
_hideGhostForTarget = function _hideGhostForTarget() {
|
15055
|
+
if (!supportCssPointerEvents && ghostEl) {
|
15056
|
+
css(ghostEl, 'display', 'none');
|
15057
|
+
}
|
15058
|
+
},
|
15059
|
+
_unhideGhostForTarget = function _unhideGhostForTarget() {
|
15060
|
+
if (!supportCssPointerEvents && ghostEl) {
|
15061
|
+
css(ghostEl, 'display', '');
|
15062
|
+
}
|
15063
|
+
};
|
15193
15064
|
|
15194
|
-
if
|
15065
|
+
// #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
15066
|
+
if (documentExists && !ChromeForAndroid) {
|
15195
15067
|
document.addEventListener('click', function (evt) {
|
15196
15068
|
if (ignoreNextClick) {
|
15197
15069
|
evt.preventDefault();
|
@@ -15202,53 +15074,44 @@ if (documentExists) {
|
|
15202
15074
|
}
|
15203
15075
|
}, true);
|
15204
15076
|
}
|
15205
|
-
|
15206
15077
|
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
|
15207
15078
|
if (dragEl) {
|
15208
15079
|
evt = evt.touches ? evt.touches[0] : evt;
|
15209
|
-
|
15210
15080
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
15211
|
-
|
15212
15081
|
if (nearest) {
|
15213
15082
|
// Create imitation event
|
15214
15083
|
var event = {};
|
15215
|
-
|
15216
15084
|
for (var i in evt) {
|
15217
15085
|
if (evt.hasOwnProperty(i)) {
|
15218
15086
|
event[i] = evt[i];
|
15219
15087
|
}
|
15220
15088
|
}
|
15221
|
-
|
15222
15089
|
event.target = event.rootEl = nearest;
|
15223
15090
|
event.preventDefault = void 0;
|
15224
15091
|
event.stopPropagation = void 0;
|
15225
|
-
|
15226
15092
|
nearest[expando]._onDragOver(event);
|
15227
15093
|
}
|
15228
15094
|
}
|
15229
15095
|
};
|
15230
|
-
|
15231
15096
|
var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
15232
15097
|
if (dragEl) {
|
15233
15098
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
15234
15099
|
}
|
15235
15100
|
};
|
15236
|
-
/**
|
15237
|
-
* @class Sortable
|
15238
|
-
* @param {HTMLElement} el
|
15239
|
-
* @param {Object} [options]
|
15240
|
-
*/
|
15241
|
-
|
15242
15101
|
|
15102
|
+
/**
|
15103
|
+
* @class Sortable
|
15104
|
+
* @param {HTMLElement} el
|
15105
|
+
* @param {Object} [options]
|
15106
|
+
*/
|
15243
15107
|
function Sortable(el, options) {
|
15244
15108
|
if (!(el && el.nodeType && el.nodeType === 1)) {
|
15245
15109
|
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
|
15246
15110
|
}
|
15247
|
-
|
15248
15111
|
this.el = el; // root element
|
15112
|
+
this.options = options = _extends({}, options);
|
15249
15113
|
|
15250
|
-
|
15251
|
-
|
15114
|
+
// Export instance
|
15252
15115
|
el[expando] = this;
|
15253
15116
|
var defaults = {
|
15254
15117
|
group: null,
|
@@ -15295,52 +15158,48 @@ function Sortable(el, options) {
|
|
15295
15158
|
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
|
15296
15159
|
emptyInsertThreshold: 5
|
15297
15160
|
};
|
15298
|
-
PluginManager.initializePlugins(this, el, defaults);
|
15161
|
+
PluginManager.initializePlugins(this, el, defaults);
|
15299
15162
|
|
15163
|
+
// Set default options
|
15300
15164
|
for (var name in defaults) {
|
15301
15165
|
!(name in options) && (options[name] = defaults[name]);
|
15302
15166
|
}
|
15167
|
+
_prepareGroup(options);
|
15303
15168
|
|
15304
|
-
|
15305
|
-
|
15306
|
-
|
15169
|
+
// Bind all private methods
|
15307
15170
|
for (var fn in this) {
|
15308
15171
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
15309
15172
|
this[fn] = this[fn].bind(this);
|
15310
15173
|
}
|
15311
|
-
}
|
15312
|
-
|
15174
|
+
}
|
15313
15175
|
|
15176
|
+
// Setup drag mode
|
15314
15177
|
this.nativeDraggable = options.forceFallback ? false : supportDraggable;
|
15315
|
-
|
15316
15178
|
if (this.nativeDraggable) {
|
15317
15179
|
// Touch start threshold cannot be greater than the native dragstart threshold
|
15318
15180
|
this.options.touchStartThreshold = 1;
|
15319
|
-
}
|
15320
|
-
|
15181
|
+
}
|
15321
15182
|
|
15183
|
+
// Bind events
|
15322
15184
|
if (options.supportPointer) {
|
15323
15185
|
on(el, 'pointerdown', this._onTapStart);
|
15324
15186
|
} else {
|
15325
15187
|
on(el, 'mousedown', this._onTapStart);
|
15326
15188
|
on(el, 'touchstart', this._onTapStart);
|
15327
15189
|
}
|
15328
|
-
|
15329
15190
|
if (this.nativeDraggable) {
|
15330
15191
|
on(el, 'dragover', this);
|
15331
15192
|
on(el, 'dragenter', this);
|
15332
15193
|
}
|
15194
|
+
sortables.push(this.el);
|
15333
15195
|
|
15334
|
-
|
15335
|
-
|
15336
|
-
options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
|
15196
|
+
// Restore sorting
|
15197
|
+
options.store && options.store.get && this.sort(options.store.get(this) || []);
|
15337
15198
|
|
15199
|
+
// Add animation state manager
|
15338
15200
|
_extends(this, AnimationStateManager());
|
15339
15201
|
}
|
15340
|
-
|
15341
|
-
Sortable.prototype =
|
15342
|
-
/** @lends Sortable.prototype */
|
15343
|
-
{
|
15202
|
+
Sortable.prototype = /** @lends Sortable.prototype */{
|
15344
15203
|
constructor: Sortable,
|
15345
15204
|
_isOutsideThisEl: function _isOutsideThisEl(target) {
|
15346
15205
|
if (!this.el.contains(target) && target !== this.el) {
|
@@ -15350,57 +15209,50 @@ Sortable.prototype =
|
|
15350
15209
|
_getDirection: function _getDirection(evt, target) {
|
15351
15210
|
return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
|
15352
15211
|
},
|
15353
|
-
_onTapStart: function _onTapStart(
|
15354
|
-
/** Event|TouchEvent */
|
15355
|
-
evt) {
|
15212
|
+
_onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
|
15356
15213
|
if (!evt.cancelable) return;
|
15357
|
-
|
15358
15214
|
var _this = this,
|
15359
|
-
|
15360
|
-
|
15361
|
-
|
15362
|
-
|
15363
|
-
|
15364
|
-
|
15365
|
-
|
15366
|
-
|
15367
|
-
|
15368
|
-
|
15369
|
-
|
15370
|
-
|
15215
|
+
el = this.el,
|
15216
|
+
options = this.options,
|
15217
|
+
preventOnFilter = options.preventOnFilter,
|
15218
|
+
type = evt.type,
|
15219
|
+
touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
|
15220
|
+
target = (touch || evt).target,
|
15221
|
+
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
|
15222
|
+
filter = options.filter;
|
15223
|
+
_saveInputCheckedState(el);
|
15224
|
+
|
15225
|
+
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
|
15371
15226
|
if (dragEl) {
|
15372
15227
|
return;
|
15373
15228
|
}
|
15374
|
-
|
15375
15229
|
if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
|
15376
15230
|
return; // only left button and enabled
|
15377
|
-
}
|
15378
|
-
|
15231
|
+
}
|
15379
15232
|
|
15233
|
+
// cancel dnd if original target is content editable
|
15380
15234
|
if (originalTarget.isContentEditable) {
|
15381
15235
|
return;
|
15382
|
-
}
|
15383
|
-
|
15236
|
+
}
|
15384
15237
|
|
15238
|
+
// Safari ignores further event handling after mousedown
|
15385
15239
|
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
|
15386
15240
|
return;
|
15387
15241
|
}
|
15388
|
-
|
15389
15242
|
target = closest(target, options.draggable, el, false);
|
15390
|
-
|
15391
15243
|
if (target && target.animated) {
|
15392
15244
|
return;
|
15393
15245
|
}
|
15394
|
-
|
15395
15246
|
if (lastDownEl === target) {
|
15396
15247
|
// Ignoring duplicate `down`
|
15397
15248
|
return;
|
15398
|
-
}
|
15399
|
-
|
15249
|
+
}
|
15400
15250
|
|
15251
|
+
// Get the index of the dragged element within its parent
|
15401
15252
|
oldIndex = index(target);
|
15402
|
-
oldDraggableIndex = index(target, options.draggable);
|
15253
|
+
oldDraggableIndex = index(target, options.draggable);
|
15403
15254
|
|
15255
|
+
// Check filter
|
15404
15256
|
if (typeof filter === 'function') {
|
15405
15257
|
if (filter.call(this, evt, target, this)) {
|
15406
15258
|
_dispatchEvent({
|
@@ -15411,7 +15263,6 @@ Sortable.prototype =
|
|
15411
15263
|
toEl: el,
|
15412
15264
|
fromEl: el
|
15413
15265
|
});
|
15414
|
-
|
15415
15266
|
pluginEvent('filter', _this, {
|
15416
15267
|
evt: evt
|
15417
15268
|
});
|
@@ -15421,7 +15272,6 @@ Sortable.prototype =
|
|
15421
15272
|
} else if (filter) {
|
15422
15273
|
filter = filter.split(',').some(function (criteria) {
|
15423
15274
|
criteria = closest(originalTarget, criteria.trim(), el, false);
|
15424
|
-
|
15425
15275
|
if (criteria) {
|
15426
15276
|
_dispatchEvent({
|
15427
15277
|
sortable: _this,
|
@@ -15431,40 +15281,30 @@ Sortable.prototype =
|
|
15431
15281
|
fromEl: el,
|
15432
15282
|
toEl: el
|
15433
15283
|
});
|
15434
|
-
|
15435
15284
|
pluginEvent('filter', _this, {
|
15436
15285
|
evt: evt
|
15437
15286
|
});
|
15438
15287
|
return true;
|
15439
15288
|
}
|
15440
15289
|
});
|
15441
|
-
|
15442
15290
|
if (filter) {
|
15443
15291
|
preventOnFilter && evt.cancelable && evt.preventDefault();
|
15444
15292
|
return; // cancel dnd
|
15445
15293
|
}
|
15446
15294
|
}
|
15447
|
-
|
15448
15295
|
if (options.handle && !closest(originalTarget, options.handle, el, false)) {
|
15449
15296
|
return;
|
15450
|
-
}
|
15451
|
-
|
15297
|
+
}
|
15452
15298
|
|
15299
|
+
// Prepare `dragstart`
|
15453
15300
|
this._prepareDragStart(evt, touch, target);
|
15454
15301
|
},
|
15455
|
-
_prepareDragStart: function _prepareDragStart(
|
15456
|
-
/** Event */
|
15457
|
-
evt,
|
15458
|
-
/** Touch */
|
15459
|
-
touch,
|
15460
|
-
/** HTMLElement */
|
15461
|
-
target) {
|
15302
|
+
_prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
|
15462
15303
|
var _this = this,
|
15463
|
-
|
15464
|
-
|
15465
|
-
|
15466
|
-
|
15467
|
-
|
15304
|
+
el = _this.el,
|
15305
|
+
options = _this.options,
|
15306
|
+
ownerDocument = el.ownerDocument,
|
15307
|
+
dragStartFn;
|
15468
15308
|
if (target && !dragEl && target.parentNode === el) {
|
15469
15309
|
var dragRect = getRect$1(target);
|
15470
15310
|
rootEl = el;
|
@@ -15484,41 +15324,36 @@ Sortable.prototype =
|
|
15484
15324
|
this._lastX = (touch || evt).clientX;
|
15485
15325
|
this._lastY = (touch || evt).clientY;
|
15486
15326
|
dragEl.style['will-change'] = 'all';
|
15487
|
-
|
15488
15327
|
dragStartFn = function dragStartFn() {
|
15489
15328
|
pluginEvent('delayEnded', _this, {
|
15490
15329
|
evt: evt
|
15491
15330
|
});
|
15492
|
-
|
15493
15331
|
if (Sortable.eventCanceled) {
|
15494
15332
|
_this._onDrop();
|
15495
|
-
|
15496
15333
|
return;
|
15497
|
-
}
|
15334
|
+
}
|
15335
|
+
// Delayed drag has been triggered
|
15498
15336
|
// we can re-enable the events: touchmove/mousemove
|
15499
|
-
|
15500
|
-
|
15501
15337
|
_this._disableDelayedDragEvents();
|
15502
|
-
|
15503
15338
|
if (!FireFox && _this.nativeDraggable) {
|
15504
15339
|
dragEl.draggable = true;
|
15505
|
-
}
|
15506
|
-
|
15507
|
-
|
15508
|
-
_this._triggerDragStart(evt, touch); // Drag start event
|
15340
|
+
}
|
15509
15341
|
|
15342
|
+
// Bind the events: dragstart/dragend
|
15343
|
+
_this._triggerDragStart(evt, touch);
|
15510
15344
|
|
15345
|
+
// Drag start event
|
15511
15346
|
_dispatchEvent({
|
15512
15347
|
sortable: _this,
|
15513
15348
|
name: 'choose',
|
15514
15349
|
originalEvent: evt
|
15515
|
-
});
|
15516
|
-
|
15350
|
+
});
|
15517
15351
|
|
15352
|
+
// Chosen item
|
15518
15353
|
toggleClass$1(dragEl, options.chosenClass, true);
|
15519
|
-
};
|
15520
|
-
|
15354
|
+
};
|
15521
15355
|
|
15356
|
+
// Disable "draggable"
|
15522
15357
|
options.ignore.split(',').forEach(function (criteria) {
|
15523
15358
|
find$2(dragEl, criteria.trim(), _disableDraggable);
|
15524
15359
|
});
|
@@ -15527,27 +15362,26 @@ Sortable.prototype =
|
|
15527
15362
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
15528
15363
|
on(ownerDocument, 'mouseup', _this._onDrop);
|
15529
15364
|
on(ownerDocument, 'touchend', _this._onDrop);
|
15530
|
-
on(ownerDocument, 'touchcancel', _this._onDrop);
|
15365
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
15531
15366
|
|
15367
|
+
// Make dragEl draggable (must be before delay for FireFox)
|
15532
15368
|
if (FireFox && this.nativeDraggable) {
|
15533
15369
|
this.options.touchStartThreshold = 4;
|
15534
15370
|
dragEl.draggable = true;
|
15535
15371
|
}
|
15536
|
-
|
15537
15372
|
pluginEvent('delayStart', this, {
|
15538
15373
|
evt: evt
|
15539
|
-
});
|
15374
|
+
});
|
15540
15375
|
|
15376
|
+
// Delay is impossible for native DnD in Edge or IE
|
15541
15377
|
if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
|
15542
15378
|
if (Sortable.eventCanceled) {
|
15543
15379
|
this._onDrop();
|
15544
|
-
|
15545
15380
|
return;
|
15546
|
-
}
|
15381
|
+
}
|
15382
|
+
// If the user moves the pointer or let go the click or touch
|
15547
15383
|
// before the delay has been reached:
|
15548
15384
|
// disable the delayed drag
|
15549
|
-
|
15550
|
-
|
15551
15385
|
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
15552
15386
|
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
15553
15387
|
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
@@ -15560,11 +15394,8 @@ Sortable.prototype =
|
|
15560
15394
|
}
|
15561
15395
|
}
|
15562
15396
|
},
|
15563
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
15564
|
-
/** TouchEvent|PointerEvent **/
|
15565
|
-
e) {
|
15397
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
|
15566
15398
|
var touch = e.touches ? e.touches[0] : e;
|
15567
|
-
|
15568
15399
|
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
|
15569
15400
|
this._disableDelayedDrag();
|
15570
15401
|
}
|
@@ -15572,7 +15403,6 @@ Sortable.prototype =
|
|
15572
15403
|
_disableDelayedDrag: function _disableDelayedDrag() {
|
15573
15404
|
dragEl && _disableDraggable(dragEl);
|
15574
15405
|
clearTimeout(this._dragStartTimer);
|
15575
|
-
|
15576
15406
|
this._disableDelayedDragEvents();
|
15577
15407
|
},
|
15578
15408
|
_disableDelayedDragEvents: function _disableDelayedDragEvents() {
|
@@ -15584,13 +15414,8 @@ Sortable.prototype =
|
|
15584
15414
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
15585
15415
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
15586
15416
|
},
|
15587
|
-
_triggerDragStart: function _triggerDragStart(
|
15588
|
-
/** Event */
|
15589
|
-
evt,
|
15590
|
-
/** Touch */
|
15591
|
-
touch) {
|
15417
|
+
_triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
|
15592
15418
|
touch = touch || evt.pointerType == 'touch' && evt;
|
15593
|
-
|
15594
15419
|
if (!this.nativeDraggable || touch) {
|
15595
15420
|
if (this.options.supportPointer) {
|
15596
15421
|
on(document, 'pointermove', this._onTouchMove);
|
@@ -15603,7 +15428,6 @@ Sortable.prototype =
|
|
15603
15428
|
on(dragEl, 'dragend', this);
|
15604
15429
|
on(rootEl, 'dragstart', this._onDragStart);
|
15605
15430
|
}
|
15606
|
-
|
15607
15431
|
try {
|
15608
15432
|
if (document.selection) {
|
15609
15433
|
// Timeout neccessary for IE9
|
@@ -15616,25 +15440,23 @@ Sortable.prototype =
|
|
15616
15440
|
} catch (err) {}
|
15617
15441
|
},
|
15618
15442
|
_dragStarted: function _dragStarted(fallback, evt) {
|
15619
|
-
|
15620
15443
|
awaitingDragStarted = false;
|
15621
|
-
|
15622
15444
|
if (rootEl && dragEl) {
|
15623
15445
|
pluginEvent('dragStarted', this, {
|
15624
15446
|
evt: evt
|
15625
15447
|
});
|
15626
|
-
|
15627
15448
|
if (this.nativeDraggable) {
|
15628
15449
|
on(document, 'dragover', _checkOutsideTargetEl);
|
15629
15450
|
}
|
15451
|
+
var options = this.options;
|
15630
15452
|
|
15631
|
-
|
15632
|
-
|
15453
|
+
// Apply effect
|
15633
15454
|
!fallback && toggleClass$1(dragEl, options.dragClass, false);
|
15634
15455
|
toggleClass$1(dragEl, options.ghostClass, true);
|
15635
15456
|
Sortable.active = this;
|
15636
|
-
fallback && this._appendGhost();
|
15457
|
+
fallback && this._appendGhost();
|
15637
15458
|
|
15459
|
+
// Drag start event
|
15638
15460
|
_dispatchEvent({
|
15639
15461
|
sortable: this,
|
15640
15462
|
name: 'start',
|
@@ -15648,20 +15470,15 @@ Sortable.prototype =
|
|
15648
15470
|
if (touchEvt) {
|
15649
15471
|
this._lastX = touchEvt.clientX;
|
15650
15472
|
this._lastY = touchEvt.clientY;
|
15651
|
-
|
15652
15473
|
_hideGhostForTarget();
|
15653
|
-
|
15654
15474
|
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
15655
15475
|
var parent = target;
|
15656
|
-
|
15657
15476
|
while (target && target.shadowRoot) {
|
15658
15477
|
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
15659
15478
|
if (target === parent) break;
|
15660
15479
|
parent = target;
|
15661
15480
|
}
|
15662
|
-
|
15663
15481
|
dragEl.parentNode[expando]._isOutsideThisEl(target);
|
15664
|
-
|
15665
15482
|
if (parent) {
|
15666
15483
|
do {
|
15667
15484
|
if (parent[expando]) {
|
@@ -15672,44 +15489,37 @@ Sortable.prototype =
|
|
15672
15489
|
target: target,
|
15673
15490
|
rootEl: parent
|
15674
15491
|
});
|
15675
|
-
|
15676
15492
|
if (inserted && !this.options.dragoverBubble) {
|
15677
15493
|
break;
|
15678
15494
|
}
|
15679
15495
|
}
|
15680
|
-
|
15681
15496
|
target = parent; // store last element
|
15682
15497
|
}
|
15683
|
-
/* jshint boss:true */
|
15684
|
-
while (parent = parent.parentNode);
|
15498
|
+
/* jshint boss:true */ while (parent = parent.parentNode);
|
15685
15499
|
}
|
15686
|
-
|
15687
15500
|
_unhideGhostForTarget();
|
15688
15501
|
}
|
15689
15502
|
},
|
15690
|
-
_onTouchMove: function _onTouchMove(
|
15691
|
-
/**TouchEvent*/
|
15692
|
-
evt) {
|
15503
|
+
_onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
|
15693
15504
|
if (tapEvt) {
|
15694
15505
|
var options = this.options,
|
15695
|
-
|
15696
|
-
|
15697
|
-
|
15698
|
-
|
15699
|
-
|
15700
|
-
|
15701
|
-
|
15702
|
-
|
15703
|
-
|
15704
|
-
|
15506
|
+
fallbackTolerance = options.fallbackTolerance,
|
15507
|
+
fallbackOffset = options.fallbackOffset,
|
15508
|
+
touch = evt.touches ? evt.touches[0] : evt,
|
15509
|
+
ghostMatrix = ghostEl && matrix(ghostEl, true),
|
15510
|
+
scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
|
15511
|
+
scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
|
15512
|
+
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
|
15513
|
+
dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
|
15514
|
+
dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
|
15515
|
+
|
15516
|
+
// only set the status to dragging, when we are actually dragging
|
15705
15517
|
if (!Sortable.active && !awaitingDragStarted) {
|
15706
15518
|
if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
|
15707
15519
|
return;
|
15708
15520
|
}
|
15709
|
-
|
15710
15521
|
this._onDragStart(evt, true);
|
15711
15522
|
}
|
15712
|
-
|
15713
15523
|
if (ghostEl) {
|
15714
15524
|
if (ghostMatrix) {
|
15715
15525
|
ghostMatrix.e += dx - (lastDx || 0);
|
@@ -15724,7 +15534,6 @@ Sortable.prototype =
|
|
15724
15534
|
f: dy
|
15725
15535
|
};
|
15726
15536
|
}
|
15727
|
-
|
15728
15537
|
var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
|
15729
15538
|
css(ghostEl, 'webkitTransform', cssMatrix);
|
15730
15539
|
css(ghostEl, 'mozTransform', cssMatrix);
|
@@ -15734,7 +15543,6 @@ Sortable.prototype =
|
|
15734
15543
|
lastDy = dy;
|
15735
15544
|
touchEvt = touch;
|
15736
15545
|
}
|
15737
|
-
|
15738
15546
|
evt.cancelable && evt.preventDefault();
|
15739
15547
|
}
|
15740
15548
|
},
|
@@ -15743,17 +15551,16 @@ Sortable.prototype =
|
|
15743
15551
|
// Not being adjusted for
|
15744
15552
|
if (!ghostEl) {
|
15745
15553
|
var container = this.options.fallbackOnBody ? document.body : rootEl,
|
15746
|
-
|
15747
|
-
|
15554
|
+
rect = getRect$1(dragEl, true, PositionGhostAbsolutely, true, container),
|
15555
|
+
options = this.options;
|
15748
15556
|
|
15557
|
+
// Position absolutely
|
15749
15558
|
if (PositionGhostAbsolutely) {
|
15750
15559
|
// Get relatively positioned parent
|
15751
15560
|
ghostRelativeParent = container;
|
15752
|
-
|
15753
15561
|
while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
|
15754
15562
|
ghostRelativeParent = ghostRelativeParent.parentNode;
|
15755
15563
|
}
|
15756
|
-
|
15757
15564
|
if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
|
15758
15565
|
if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
|
15759
15566
|
rect.top += ghostRelativeParent.scrollTop;
|
@@ -15761,10 +15568,8 @@ Sortable.prototype =
|
|
15761
15568
|
} else {
|
15762
15569
|
ghostRelativeParent = getWindowScrollingElement();
|
15763
15570
|
}
|
15764
|
-
|
15765
15571
|
ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
|
15766
15572
|
}
|
15767
|
-
|
15768
15573
|
ghostEl = dragEl.cloneNode(true);
|
15769
15574
|
toggleClass$1(ghostEl, options.ghostClass, false);
|
15770
15575
|
toggleClass$1(ghostEl, options.fallbackClass, true);
|
@@ -15782,61 +15587,50 @@ Sortable.prototype =
|
|
15782
15587
|
css(ghostEl, 'zIndex', '100000');
|
15783
15588
|
css(ghostEl, 'pointerEvents', 'none');
|
15784
15589
|
Sortable.ghost = ghostEl;
|
15785
|
-
container.appendChild(ghostEl);
|
15590
|
+
container.appendChild(ghostEl);
|
15786
15591
|
|
15592
|
+
// Set transform-origin
|
15787
15593
|
css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
|
15788
15594
|
}
|
15789
15595
|
},
|
15790
|
-
_onDragStart: function _onDragStart(
|
15791
|
-
/**Event*/
|
15792
|
-
evt,
|
15793
|
-
/**boolean*/
|
15794
|
-
fallback) {
|
15596
|
+
_onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
|
15795
15597
|
var _this = this;
|
15796
|
-
|
15797
15598
|
var dataTransfer = evt.dataTransfer;
|
15798
15599
|
var options = _this.options;
|
15799
15600
|
pluginEvent('dragStart', this, {
|
15800
15601
|
evt: evt
|
15801
15602
|
});
|
15802
|
-
|
15803
15603
|
if (Sortable.eventCanceled) {
|
15804
15604
|
this._onDrop();
|
15805
|
-
|
15806
15605
|
return;
|
15807
15606
|
}
|
15808
|
-
|
15809
15607
|
pluginEvent('setupClone', this);
|
15810
|
-
|
15811
15608
|
if (!Sortable.eventCanceled) {
|
15812
15609
|
cloneEl = clone(dragEl);
|
15610
|
+
cloneEl.removeAttribute("id");
|
15813
15611
|
cloneEl.draggable = false;
|
15814
15612
|
cloneEl.style['will-change'] = '';
|
15815
|
-
|
15816
15613
|
this._hideClone();
|
15817
|
-
|
15818
15614
|
toggleClass$1(cloneEl, this.options.chosenClass, false);
|
15819
15615
|
Sortable.clone = cloneEl;
|
15820
|
-
}
|
15821
|
-
|
15616
|
+
}
|
15822
15617
|
|
15618
|
+
// #1143: IFrame support workaround
|
15823
15619
|
_this.cloneId = _nextTick(function () {
|
15824
15620
|
pluginEvent('clone', _this);
|
15825
15621
|
if (Sortable.eventCanceled) return;
|
15826
|
-
|
15827
15622
|
if (!_this.options.removeCloneOnHide) {
|
15828
15623
|
rootEl.insertBefore(cloneEl, dragEl);
|
15829
15624
|
}
|
15830
|
-
|
15831
15625
|
_this._hideClone();
|
15832
|
-
|
15833
15626
|
_dispatchEvent({
|
15834
15627
|
sortable: _this,
|
15835
15628
|
name: 'clone'
|
15836
15629
|
});
|
15837
15630
|
});
|
15838
|
-
!fallback && toggleClass$1(dragEl, options.dragClass, true);
|
15631
|
+
!fallback && toggleClass$1(dragEl, options.dragClass, true);
|
15839
15632
|
|
15633
|
+
// Set proper drop events
|
15840
15634
|
if (fallback) {
|
15841
15635
|
ignoreNextClick = true;
|
15842
15636
|
_this._loopId = setInterval(_this._emulateDragOver, 50);
|
@@ -15845,47 +15639,40 @@ Sortable.prototype =
|
|
15845
15639
|
off(document, 'mouseup', _this._onDrop);
|
15846
15640
|
off(document, 'touchend', _this._onDrop);
|
15847
15641
|
off(document, 'touchcancel', _this._onDrop);
|
15848
|
-
|
15849
15642
|
if (dataTransfer) {
|
15850
15643
|
dataTransfer.effectAllowed = 'move';
|
15851
15644
|
options.setData && options.setData.call(_this, dataTransfer, dragEl);
|
15852
15645
|
}
|
15646
|
+
on(document, 'drop', _this);
|
15853
15647
|
|
15854
|
-
|
15855
|
-
|
15648
|
+
// #1276 fix:
|
15856
15649
|
css(dragEl, 'transform', 'translateZ(0)');
|
15857
15650
|
}
|
15858
|
-
|
15859
15651
|
awaitingDragStarted = true;
|
15860
15652
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
15861
15653
|
on(document, 'selectstart', _this);
|
15862
15654
|
moved = true;
|
15863
|
-
|
15864
15655
|
if (Safari) {
|
15865
15656
|
css(document.body, 'user-select', 'none');
|
15866
15657
|
}
|
15867
15658
|
},
|
15868
15659
|
// Returns true - if no further action is needed (either inserted or another condition)
|
15869
|
-
_onDragOver: function _onDragOver(
|
15870
|
-
/**Event*/
|
15871
|
-
evt) {
|
15660
|
+
_onDragOver: function _onDragOver( /**Event*/evt) {
|
15872
15661
|
var el = this.el,
|
15873
|
-
|
15874
|
-
|
15875
|
-
|
15876
|
-
|
15877
|
-
|
15878
|
-
|
15879
|
-
|
15880
|
-
|
15881
|
-
|
15882
|
-
|
15883
|
-
|
15884
|
-
|
15885
|
-
|
15886
|
-
|
15662
|
+
target = evt.target,
|
15663
|
+
dragRect,
|
15664
|
+
targetRect,
|
15665
|
+
revert,
|
15666
|
+
options = this.options,
|
15667
|
+
group = options.group,
|
15668
|
+
activeSortable = Sortable.active,
|
15669
|
+
isOwner = activeGroup === group,
|
15670
|
+
canSort = options.sort,
|
15671
|
+
fromSortable = putSortable || activeSortable,
|
15672
|
+
vertical,
|
15673
|
+
_this = this,
|
15674
|
+
completedFired = false;
|
15887
15675
|
if (_silent) return;
|
15888
|
-
|
15889
15676
|
function dragOverEvent(name, extra) {
|
15890
15677
|
pluginEvent(name, _this, _objectSpread2$1({
|
15891
15678
|
evt: evt,
|
@@ -15903,25 +15690,22 @@ Sortable.prototype =
|
|
15903
15690
|
},
|
15904
15691
|
changed: changed
|
15905
15692
|
}, extra));
|
15906
|
-
}
|
15907
|
-
|
15693
|
+
}
|
15908
15694
|
|
15695
|
+
// Capture animation state
|
15909
15696
|
function capture() {
|
15910
15697
|
dragOverEvent('dragOverAnimationCapture');
|
15911
|
-
|
15912
15698
|
_this.captureAnimationState();
|
15913
|
-
|
15914
15699
|
if (_this !== fromSortable) {
|
15915
15700
|
fromSortable.captureAnimationState();
|
15916
15701
|
}
|
15917
|
-
}
|
15918
|
-
|
15702
|
+
}
|
15919
15703
|
|
15704
|
+
// Return invocation when dragEl is inserted (or completed)
|
15920
15705
|
function completed(insertion) {
|
15921
15706
|
dragOverEvent('dragOverCompleted', {
|
15922
15707
|
insertion: insertion
|
15923
15708
|
});
|
15924
|
-
|
15925
15709
|
if (insertion) {
|
15926
15710
|
// Clones must be hidden before folding animation to capture dragRectAbsolute properly
|
15927
15711
|
if (isOwner) {
|
@@ -15929,57 +15713,51 @@ Sortable.prototype =
|
|
15929
15713
|
} else {
|
15930
15714
|
activeSortable._showClone(_this);
|
15931
15715
|
}
|
15932
|
-
|
15933
15716
|
if (_this !== fromSortable) {
|
15934
15717
|
// Set ghost class to new sortable's ghost class
|
15935
15718
|
toggleClass$1(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
|
15936
15719
|
toggleClass$1(dragEl, options.ghostClass, true);
|
15937
15720
|
}
|
15938
|
-
|
15939
15721
|
if (putSortable !== _this && _this !== Sortable.active) {
|
15940
15722
|
putSortable = _this;
|
15941
15723
|
} else if (_this === Sortable.active && putSortable) {
|
15942
15724
|
putSortable = null;
|
15943
|
-
}
|
15944
|
-
|
15725
|
+
}
|
15945
15726
|
|
15727
|
+
// Animation
|
15946
15728
|
if (fromSortable === _this) {
|
15947
15729
|
_this._ignoreWhileAnimating = target;
|
15948
15730
|
}
|
15949
|
-
|
15950
15731
|
_this.animateAll(function () {
|
15951
15732
|
dragOverEvent('dragOverAnimationComplete');
|
15952
15733
|
_this._ignoreWhileAnimating = null;
|
15953
15734
|
});
|
15954
|
-
|
15955
15735
|
if (_this !== fromSortable) {
|
15956
15736
|
fromSortable.animateAll();
|
15957
15737
|
fromSortable._ignoreWhileAnimating = null;
|
15958
15738
|
}
|
15959
|
-
}
|
15960
|
-
|
15739
|
+
}
|
15961
15740
|
|
15741
|
+
// Null lastTarget if it is not inside a previously swapped element
|
15962
15742
|
if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
|
15963
15743
|
lastTarget = null;
|
15964
|
-
}
|
15965
|
-
|
15744
|
+
}
|
15966
15745
|
|
15746
|
+
// no bubbling and not fallback
|
15967
15747
|
if (!options.dragoverBubble && !evt.rootEl && target !== document) {
|
15968
|
-
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
15969
|
-
|
15748
|
+
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
15970
15749
|
|
15750
|
+
// Do not detect for empty insert if already inserted
|
15971
15751
|
!insertion && nearestEmptyInsertDetectEvent(evt);
|
15972
15752
|
}
|
15973
|
-
|
15974
15753
|
!options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
|
15975
15754
|
return completedFired = true;
|
15976
|
-
}
|
15977
|
-
|
15755
|
+
}
|
15978
15756
|
|
15757
|
+
// Call when dragEl has been inserted
|
15979
15758
|
function changed() {
|
15980
15759
|
newIndex = index(dragEl);
|
15981
15760
|
newDraggableIndex = index(dragEl, options.draggable);
|
15982
|
-
|
15983
15761
|
_dispatchEvent({
|
15984
15762
|
sortable: _this,
|
15985
15763
|
name: 'change',
|
@@ -15989,37 +15767,27 @@ Sortable.prototype =
|
|
15989
15767
|
originalEvent: evt
|
15990
15768
|
});
|
15991
15769
|
}
|
15992
|
-
|
15993
15770
|
if (evt.preventDefault !== void 0) {
|
15994
15771
|
evt.cancelable && evt.preventDefault();
|
15995
15772
|
}
|
15996
|
-
|
15997
15773
|
target = closest(target, options.draggable, el, true);
|
15998
15774
|
dragOverEvent('dragOver');
|
15999
15775
|
if (Sortable.eventCanceled) return completedFired;
|
16000
|
-
|
16001
15776
|
if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
|
16002
15777
|
return completed(false);
|
16003
15778
|
}
|
16004
|
-
|
16005
15779
|
ignoreNextClick = false;
|
16006
|
-
|
16007
15780
|
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
|
16008
15781
|
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
|
16009
15782
|
vertical = this._getDirection(evt, target) === 'vertical';
|
16010
15783
|
dragRect = getRect$1(dragEl);
|
16011
15784
|
dragOverEvent('dragOverValid');
|
16012
15785
|
if (Sortable.eventCanceled) return completedFired;
|
16013
|
-
|
16014
15786
|
if (revert) {
|
16015
15787
|
parentEl = rootEl; // actualization
|
16016
|
-
|
16017
15788
|
capture();
|
16018
|
-
|
16019
15789
|
this._hideClone();
|
16020
|
-
|
16021
15790
|
dragOverEvent('revert');
|
16022
|
-
|
16023
15791
|
if (!Sortable.eventCanceled) {
|
16024
15792
|
if (nextEl) {
|
16025
15793
|
rootEl.insertBefore(dragEl, nextEl);
|
@@ -16027,31 +15795,32 @@ Sortable.prototype =
|
|
16027
15795
|
rootEl.appendChild(dragEl);
|
16028
15796
|
}
|
16029
15797
|
}
|
16030
|
-
|
16031
15798
|
return completed(true);
|
16032
15799
|
}
|
16033
|
-
|
16034
15800
|
var elLastChild = lastChild(el, options.draggable);
|
16035
|
-
|
16036
15801
|
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
|
16037
15802
|
// Insert to end of list
|
15803
|
+
|
16038
15804
|
// If already at end of list: Do not insert
|
16039
15805
|
if (elLastChild === dragEl) {
|
16040
15806
|
return completed(false);
|
16041
|
-
}
|
16042
|
-
|
15807
|
+
}
|
16043
15808
|
|
15809
|
+
// if there is a last element, it is the target
|
16044
15810
|
if (elLastChild && el === evt.target) {
|
16045
15811
|
target = elLastChild;
|
16046
15812
|
}
|
16047
|
-
|
16048
15813
|
if (target) {
|
16049
15814
|
targetRect = getRect$1(target);
|
16050
15815
|
}
|
16051
|
-
|
16052
15816
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
16053
15817
|
capture();
|
16054
|
-
|
15818
|
+
if (elLastChild && elLastChild.nextSibling) {
|
15819
|
+
// the last draggable element is not the last node
|
15820
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
15821
|
+
} else {
|
15822
|
+
el.appendChild(dragEl);
|
15823
|
+
}
|
16055
15824
|
parentEl = el; // actualization
|
16056
15825
|
|
16057
15826
|
changed();
|
@@ -16060,14 +15829,11 @@ Sortable.prototype =
|
|
16060
15829
|
} else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
|
16061
15830
|
// Insert to start of list
|
16062
15831
|
var firstChild = getChild(el, 0, options, true);
|
16063
|
-
|
16064
15832
|
if (firstChild === dragEl) {
|
16065
15833
|
return completed(false);
|
16066
15834
|
}
|
16067
|
-
|
16068
15835
|
target = firstChild;
|
16069
15836
|
targetRect = getRect$1(target);
|
16070
|
-
|
16071
15837
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
|
16072
15838
|
capture();
|
16073
15839
|
el.insertBefore(dragEl, firstChild);
|
@@ -16079,82 +15845,68 @@ Sortable.prototype =
|
|
16079
15845
|
} else if (target.parentNode === el) {
|
16080
15846
|
targetRect = getRect$1(target);
|
16081
15847
|
var direction = 0,
|
16082
|
-
|
16083
|
-
|
16084
|
-
|
16085
|
-
|
16086
|
-
|
16087
|
-
|
16088
|
-
|
15848
|
+
targetBeforeFirstSwap,
|
15849
|
+
differentLevel = dragEl.parentNode !== el,
|
15850
|
+
differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
|
15851
|
+
side1 = vertical ? 'top' : 'left',
|
15852
|
+
scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
|
15853
|
+
scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
|
16089
15854
|
if (lastTarget !== target) {
|
16090
15855
|
targetBeforeFirstSwap = targetRect[side1];
|
16091
15856
|
pastFirstInvertThresh = false;
|
16092
15857
|
isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
|
16093
15858
|
}
|
16094
|
-
|
16095
15859
|
direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
|
16096
15860
|
var sibling;
|
16097
|
-
|
16098
15861
|
if (direction !== 0) {
|
16099
15862
|
// Check if target is beside dragEl in respective direction (ignoring hidden elements)
|
16100
15863
|
var dragIndex = index(dragEl);
|
16101
|
-
|
16102
15864
|
do {
|
16103
15865
|
dragIndex -= direction;
|
16104
15866
|
sibling = parentEl.children[dragIndex];
|
16105
15867
|
} while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
|
16106
|
-
}
|
16107
|
-
|
16108
|
-
|
15868
|
+
}
|
15869
|
+
// If dragEl is already beside target: Do not insert
|
16109
15870
|
if (direction === 0 || sibling === target) {
|
16110
15871
|
return completed(false);
|
16111
15872
|
}
|
16112
|
-
|
16113
15873
|
lastTarget = target;
|
16114
15874
|
lastDirection = direction;
|
16115
15875
|
var nextSibling = target.nextElementSibling,
|
16116
|
-
|
15876
|
+
after = false;
|
16117
15877
|
after = direction === 1;
|
16118
|
-
|
16119
15878
|
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
|
16120
|
-
|
16121
15879
|
if (moveVector !== false) {
|
16122
15880
|
if (moveVector === 1 || moveVector === -1) {
|
16123
15881
|
after = moveVector === 1;
|
16124
15882
|
}
|
16125
|
-
|
16126
15883
|
_silent = true;
|
16127
15884
|
setTimeout(_unsilent, 30);
|
16128
15885
|
capture();
|
16129
|
-
|
16130
15886
|
if (after && !nextSibling) {
|
16131
15887
|
el.appendChild(dragEl);
|
16132
15888
|
} else {
|
16133
15889
|
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
|
16134
|
-
}
|
16135
|
-
|
15890
|
+
}
|
16136
15891
|
|
15892
|
+
// Undo chrome's scroll adjustment (has no effect on other browsers)
|
16137
15893
|
if (scrolledPastTop) {
|
16138
15894
|
scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
|
16139
15895
|
}
|
16140
|
-
|
16141
15896
|
parentEl = dragEl.parentNode; // actualization
|
16142
|
-
// must be done before animation
|
16143
15897
|
|
15898
|
+
// must be done before animation
|
16144
15899
|
if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
|
16145
15900
|
targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect$1(target)[side1]);
|
16146
15901
|
}
|
16147
|
-
|
16148
15902
|
changed();
|
16149
15903
|
return completed(true);
|
16150
15904
|
}
|
16151
15905
|
}
|
16152
|
-
|
16153
15906
|
if (el.contains(dragEl)) {
|
16154
15907
|
return completed(false);
|
16155
15908
|
}
|
16156
15909
|
}
|
16157
|
-
|
16158
15910
|
return false;
|
16159
15911
|
},
|
16160
15912
|
_ignoreWhileAnimating: null,
|
@@ -16174,83 +15926,69 @@ Sortable.prototype =
|
|
16174
15926
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
16175
15927
|
off(document, 'selectstart', this);
|
16176
15928
|
},
|
16177
|
-
_onDrop: function _onDrop(
|
16178
|
-
/**Event*/
|
16179
|
-
evt) {
|
15929
|
+
_onDrop: function _onDrop( /**Event*/evt) {
|
16180
15930
|
var el = this.el,
|
16181
|
-
|
15931
|
+
options = this.options;
|
16182
15932
|
|
15933
|
+
// Get the index of the dragged element within its parent
|
16183
15934
|
newIndex = index(dragEl);
|
16184
15935
|
newDraggableIndex = index(dragEl, options.draggable);
|
16185
15936
|
pluginEvent('drop', this, {
|
16186
15937
|
evt: evt
|
16187
15938
|
});
|
16188
|
-
parentEl = dragEl && dragEl.parentNode;
|
15939
|
+
parentEl = dragEl && dragEl.parentNode;
|
16189
15940
|
|
15941
|
+
// Get again after plugin event
|
16190
15942
|
newIndex = index(dragEl);
|
16191
15943
|
newDraggableIndex = index(dragEl, options.draggable);
|
16192
|
-
|
16193
15944
|
if (Sortable.eventCanceled) {
|
16194
15945
|
this._nulling();
|
16195
|
-
|
16196
15946
|
return;
|
16197
15947
|
}
|
16198
|
-
|
16199
15948
|
awaitingDragStarted = false;
|
16200
15949
|
isCircumstantialInvert = false;
|
16201
15950
|
pastFirstInvertThresh = false;
|
16202
15951
|
clearInterval(this._loopId);
|
16203
15952
|
clearTimeout(this._dragStartTimer);
|
16204
|
-
|
16205
15953
|
_cancelNextTick(this.cloneId);
|
15954
|
+
_cancelNextTick(this._dragStartId);
|
16206
15955
|
|
16207
|
-
|
16208
|
-
|
16209
|
-
|
15956
|
+
// Unbind events
|
16210
15957
|
if (this.nativeDraggable) {
|
16211
15958
|
off(document, 'drop', this);
|
16212
15959
|
off(el, 'dragstart', this._onDragStart);
|
16213
15960
|
}
|
16214
|
-
|
16215
15961
|
this._offMoveEvents();
|
16216
|
-
|
16217
15962
|
this._offUpEvents();
|
16218
|
-
|
16219
15963
|
if (Safari) {
|
16220
15964
|
css(document.body, 'user-select', '');
|
16221
15965
|
}
|
16222
|
-
|
16223
15966
|
css(dragEl, 'transform', '');
|
16224
|
-
|
16225
15967
|
if (evt) {
|
16226
15968
|
if (moved) {
|
16227
15969
|
evt.cancelable && evt.preventDefault();
|
16228
15970
|
!options.dropBubble && evt.stopPropagation();
|
16229
15971
|
}
|
16230
|
-
|
16231
15972
|
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
|
16232
|
-
|
16233
15973
|
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
|
16234
15974
|
// Remove clone(s)
|
16235
15975
|
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
|
16236
15976
|
}
|
16237
|
-
|
16238
15977
|
if (dragEl) {
|
16239
15978
|
if (this.nativeDraggable) {
|
16240
15979
|
off(dragEl, 'dragend', this);
|
16241
15980
|
}
|
16242
|
-
|
16243
15981
|
_disableDraggable(dragEl);
|
15982
|
+
dragEl.style['will-change'] = '';
|
16244
15983
|
|
16245
|
-
|
15984
|
+
// Remove classes
|
16246
15985
|
// ghostClass is added in dragStarted
|
16247
|
-
|
16248
15986
|
if (moved && !awaitingDragStarted) {
|
16249
15987
|
toggleClass$1(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
|
16250
15988
|
}
|
15989
|
+
toggleClass$1(dragEl, this.options.chosenClass, false);
|
16251
15990
|
|
16252
|
-
|
16253
|
-
|
15991
|
+
// Drag stop event
|
16254
15992
|
_dispatchEvent({
|
16255
15993
|
sortable: this,
|
16256
15994
|
name: 'unchoose',
|
@@ -16259,7 +15997,6 @@ Sortable.prototype =
|
|
16259
15997
|
newDraggableIndex: null,
|
16260
15998
|
originalEvent: evt
|
16261
15999
|
});
|
16262
|
-
|
16263
16000
|
if (rootEl !== parentEl) {
|
16264
16001
|
if (newIndex >= 0) {
|
16265
16002
|
// Add event
|
@@ -16269,17 +16006,17 @@ Sortable.prototype =
|
|
16269
16006
|
toEl: parentEl,
|
16270
16007
|
fromEl: rootEl,
|
16271
16008
|
originalEvent: evt
|
16272
|
-
});
|
16273
|
-
|
16009
|
+
});
|
16274
16010
|
|
16011
|
+
// Remove event
|
16275
16012
|
_dispatchEvent({
|
16276
16013
|
sortable: this,
|
16277
16014
|
name: 'remove',
|
16278
16015
|
toEl: parentEl,
|
16279
16016
|
originalEvent: evt
|
16280
|
-
});
|
16281
|
-
|
16017
|
+
});
|
16282
16018
|
|
16019
|
+
// drag from one list and drop into another
|
16283
16020
|
_dispatchEvent({
|
16284
16021
|
rootEl: parentEl,
|
16285
16022
|
name: 'sort',
|
@@ -16287,7 +16024,6 @@ Sortable.prototype =
|
|
16287
16024
|
fromEl: rootEl,
|
16288
16025
|
originalEvent: evt
|
16289
16026
|
});
|
16290
|
-
|
16291
16027
|
_dispatchEvent({
|
16292
16028
|
sortable: this,
|
16293
16029
|
name: 'sort',
|
@@ -16295,7 +16031,6 @@ Sortable.prototype =
|
|
16295
16031
|
originalEvent: evt
|
16296
16032
|
});
|
16297
16033
|
}
|
16298
|
-
|
16299
16034
|
putSortable && putSortable.save();
|
16300
16035
|
} else {
|
16301
16036
|
if (newIndex !== oldIndex) {
|
@@ -16307,7 +16042,6 @@ Sortable.prototype =
|
|
16307
16042
|
toEl: parentEl,
|
16308
16043
|
originalEvent: evt
|
16309
16044
|
});
|
16310
|
-
|
16311
16045
|
_dispatchEvent({
|
16312
16046
|
sortable: this,
|
16313
16047
|
name: 'sort',
|
@@ -16317,27 +16051,24 @@ Sortable.prototype =
|
|
16317
16051
|
}
|
16318
16052
|
}
|
16319
16053
|
}
|
16320
|
-
|
16321
16054
|
if (Sortable.active) {
|
16322
16055
|
/* jshint eqnull:true */
|
16323
16056
|
if (newIndex == null || newIndex === -1) {
|
16324
16057
|
newIndex = oldIndex;
|
16325
16058
|
newDraggableIndex = oldDraggableIndex;
|
16326
16059
|
}
|
16327
|
-
|
16328
16060
|
_dispatchEvent({
|
16329
16061
|
sortable: this,
|
16330
16062
|
name: 'end',
|
16331
16063
|
toEl: parentEl,
|
16332
16064
|
originalEvent: evt
|
16333
|
-
});
|
16334
|
-
|
16065
|
+
});
|
16335
16066
|
|
16067
|
+
// Save sorting
|
16336
16068
|
this.save();
|
16337
16069
|
}
|
16338
16070
|
}
|
16339
16071
|
}
|
16340
|
-
|
16341
16072
|
this._nulling();
|
16342
16073
|
},
|
16343
16074
|
_nulling: function _nulling() {
|
@@ -16348,65 +16079,52 @@ Sortable.prototype =
|
|
16348
16079
|
});
|
16349
16080
|
savedInputChecked.length = lastDx = lastDy = 0;
|
16350
16081
|
},
|
16351
|
-
handleEvent: function handleEvent(
|
16352
|
-
/**Event*/
|
16353
|
-
evt) {
|
16082
|
+
handleEvent: function handleEvent( /**Event*/evt) {
|
16354
16083
|
switch (evt.type) {
|
16355
16084
|
case 'drop':
|
16356
16085
|
case 'dragend':
|
16357
16086
|
this._onDrop(evt);
|
16358
|
-
|
16359
16087
|
break;
|
16360
|
-
|
16361
16088
|
case 'dragenter':
|
16362
16089
|
case 'dragover':
|
16363
16090
|
if (dragEl) {
|
16364
16091
|
this._onDragOver(evt);
|
16365
|
-
|
16366
16092
|
_globalDragOver(evt);
|
16367
16093
|
}
|
16368
|
-
|
16369
16094
|
break;
|
16370
|
-
|
16371
16095
|
case 'selectstart':
|
16372
16096
|
evt.preventDefault();
|
16373
16097
|
break;
|
16374
16098
|
}
|
16375
16099
|
},
|
16376
|
-
|
16377
|
-
|
16378
|
-
*
|
16379
|
-
* @returns {String[]}
|
16100
|
+
/**
|
16101
|
+
* Serializes the item into an array of string.
|
16102
|
+
* @returns {String[]}
|
16380
16103
|
*/
|
16381
16104
|
toArray: function toArray() {
|
16382
16105
|
var order = [],
|
16383
|
-
|
16384
|
-
|
16385
|
-
|
16386
|
-
|
16387
|
-
|
16388
|
-
|
16106
|
+
el,
|
16107
|
+
children = this.el.children,
|
16108
|
+
i = 0,
|
16109
|
+
n = children.length,
|
16110
|
+
options = this.options;
|
16389
16111
|
for (; i < n; i++) {
|
16390
16112
|
el = children[i];
|
16391
|
-
|
16392
16113
|
if (closest(el, options.draggable, this.el, false)) {
|
16393
16114
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
16394
16115
|
}
|
16395
16116
|
}
|
16396
|
-
|
16397
16117
|
return order;
|
16398
16118
|
},
|
16399
|
-
|
16400
|
-
|
16401
|
-
*
|
16402
|
-
* @param {String[]} order order of the items
|
16119
|
+
/**
|
16120
|
+
* Sorts the elements according to the array.
|
16121
|
+
* @param {String[]} order order of the items
|
16403
16122
|
*/
|
16404
16123
|
sort: function sort(order, useAnimation) {
|
16405
16124
|
var items = {},
|
16406
|
-
|
16125
|
+
rootEl = this.el;
|
16407
16126
|
this.toArray().forEach(function (id, i) {
|
16408
16127
|
var el = rootEl.children[i];
|
16409
|
-
|
16410
16128
|
if (closest(el, this.options.draggable, rootEl, false)) {
|
16411
16129
|
items[id] = el;
|
16412
16130
|
}
|
@@ -16420,53 +16138,46 @@ Sortable.prototype =
|
|
16420
16138
|
});
|
16421
16139
|
useAnimation && this.animateAll();
|
16422
16140
|
},
|
16423
|
-
|
16424
|
-
|
16425
|
-
* Save the current sorting
|
16141
|
+
/**
|
16142
|
+
* Save the current sorting
|
16426
16143
|
*/
|
16427
16144
|
save: function save() {
|
16428
16145
|
var store = this.options.store;
|
16429
16146
|
store && store.set && store.set(this);
|
16430
16147
|
},
|
16431
|
-
|
16432
|
-
|
16433
|
-
*
|
16434
|
-
* @param {
|
16435
|
-
* @
|
16436
|
-
* @returns {HTMLElement|null}
|
16148
|
+
/**
|
16149
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
16150
|
+
* @param {HTMLElement} el
|
16151
|
+
* @param {String} [selector] default: `options.draggable`
|
16152
|
+
* @returns {HTMLElement|null}
|
16437
16153
|
*/
|
16438
16154
|
closest: function closest$1(el, selector) {
|
16439
16155
|
return closest(el, selector || this.options.draggable, this.el, false);
|
16440
16156
|
},
|
16441
|
-
|
16442
|
-
|
16443
|
-
*
|
16444
|
-
* @param {
|
16445
|
-
* @
|
16446
|
-
* @returns {*}
|
16157
|
+
/**
|
16158
|
+
* Set/get option
|
16159
|
+
* @param {string} name
|
16160
|
+
* @param {*} [value]
|
16161
|
+
* @returns {*}
|
16447
16162
|
*/
|
16448
16163
|
option: function option(name, value) {
|
16449
16164
|
var options = this.options;
|
16450
|
-
|
16451
16165
|
if (value === void 0) {
|
16452
16166
|
return options[name];
|
16453
16167
|
} else {
|
16454
16168
|
var modifiedValue = PluginManager.modifyOption(this, name, value);
|
16455
|
-
|
16456
16169
|
if (typeof modifiedValue !== 'undefined') {
|
16457
16170
|
options[name] = modifiedValue;
|
16458
16171
|
} else {
|
16459
16172
|
options[name] = value;
|
16460
16173
|
}
|
16461
|
-
|
16462
16174
|
if (name === 'group') {
|
16463
16175
|
_prepareGroup(options);
|
16464
16176
|
}
|
16465
16177
|
}
|
16466
16178
|
},
|
16467
|
-
|
16468
|
-
|
16469
|
-
* Destroy
|
16179
|
+
/**
|
16180
|
+
* Destroy
|
16470
16181
|
*/
|
16471
16182
|
destroy: function destroy() {
|
16472
16183
|
pluginEvent('destroy', this);
|
@@ -16475,21 +16186,16 @@ Sortable.prototype =
|
|
16475
16186
|
off(el, 'mousedown', this._onTapStart);
|
16476
16187
|
off(el, 'touchstart', this._onTapStart);
|
16477
16188
|
off(el, 'pointerdown', this._onTapStart);
|
16478
|
-
|
16479
16189
|
if (this.nativeDraggable) {
|
16480
16190
|
off(el, 'dragover', this);
|
16481
16191
|
off(el, 'dragenter', this);
|
16482
|
-
}
|
16483
|
-
|
16484
|
-
|
16192
|
+
}
|
16193
|
+
// Remove draggable attributes
|
16485
16194
|
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
|
16486
16195
|
el.removeAttribute('draggable');
|
16487
16196
|
});
|
16488
|
-
|
16489
16197
|
this._onDrop();
|
16490
|
-
|
16491
16198
|
this._disableDelayedDragEvents();
|
16492
|
-
|
16493
16199
|
sortables.splice(sortables.indexOf(this.el), 1);
|
16494
16200
|
this.el = el = null;
|
16495
16201
|
},
|
@@ -16498,25 +16204,22 @@ Sortable.prototype =
|
|
16498
16204
|
pluginEvent('hideClone', this);
|
16499
16205
|
if (Sortable.eventCanceled) return;
|
16500
16206
|
css(cloneEl, 'display', 'none');
|
16501
|
-
|
16502
16207
|
if (this.options.removeCloneOnHide && cloneEl.parentNode) {
|
16503
16208
|
cloneEl.parentNode.removeChild(cloneEl);
|
16504
16209
|
}
|
16505
|
-
|
16506
16210
|
cloneHidden = true;
|
16507
16211
|
}
|
16508
16212
|
},
|
16509
16213
|
_showClone: function _showClone(putSortable) {
|
16510
16214
|
if (putSortable.lastPutMode !== 'clone') {
|
16511
16215
|
this._hideClone();
|
16512
|
-
|
16513
16216
|
return;
|
16514
16217
|
}
|
16515
|
-
|
16516
16218
|
if (cloneHidden) {
|
16517
16219
|
pluginEvent('showClone', this);
|
16518
|
-
if (Sortable.eventCanceled) return;
|
16220
|
+
if (Sortable.eventCanceled) return;
|
16519
16221
|
|
16222
|
+
// show clone at dragEl or original position
|
16520
16223
|
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
|
16521
16224
|
rootEl.insertBefore(cloneEl, dragEl);
|
16522
16225
|
} else if (nextEl) {
|
@@ -16524,33 +16227,26 @@ Sortable.prototype =
|
|
16524
16227
|
} else {
|
16525
16228
|
rootEl.appendChild(cloneEl);
|
16526
16229
|
}
|
16527
|
-
|
16528
16230
|
if (this.options.group.revertClone) {
|
16529
16231
|
this.animate(dragEl, cloneEl);
|
16530
16232
|
}
|
16531
|
-
|
16532
16233
|
css(cloneEl, 'display', '');
|
16533
16234
|
cloneHidden = false;
|
16534
16235
|
}
|
16535
16236
|
}
|
16536
16237
|
};
|
16537
|
-
|
16538
|
-
function _globalDragOver(
|
16539
|
-
/**Event*/
|
16540
|
-
evt) {
|
16238
|
+
function _globalDragOver( /**Event*/evt) {
|
16541
16239
|
if (evt.dataTransfer) {
|
16542
16240
|
evt.dataTransfer.dropEffect = 'move';
|
16543
16241
|
}
|
16544
|
-
|
16545
16242
|
evt.cancelable && evt.preventDefault();
|
16546
16243
|
}
|
16547
|
-
|
16548
16244
|
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
|
16549
16245
|
var evt,
|
16550
|
-
|
16551
|
-
|
16552
|
-
|
16553
|
-
|
16246
|
+
sortable = fromEl[expando],
|
16247
|
+
onMoveFn = sortable.options.onMove,
|
16248
|
+
retVal;
|
16249
|
+
// Support for new CustomEvent feature
|
16554
16250
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
16555
16251
|
evt = new CustomEvent('move', {
|
16556
16252
|
bubbles: true,
|
@@ -16560,7 +16256,6 @@ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalE
|
|
16560
16256
|
evt = document.createEvent('Event');
|
16561
16257
|
evt.initEvent('move', true, true);
|
16562
16258
|
}
|
16563
|
-
|
16564
16259
|
evt.to = toEl;
|
16565
16260
|
evt.from = fromEl;
|
16566
16261
|
evt.dragged = dragEl;
|
@@ -16570,41 +16265,35 @@ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalE
|
|
16570
16265
|
evt.willInsertAfter = willInsertAfter;
|
16571
16266
|
evt.originalEvent = originalEvent;
|
16572
16267
|
fromEl.dispatchEvent(evt);
|
16573
|
-
|
16574
16268
|
if (onMoveFn) {
|
16575
16269
|
retVal = onMoveFn.call(sortable, evt, originalEvent);
|
16576
16270
|
}
|
16577
|
-
|
16578
16271
|
return retVal;
|
16579
16272
|
}
|
16580
|
-
|
16581
16273
|
function _disableDraggable(el) {
|
16582
16274
|
el.draggable = false;
|
16583
16275
|
}
|
16584
|
-
|
16585
16276
|
function _unsilent() {
|
16586
16277
|
_silent = false;
|
16587
16278
|
}
|
16588
|
-
|
16589
16279
|
function _ghostIsFirst(evt, vertical, sortable) {
|
16590
|
-
var
|
16280
|
+
var firstElRect = getRect$1(getChild(sortable.el, 0, sortable.options, true));
|
16281
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
16591
16282
|
var spacer = 10;
|
16592
|
-
return vertical ? evt.clientX <
|
16283
|
+
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
|
16593
16284
|
}
|
16594
|
-
|
16595
16285
|
function _ghostIsLast(evt, vertical, sortable) {
|
16596
|
-
var
|
16286
|
+
var lastElRect = getRect$1(lastChild(sortable.el, sortable.options.draggable));
|
16287
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
16597
16288
|
var spacer = 10;
|
16598
|
-
return vertical ? evt.clientX >
|
16289
|
+
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
|
16599
16290
|
}
|
16600
|
-
|
16601
16291
|
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
|
16602
16292
|
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
|
16603
|
-
|
16604
|
-
|
16605
|
-
|
16606
|
-
|
16607
|
-
|
16293
|
+
targetLength = vertical ? targetRect.height : targetRect.width,
|
16294
|
+
targetS1 = vertical ? targetRect.top : targetRect.left,
|
16295
|
+
targetS2 = vertical ? targetRect.bottom : targetRect.right,
|
16296
|
+
invert = false;
|
16608
16297
|
if (!invertSwap) {
|
16609
16298
|
// Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
|
16610
16299
|
if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
|
@@ -16614,7 +16303,6 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
16614
16303
|
// past first invert threshold, do not restrict inverted threshold to dragEl shadow
|
16615
16304
|
pastFirstInvertThresh = true;
|
16616
16305
|
}
|
16617
|
-
|
16618
16306
|
if (!pastFirstInvertThresh) {
|
16619
16307
|
// dragEl shadow (target move distance shadow)
|
16620
16308
|
if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
|
@@ -16631,26 +16319,22 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
16631
16319
|
}
|
16632
16320
|
}
|
16633
16321
|
}
|
16634
|
-
|
16635
16322
|
invert = invert || invertSwap;
|
16636
|
-
|
16637
16323
|
if (invert) {
|
16638
16324
|
// Invert of regular
|
16639
16325
|
if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
|
16640
16326
|
return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
|
16641
16327
|
}
|
16642
16328
|
}
|
16643
|
-
|
16644
16329
|
return 0;
|
16645
16330
|
}
|
16646
|
-
/**
|
16647
|
-
* Gets the direction dragEl must be swapped relative to target in order to make it
|
16648
|
-
* seem that dragEl has been "inserted" into that element's position
|
16649
|
-
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
16650
|
-
* @return {Number} Direction dragEl must be swapped
|
16651
|
-
*/
|
16652
|
-
|
16653
16331
|
|
16332
|
+
/**
|
16333
|
+
* Gets the direction dragEl must be swapped relative to target in order to make it
|
16334
|
+
* seem that dragEl has been "inserted" into that element's position
|
16335
|
+
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
16336
|
+
* @return {Number} Direction dragEl must be swapped
|
16337
|
+
*/
|
16654
16338
|
function _getInsertDirection(target) {
|
16655
16339
|
if (index(dragEl) < index(target)) {
|
16656
16340
|
return 1;
|
@@ -16658,55 +16342,48 @@ function _getInsertDirection(target) {
|
|
16658
16342
|
return -1;
|
16659
16343
|
}
|
16660
16344
|
}
|
16661
|
-
/**
|
16662
|
-
* Generate id
|
16663
|
-
* @param {HTMLElement} el
|
16664
|
-
* @returns {String}
|
16665
|
-
* @private
|
16666
|
-
*/
|
16667
|
-
|
16668
16345
|
|
16346
|
+
/**
|
16347
|
+
* Generate id
|
16348
|
+
* @param {HTMLElement} el
|
16349
|
+
* @returns {String}
|
16350
|
+
* @private
|
16351
|
+
*/
|
16669
16352
|
function _generateId(el) {
|
16670
16353
|
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
16671
|
-
|
16672
|
-
|
16673
|
-
|
16354
|
+
i = str.length,
|
16355
|
+
sum = 0;
|
16674
16356
|
while (i--) {
|
16675
16357
|
sum += str.charCodeAt(i);
|
16676
16358
|
}
|
16677
|
-
|
16678
16359
|
return sum.toString(36);
|
16679
16360
|
}
|
16680
|
-
|
16681
16361
|
function _saveInputCheckedState(root) {
|
16682
16362
|
savedInputChecked.length = 0;
|
16683
16363
|
var inputs = root.getElementsByTagName('input');
|
16684
16364
|
var idx = inputs.length;
|
16685
|
-
|
16686
16365
|
while (idx--) {
|
16687
16366
|
var el = inputs[idx];
|
16688
16367
|
el.checked && savedInputChecked.push(el);
|
16689
16368
|
}
|
16690
16369
|
}
|
16691
|
-
|
16692
16370
|
function _nextTick(fn) {
|
16693
16371
|
return setTimeout(fn, 0);
|
16694
16372
|
}
|
16695
|
-
|
16696
16373
|
function _cancelNextTick(id) {
|
16697
16374
|
return clearTimeout(id);
|
16698
|
-
}
|
16699
|
-
|
16375
|
+
}
|
16700
16376
|
|
16377
|
+
// Fixed #973:
|
16701
16378
|
if (documentExists) {
|
16702
16379
|
on(document, 'touchmove', function (evt) {
|
16703
16380
|
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
|
16704
16381
|
evt.preventDefault();
|
16705
16382
|
}
|
16706
16383
|
});
|
16707
|
-
}
|
16708
|
-
|
16384
|
+
}
|
16709
16385
|
|
16386
|
+
// Export utils
|
16710
16387
|
Sortable.utils = {
|
16711
16388
|
on: on,
|
16712
16389
|
off: off,
|
@@ -16726,59 +16403,54 @@ Sortable.utils = {
|
|
16726
16403
|
detectDirection: _detectDirection,
|
16727
16404
|
getChild: getChild
|
16728
16405
|
};
|
16729
|
-
/**
|
16730
|
-
* Get the Sortable instance of an element
|
16731
|
-
* @param {HTMLElement} element The element
|
16732
|
-
* @return {Sortable|undefined} The instance of Sortable
|
16733
|
-
*/
|
16734
16406
|
|
16407
|
+
/**
|
16408
|
+
* Get the Sortable instance of an element
|
16409
|
+
* @param {HTMLElement} element The element
|
16410
|
+
* @return {Sortable|undefined} The instance of Sortable
|
16411
|
+
*/
|
16735
16412
|
Sortable.get = function (element) {
|
16736
16413
|
return element[expando];
|
16737
16414
|
};
|
16738
|
-
/**
|
16739
|
-
* Mount a plugin to Sortable
|
16740
|
-
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
16741
|
-
*/
|
16742
|
-
|
16743
16415
|
|
16416
|
+
/**
|
16417
|
+
* Mount a plugin to Sortable
|
16418
|
+
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
16419
|
+
*/
|
16744
16420
|
Sortable.mount = function () {
|
16745
16421
|
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
|
16746
16422
|
plugins[_key] = arguments[_key];
|
16747
16423
|
}
|
16748
|
-
|
16749
16424
|
if (plugins[0].constructor === Array) plugins = plugins[0];
|
16750
16425
|
plugins.forEach(function (plugin) {
|
16751
16426
|
if (!plugin.prototype || !plugin.prototype.constructor) {
|
16752
16427
|
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
|
16753
16428
|
}
|
16754
|
-
|
16755
16429
|
if (plugin.utils) Sortable.utils = _objectSpread2$1(_objectSpread2$1({}, Sortable.utils), plugin.utils);
|
16756
16430
|
PluginManager.mount(plugin);
|
16757
16431
|
});
|
16758
16432
|
};
|
16759
|
-
/**
|
16760
|
-
* Create sortable instance
|
16761
|
-
* @param {HTMLElement} el
|
16762
|
-
* @param {Object} [options]
|
16763
|
-
*/
|
16764
|
-
|
16765
16433
|
|
16434
|
+
/**
|
16435
|
+
* Create sortable instance
|
16436
|
+
* @param {HTMLElement} el
|
16437
|
+
* @param {Object} [options]
|
16438
|
+
*/
|
16766
16439
|
Sortable.create = function (el, options) {
|
16767
16440
|
return new Sortable(el, options);
|
16768
|
-
};
|
16769
|
-
|
16441
|
+
};
|
16770
16442
|
|
16443
|
+
// Export
|
16771
16444
|
Sortable.version = version$1;
|
16772
16445
|
|
16773
16446
|
var autoScrolls = [],
|
16774
|
-
|
16775
|
-
|
16776
|
-
|
16777
|
-
|
16778
|
-
|
16779
|
-
|
16780
|
-
|
16781
|
-
|
16447
|
+
scrollEl,
|
16448
|
+
scrollRootEl,
|
16449
|
+
scrolling = false,
|
16450
|
+
lastAutoScrollX,
|
16451
|
+
lastAutoScrollY,
|
16452
|
+
touchEvt$1,
|
16453
|
+
pointerElemChangedInterval;
|
16782
16454
|
function AutoScrollPlugin() {
|
16783
16455
|
function AutoScroll() {
|
16784
16456
|
this.defaults = {
|
@@ -16787,19 +16459,18 @@ function AutoScrollPlugin() {
|
|
16787
16459
|
scrollSensitivity: 30,
|
16788
16460
|
scrollSpeed: 10,
|
16789
16461
|
bubbleScroll: true
|
16790
|
-
};
|
16462
|
+
};
|
16791
16463
|
|
16464
|
+
// Bind all private methods
|
16792
16465
|
for (var fn in this) {
|
16793
16466
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
16794
16467
|
this[fn] = this[fn].bind(this);
|
16795
16468
|
}
|
16796
16469
|
}
|
16797
16470
|
}
|
16798
|
-
|
16799
16471
|
AutoScroll.prototype = {
|
16800
16472
|
dragStarted: function dragStarted(_ref) {
|
16801
16473
|
var originalEvent = _ref.originalEvent;
|
16802
|
-
|
16803
16474
|
if (this.sortable.nativeDraggable) {
|
16804
16475
|
on(document, 'dragover', this._handleAutoScroll);
|
16805
16476
|
} else {
|
@@ -16814,7 +16485,6 @@ function AutoScrollPlugin() {
|
|
16814
16485
|
},
|
16815
16486
|
dragOverCompleted: function dragOverCompleted(_ref2) {
|
16816
16487
|
var originalEvent = _ref2.originalEvent;
|
16817
|
-
|
16818
16488
|
// For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
|
16819
16489
|
if (!this.options.dragOverBubble && !originalEvent.rootEl) {
|
16820
16490
|
this._handleAutoScroll(originalEvent);
|
@@ -16828,7 +16498,6 @@ function AutoScrollPlugin() {
|
|
16828
16498
|
off(document, 'touchmove', this._handleFallbackAutoScroll);
|
16829
16499
|
off(document, 'mousemove', this._handleFallbackAutoScroll);
|
16830
16500
|
}
|
16831
|
-
|
16832
16501
|
clearPointerElemChangedInterval();
|
16833
16502
|
clearAutoScrolls();
|
16834
16503
|
cancelThrottle();
|
@@ -16842,31 +16511,29 @@ function AutoScrollPlugin() {
|
|
16842
16511
|
},
|
16843
16512
|
_handleAutoScroll: function _handleAutoScroll(evt, fallback) {
|
16844
16513
|
var _this = this;
|
16845
|
-
|
16846
16514
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
16847
|
-
|
16848
|
-
|
16849
|
-
touchEvt$1 = evt;
|
16515
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
16516
|
+
elem = document.elementFromPoint(x, y);
|
16517
|
+
touchEvt$1 = evt;
|
16518
|
+
|
16519
|
+
// IE does not seem to have native autoscroll,
|
16850
16520
|
// Edge's autoscroll seems too conditional,
|
16851
16521
|
// MACOS Safari does not have autoscroll,
|
16852
16522
|
// Firefox and Chrome are good
|
16853
|
-
|
16854
16523
|
if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
|
16855
|
-
autoScroll(evt, this.options, elem, fallback);
|
16524
|
+
autoScroll(evt, this.options, elem, fallback);
|
16856
16525
|
|
16526
|
+
// Listener for pointer element change
|
16857
16527
|
var ogElemScroller = getParentAutoScrollElement(elem, true);
|
16858
|
-
|
16859
16528
|
if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
|
16860
|
-
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
16861
|
-
|
16529
|
+
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
16530
|
+
// Detect for pointer elem change, emulating native DnD behaviour
|
16862
16531
|
pointerElemChangedInterval = setInterval(function () {
|
16863
16532
|
var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
|
16864
|
-
|
16865
16533
|
if (newElem !== ogElemScroller) {
|
16866
16534
|
ogElemScroller = newElem;
|
16867
16535
|
clearAutoScrolls();
|
16868
16536
|
}
|
16869
|
-
|
16870
16537
|
autoScroll(evt, _this.options, newElem, fallback);
|
16871
16538
|
}, 10);
|
16872
16539
|
lastAutoScrollX = x;
|
@@ -16878,7 +16545,6 @@ function AutoScrollPlugin() {
|
|
16878
16545
|
clearAutoScrolls();
|
16879
16546
|
return;
|
16880
16547
|
}
|
16881
|
-
|
16882
16548
|
autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
|
16883
16549
|
}
|
16884
16550
|
}
|
@@ -16888,60 +16554,54 @@ function AutoScrollPlugin() {
|
|
16888
16554
|
initializeByDefault: true
|
16889
16555
|
});
|
16890
16556
|
}
|
16891
|
-
|
16892
16557
|
function clearAutoScrolls() {
|
16893
16558
|
autoScrolls.forEach(function (autoScroll) {
|
16894
16559
|
clearInterval(autoScroll.pid);
|
16895
16560
|
});
|
16896
16561
|
autoScrolls = [];
|
16897
16562
|
}
|
16898
|
-
|
16899
16563
|
function clearPointerElemChangedInterval() {
|
16900
16564
|
clearInterval(pointerElemChangedInterval);
|
16901
16565
|
}
|
16902
|
-
|
16903
16566
|
var autoScroll = throttle$1(function (evt, options, rootEl, isFallback) {
|
16904
16567
|
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
|
16905
16568
|
if (!options.scroll) return;
|
16906
16569
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
16907
|
-
|
16908
|
-
|
16909
|
-
|
16910
|
-
|
16570
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
16571
|
+
sens = options.scrollSensitivity,
|
16572
|
+
speed = options.scrollSpeed,
|
16573
|
+
winScroller = getWindowScrollingElement();
|
16911
16574
|
var scrollThisInstance = false,
|
16912
|
-
|
16575
|
+
scrollCustomFn;
|
16913
16576
|
|
16577
|
+
// New scroll root, set scrollEl
|
16914
16578
|
if (scrollRootEl !== rootEl) {
|
16915
16579
|
scrollRootEl = rootEl;
|
16916
16580
|
clearAutoScrolls();
|
16917
16581
|
scrollEl = options.scroll;
|
16918
16582
|
scrollCustomFn = options.scrollFn;
|
16919
|
-
|
16920
16583
|
if (scrollEl === true) {
|
16921
16584
|
scrollEl = getParentAutoScrollElement(rootEl, true);
|
16922
16585
|
}
|
16923
16586
|
}
|
16924
|
-
|
16925
16587
|
var layersOut = 0;
|
16926
16588
|
var currentParent = scrollEl;
|
16927
|
-
|
16928
16589
|
do {
|
16929
16590
|
var el = currentParent,
|
16930
|
-
|
16931
|
-
|
16932
|
-
|
16933
|
-
|
16934
|
-
|
16935
|
-
|
16936
|
-
|
16937
|
-
|
16938
|
-
|
16939
|
-
|
16940
|
-
|
16941
|
-
|
16942
|
-
|
16943
|
-
|
16944
|
-
|
16591
|
+
rect = getRect$1(el),
|
16592
|
+
top = rect.top,
|
16593
|
+
bottom = rect.bottom,
|
16594
|
+
left = rect.left,
|
16595
|
+
right = rect.right,
|
16596
|
+
width = rect.width,
|
16597
|
+
height = rect.height,
|
16598
|
+
canScrollX = void 0,
|
16599
|
+
canScrollY = void 0,
|
16600
|
+
scrollWidth = el.scrollWidth,
|
16601
|
+
scrollHeight = el.scrollHeight,
|
16602
|
+
elCSS = css(el),
|
16603
|
+
scrollPosX = el.scrollLeft,
|
16604
|
+
scrollPosY = el.scrollTop;
|
16945
16605
|
if (el === winScroller) {
|
16946
16606
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
|
16947
16607
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
|
@@ -16949,10 +16609,8 @@ var autoScroll = throttle$1(function (evt, options, rootEl, isFallback) {
|
|
16949
16609
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
|
16950
16610
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
|
16951
16611
|
}
|
16952
|
-
|
16953
16612
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
16954
16613
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
16955
|
-
|
16956
16614
|
if (!autoScrolls[layersOut]) {
|
16957
16615
|
for (var i = 0; i <= layersOut; i++) {
|
16958
16616
|
if (!autoScrolls[i]) {
|
@@ -16960,61 +16618,51 @@ var autoScroll = throttle$1(function (evt, options, rootEl, isFallback) {
|
|
16960
16618
|
}
|
16961
16619
|
}
|
16962
16620
|
}
|
16963
|
-
|
16964
16621
|
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
|
16965
16622
|
autoScrolls[layersOut].el = el;
|
16966
16623
|
autoScrolls[layersOut].vx = vx;
|
16967
16624
|
autoScrolls[layersOut].vy = vy;
|
16968
16625
|
clearInterval(autoScrolls[layersOut].pid);
|
16969
|
-
|
16970
16626
|
if (vx != 0 || vy != 0) {
|
16971
16627
|
scrollThisInstance = true;
|
16972
16628
|
/* jshint loopfunc:true */
|
16973
|
-
|
16974
16629
|
autoScrolls[layersOut].pid = setInterval(function () {
|
16975
16630
|
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour
|
16976
16631
|
if (isFallback && this.layer === 0) {
|
16977
16632
|
Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
|
16978
|
-
|
16979
16633
|
}
|
16980
|
-
|
16981
16634
|
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
|
16982
16635
|
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
|
16983
|
-
|
16984
16636
|
if (typeof scrollCustomFn === 'function') {
|
16985
16637
|
if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
|
16986
16638
|
return;
|
16987
16639
|
}
|
16988
16640
|
}
|
16989
|
-
|
16990
16641
|
scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
|
16991
16642
|
}.bind({
|
16992
16643
|
layer: layersOut
|
16993
16644
|
}), 24);
|
16994
16645
|
}
|
16995
16646
|
}
|
16996
|
-
|
16997
16647
|
layersOut++;
|
16998
16648
|
} while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
|
16999
|
-
|
17000
16649
|
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
|
17001
16650
|
}, 30);
|
17002
16651
|
|
17003
16652
|
var drop = function drop(_ref) {
|
17004
16653
|
var originalEvent = _ref.originalEvent,
|
17005
|
-
|
17006
|
-
|
17007
|
-
|
17008
|
-
|
17009
|
-
|
17010
|
-
|
16654
|
+
putSortable = _ref.putSortable,
|
16655
|
+
dragEl = _ref.dragEl,
|
16656
|
+
activeSortable = _ref.activeSortable,
|
16657
|
+
dispatchSortableEvent = _ref.dispatchSortableEvent,
|
16658
|
+
hideGhostForTarget = _ref.hideGhostForTarget,
|
16659
|
+
unhideGhostForTarget = _ref.unhideGhostForTarget;
|
17011
16660
|
if (!originalEvent) return;
|
17012
16661
|
var toSortable = putSortable || activeSortable;
|
17013
16662
|
hideGhostForTarget();
|
17014
16663
|
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
|
17015
16664
|
var target = document.elementFromPoint(touch.clientX, touch.clientY);
|
17016
16665
|
unhideGhostForTarget();
|
17017
|
-
|
17018
16666
|
if (toSortable && !toSortable.el.contains(target)) {
|
17019
16667
|
dispatchSortableEvent('spill');
|
17020
16668
|
this.onSpill({
|
@@ -17023,9 +16671,7 @@ var drop = function drop(_ref) {
|
|
17023
16671
|
});
|
17024
16672
|
}
|
17025
16673
|
};
|
17026
|
-
|
17027
16674
|
function Revert() {}
|
17028
|
-
|
17029
16675
|
Revert.prototype = {
|
17030
16676
|
startIndex: null,
|
17031
16677
|
dragStart: function dragStart(_ref2) {
|
@@ -17034,40 +16680,32 @@ Revert.prototype = {
|
|
17034
16680
|
},
|
17035
16681
|
onSpill: function onSpill(_ref3) {
|
17036
16682
|
var dragEl = _ref3.dragEl,
|
17037
|
-
|
16683
|
+
putSortable = _ref3.putSortable;
|
17038
16684
|
this.sortable.captureAnimationState();
|
17039
|
-
|
17040
16685
|
if (putSortable) {
|
17041
16686
|
putSortable.captureAnimationState();
|
17042
16687
|
}
|
17043
|
-
|
17044
16688
|
var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
|
17045
|
-
|
17046
16689
|
if (nextSibling) {
|
17047
16690
|
this.sortable.el.insertBefore(dragEl, nextSibling);
|
17048
16691
|
} else {
|
17049
16692
|
this.sortable.el.appendChild(dragEl);
|
17050
16693
|
}
|
17051
|
-
|
17052
16694
|
this.sortable.animateAll();
|
17053
|
-
|
17054
16695
|
if (putSortable) {
|
17055
16696
|
putSortable.animateAll();
|
17056
16697
|
}
|
17057
16698
|
},
|
17058
16699
|
drop: drop
|
17059
16700
|
};
|
17060
|
-
|
17061
16701
|
_extends(Revert, {
|
17062
16702
|
pluginName: 'revertOnSpill'
|
17063
16703
|
});
|
17064
|
-
|
17065
16704
|
function Remove() {}
|
17066
|
-
|
17067
16705
|
Remove.prototype = {
|
17068
16706
|
onSpill: function onSpill(_ref4) {
|
17069
16707
|
var dragEl = _ref4.dragEl,
|
17070
|
-
|
16708
|
+
putSortable = _ref4.putSortable;
|
17071
16709
|
var parentSortable = putSortable || this.sortable;
|
17072
16710
|
parentSortable.captureAnimationState();
|
17073
16711
|
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
|
@@ -17075,7 +16713,6 @@ Remove.prototype = {
|
|
17075
16713
|
},
|
17076
16714
|
drop: drop
|
17077
16715
|
};
|
17078
|
-
|
17079
16716
|
_extends(Remove, {
|
17080
16717
|
pluginName: 'removeOnSpill'
|
17081
16718
|
});
|
@@ -89504,22 +89141,21 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
89504
89141
|
// Hide element tool
|
89505
89142
|
this.elmTool.hide();
|
89506
89143
|
|
89507
|
-
//
|
89508
|
-
|
89509
|
-
|
89510
|
-
|
89511
|
-
|
89512
|
-
|
89513
|
-
|
89514
|
-
|
89515
|
-
|
89516
|
-
|
89517
|
-
|
89518
|
-
|
89144
|
+
// destroy (extra)
|
89145
|
+
if (this.sortableOnCanvas) {
|
89146
|
+
this.sortableOnCanvas.forEach(obj => {
|
89147
|
+
if (obj) {
|
89148
|
+
obj.destroy();
|
89149
|
+
}
|
89150
|
+
});
|
89151
|
+
let dummies = this.doc.querySelectorAll('.block-dummy');
|
89152
|
+
dummies.forEach(elm => elm.parentNode.removeChild(elm));
|
89153
|
+
this.sortableOnCanvas = [];
|
89154
|
+
}
|
89155
|
+
if (this.sortableOnPage) this.sortableOnPage.destroy();
|
89519
89156
|
}
|
89520
89157
|
}
|
89521
89158
|
});
|
89522
|
-
|
89523
89159
|
this.sortableObjects.push(sortableObject);
|
89524
89160
|
builder.setAttribute('data-sort', true);
|
89525
89161
|
}
|
@@ -92678,9 +92314,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
92678
92314
|
bw = '540px';
|
92679
92315
|
}
|
92680
92316
|
}
|
92317
|
+
let containerClass = ''; // container's 'size-18 leading-14' is not for print
|
92318
|
+
if (this.isContentBox) containerClass = ' size-18 leading-14';
|
92681
92319
|
const blockTemplate = `
|
92682
92320
|
<div class="is-block block-steady height-auto" data-new-dummy="1" style="top: 20%; left: 20%; width: ${bw};">
|
92683
|
-
<div class="is-container container-new">
|
92321
|
+
<div class="is-container container-new${containerClass}">
|
92684
92322
|
[%CONTENT%]
|
92685
92323
|
</div>
|
92686
92324
|
</div>
|
@@ -92730,9 +92368,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
92730
92368
|
bw = '540px';
|
92731
92369
|
}
|
92732
92370
|
}
|
92371
|
+
let containerClass = ''; // container's 'size-18 leading-14' is not for print
|
92372
|
+
if (this.isContentBox) containerClass = ' size-18 leading-14';
|
92733
92373
|
const blockTemplate = `
|
92734
92374
|
<div class="is-block block-steady height-auto" data-new-dummy="1" style="top: 20%; left: 20%; width: ${bw};">
|
92735
|
-
<div class="is-container container-new">
|
92375
|
+
<div class="is-container container-new${containerClass}">
|
92736
92376
|
[%CONTENT%]
|
92737
92377
|
</div>
|
92738
92378
|
</div>
|
@@ -92835,6 +92475,18 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
92835
92475
|
// //Trigger Render event
|
92836
92476
|
// this.opts.onRender();
|
92837
92477
|
|
92478
|
+
// destroy (new)
|
92479
|
+
if (this.sortableOnCanvas) {
|
92480
|
+
this.sortableOnCanvas.forEach(obj => {
|
92481
|
+
if (obj) {
|
92482
|
+
obj.destroy();
|
92483
|
+
}
|
92484
|
+
});
|
92485
|
+
let dummies = this.doc.querySelectorAll('.block-dummy');
|
92486
|
+
dummies.forEach(elm => elm.parentNode.removeChild(elm));
|
92487
|
+
this.sortableOnCanvas = [];
|
92488
|
+
}
|
92489
|
+
if (this.sortableOnPage) this.sortableOnPage.destroy();
|
92838
92490
|
return;
|
92839
92491
|
}
|
92840
92492
|
if (itemEl.getAttribute('data-id')) {
|