govuk_publishing_components 30.3.0 → 30.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +17 -3
- data/app/assets/stylesheets/component_guide/application.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -1
- data/app/models/govuk_publishing_components/component_example.rb +3 -2
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +26 -2
- data/config/locales/en.yml +4 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/sortablejs/README.md +828 -815
- data/node_modules/sortablejs/Sortable.js +186 -113
- data/node_modules/sortablejs/Sortable.min.js +2 -2
- data/node_modules/sortablejs/modular/sortable.complete.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.core.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.esm.js +184 -111
- data/node_modules/sortablejs/package.json +3 -3
- metadata +16 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**!
|
2
|
-
* Sortable 1.
|
2
|
+
* Sortable 1.15.0
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
5
5
|
* @license MIT
|
@@ -8,9 +8,49 @@
|
|
8
8
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9
9
|
typeof define === 'function' && define.amd ? define(factory) :
|
10
10
|
(global = global || self, global.Sortable = factory());
|
11
|
-
}(this, function () { 'use strict';
|
11
|
+
}(this, (function () { 'use strict';
|
12
|
+
|
13
|
+
function ownKeys(object, enumerableOnly) {
|
14
|
+
var keys = Object.keys(object);
|
15
|
+
|
16
|
+
if (Object.getOwnPropertySymbols) {
|
17
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
18
|
+
|
19
|
+
if (enumerableOnly) {
|
20
|
+
symbols = symbols.filter(function (sym) {
|
21
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
22
|
+
});
|
23
|
+
}
|
24
|
+
|
25
|
+
keys.push.apply(keys, symbols);
|
26
|
+
}
|
27
|
+
|
28
|
+
return keys;
|
29
|
+
}
|
30
|
+
|
31
|
+
function _objectSpread2(target) {
|
32
|
+
for (var i = 1; i < arguments.length; i++) {
|
33
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
34
|
+
|
35
|
+
if (i % 2) {
|
36
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
37
|
+
_defineProperty(target, key, source[key]);
|
38
|
+
});
|
39
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
40
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
41
|
+
} else {
|
42
|
+
ownKeys(Object(source)).forEach(function (key) {
|
43
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
44
|
+
});
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
return target;
|
49
|
+
}
|
12
50
|
|
13
51
|
function _typeof(obj) {
|
52
|
+
"@babel/helpers - typeof";
|
53
|
+
|
14
54
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
15
55
|
_typeof = function (obj) {
|
16
56
|
return typeof obj;
|
@@ -57,25 +97,6 @@
|
|
57
97
|
return _extends.apply(this, arguments);
|
58
98
|
}
|
59
99
|
|
60
|
-
function _objectSpread(target) {
|
61
|
-
for (var i = 1; i < arguments.length; i++) {
|
62
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
63
|
-
var ownKeys = Object.keys(source);
|
64
|
-
|
65
|
-
if (typeof Object.getOwnPropertySymbols === 'function') {
|
66
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
67
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
68
|
-
}));
|
69
|
-
}
|
70
|
-
|
71
|
-
ownKeys.forEach(function (key) {
|
72
|
-
_defineProperty(target, key, source[key]);
|
73
|
-
});
|
74
|
-
}
|
75
|
-
|
76
|
-
return target;
|
77
|
-
}
|
78
|
-
|
79
100
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
80
101
|
if (source == null) return {};
|
81
102
|
var target = {};
|
@@ -113,32 +134,43 @@
|
|
113
134
|
}
|
114
135
|
|
115
136
|
function _toConsumableArray(arr) {
|
116
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
137
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
117
138
|
}
|
118
139
|
|
119
140
|
function _arrayWithoutHoles(arr) {
|
120
|
-
if (Array.isArray(arr))
|
121
|
-
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
122
|
-
|
123
|
-
return arr2;
|
124
|
-
}
|
141
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
125
142
|
}
|
126
143
|
|
127
144
|
function _iterableToArray(iter) {
|
128
|
-
if (Symbol.iterator
|
145
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
146
|
+
}
|
147
|
+
|
148
|
+
function _unsupportedIterableToArray(o, minLen) {
|
149
|
+
if (!o) return;
|
150
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
151
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
152
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
153
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
154
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
155
|
+
}
|
156
|
+
|
157
|
+
function _arrayLikeToArray(arr, len) {
|
158
|
+
if (len == null || len > arr.length) len = arr.length;
|
159
|
+
|
160
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
161
|
+
|
162
|
+
return arr2;
|
129
163
|
}
|
130
164
|
|
131
165
|
function _nonIterableSpread() {
|
132
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
166
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
133
167
|
}
|
134
168
|
|
135
|
-
var version = "1.
|
169
|
+
var version = "1.15.0";
|
136
170
|
|
137
171
|
function userAgent(pattern) {
|
138
172
|
if (typeof window !== 'undefined' && window.navigator) {
|
139
|
-
return !!
|
140
|
-
/*@__PURE__*/
|
141
|
-
navigator.userAgent.match(pattern);
|
173
|
+
return !! /*@__PURE__*/navigator.userAgent.match(pattern);
|
142
174
|
}
|
143
175
|
}
|
144
176
|
|
@@ -419,13 +451,13 @@
|
|
419
451
|
*/
|
420
452
|
|
421
453
|
|
422
|
-
function getChild(el, childNum, options) {
|
454
|
+
function getChild(el, childNum, options, includeDragEl) {
|
423
455
|
var currentChild = 0,
|
424
456
|
i = 0,
|
425
457
|
children = el.children;
|
426
458
|
|
427
459
|
while (i < children.length) {
|
428
|
-
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) {
|
460
|
+
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
|
429
461
|
if (currentChild === childNum) {
|
430
462
|
return children[i];
|
431
463
|
}
|
@@ -643,7 +675,7 @@
|
|
643
675
|
rect: getRect(child)
|
644
676
|
});
|
645
677
|
|
646
|
-
var fromRect =
|
678
|
+
var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
|
647
679
|
|
648
680
|
|
649
681
|
if (child.thisAnimationDuration) {
|
@@ -813,7 +845,7 @@
|
|
813
845
|
if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
|
814
846
|
|
815
847
|
if (sortable[plugin.pluginName][eventNameGlobal]) {
|
816
|
-
sortable[plugin.pluginName][eventNameGlobal](
|
848
|
+
sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
|
817
849
|
sortable: sortable
|
818
850
|
}, evt));
|
819
851
|
} // Only fire plugin event if plugin is enabled in this sortable,
|
@@ -821,7 +853,7 @@
|
|
821
853
|
|
822
854
|
|
823
855
|
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
|
824
|
-
sortable[plugin.pluginName][eventName](
|
856
|
+
sortable[plugin.pluginName][eventName](_objectSpread2({
|
825
857
|
sortable: sortable
|
826
858
|
}, evt));
|
827
859
|
}
|
@@ -913,7 +945,7 @@
|
|
913
945
|
evt.originalEvent = originalEvent;
|
914
946
|
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
|
915
947
|
|
916
|
-
var allEventProperties =
|
948
|
+
var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
|
917
949
|
|
918
950
|
for (var option in allEventProperties) {
|
919
951
|
evt[option] = allEventProperties[option];
|
@@ -928,12 +960,14 @@
|
|
928
960
|
}
|
929
961
|
}
|
930
962
|
|
963
|
+
var _excluded = ["evt"];
|
964
|
+
|
931
965
|
var pluginEvent = function pluginEvent(eventName, sortable) {
|
932
966
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
933
967
|
originalEvent = _ref.evt,
|
934
|
-
data = _objectWithoutProperties(_ref,
|
968
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
935
969
|
|
936
|
-
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable,
|
970
|
+
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
|
937
971
|
dragEl: dragEl,
|
938
972
|
parentEl: parentEl,
|
939
973
|
ghostEl: ghostEl,
|
@@ -969,7 +1003,7 @@
|
|
969
1003
|
};
|
970
1004
|
|
971
1005
|
function _dispatchEvent(info) {
|
972
|
-
dispatchEvent(
|
1006
|
+
dispatchEvent(_objectSpread2({
|
973
1007
|
putSortable: putSortable,
|
974
1008
|
cloneEl: cloneEl,
|
975
1009
|
targetEl: dragEl,
|
@@ -1069,22 +1103,22 @@
|
|
1069
1103
|
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
1070
1104
|
},
|
1071
1105
|
|
1072
|
-
/**
|
1073
|
-
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
1074
|
-
* @param {Number} x X position
|
1075
|
-
* @param {Number} y Y position
|
1076
|
-
* @return {HTMLElement} Element of the first found nearest Sortable
|
1106
|
+
/**
|
1107
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
1108
|
+
* @param {Number} x X position
|
1109
|
+
* @param {Number} y Y position
|
1110
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
1077
1111
|
*/
|
1078
1112
|
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
1079
1113
|
var ret;
|
1080
1114
|
sortables.some(function (sortable) {
|
1081
|
-
|
1115
|
+
var threshold = sortable[expando].options.emptyInsertThreshold;
|
1116
|
+
if (!threshold || lastChild(sortable)) return;
|
1082
1117
|
var rect = getRect(sortable),
|
1083
|
-
threshold = sortable[expando].options.emptyInsertThreshold,
|
1084
1118
|
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
|
1085
1119
|
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
|
1086
1120
|
|
1087
|
-
if (
|
1121
|
+
if (insideHorizontally && insideVertically) {
|
1088
1122
|
return ret = sortable;
|
1089
1123
|
}
|
1090
1124
|
});
|
@@ -1139,7 +1173,7 @@
|
|
1139
1173
|
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
1140
1174
|
|
1141
1175
|
|
1142
|
-
if (documentExists) {
|
1176
|
+
if (documentExists && !ChromeForAndroid) {
|
1143
1177
|
document.addEventListener('click', function (evt) {
|
1144
1178
|
if (ignoreNextClick) {
|
1145
1179
|
evt.preventDefault();
|
@@ -1181,10 +1215,10 @@
|
|
1181
1215
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
1182
1216
|
}
|
1183
1217
|
};
|
1184
|
-
/**
|
1185
|
-
* @class Sortable
|
1186
|
-
* @param {HTMLElement} el
|
1187
|
-
* @param {Object} [options]
|
1218
|
+
/**
|
1219
|
+
* @class Sortable
|
1220
|
+
* @param {HTMLElement} el
|
1221
|
+
* @param {Object} [options]
|
1188
1222
|
*/
|
1189
1223
|
|
1190
1224
|
|
@@ -1758,6 +1792,7 @@
|
|
1758
1792
|
|
1759
1793
|
if (!Sortable.eventCanceled) {
|
1760
1794
|
cloneEl = clone(dragEl);
|
1795
|
+
cloneEl.removeAttribute("id");
|
1761
1796
|
cloneEl.draggable = false;
|
1762
1797
|
cloneEl.style['will-change'] = '';
|
1763
1798
|
|
@@ -1835,7 +1870,7 @@
|
|
1835
1870
|
if (_silent) return;
|
1836
1871
|
|
1837
1872
|
function dragOverEvent(name, extra) {
|
1838
|
-
pluginEvent(name, _this,
|
1873
|
+
pluginEvent(name, _this, _objectSpread2({
|
1839
1874
|
evt: evt,
|
1840
1875
|
isOwner: isOwner,
|
1841
1876
|
axis: vertical ? 'vertical' : 'horizontal',
|
@@ -1952,7 +1987,7 @@
|
|
1952
1987
|
|
1953
1988
|
ignoreNextClick = false;
|
1954
1989
|
|
1955
|
-
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert =
|
1990
|
+
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
|
1956
1991
|
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
|
1957
1992
|
vertical = this._getDirection(evt, target) === 'vertical';
|
1958
1993
|
dragRect = getRect(dragEl);
|
@@ -1982,10 +2017,11 @@
|
|
1982
2017
|
var elLastChild = lastChild(el, options.draggable);
|
1983
2018
|
|
1984
2019
|
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
|
2020
|
+
// Insert to end of list
|
1985
2021
|
// If already at end of list: Do not insert
|
1986
2022
|
if (elLastChild === dragEl) {
|
1987
2023
|
return completed(false);
|
1988
|
-
} //
|
2024
|
+
} // if there is a last element, it is the target
|
1989
2025
|
|
1990
2026
|
|
1991
2027
|
if (elLastChild && el === evt.target) {
|
@@ -1998,7 +2034,33 @@
|
|
1998
2034
|
|
1999
2035
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
2000
2036
|
capture();
|
2001
|
-
|
2037
|
+
|
2038
|
+
if (elLastChild && elLastChild.nextSibling) {
|
2039
|
+
// the last draggable element is not the last node
|
2040
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
2041
|
+
} else {
|
2042
|
+
el.appendChild(dragEl);
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
parentEl = el; // actualization
|
2046
|
+
|
2047
|
+
changed();
|
2048
|
+
return completed(true);
|
2049
|
+
}
|
2050
|
+
} else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
|
2051
|
+
// Insert to start of list
|
2052
|
+
var firstChild = getChild(el, 0, options, true);
|
2053
|
+
|
2054
|
+
if (firstChild === dragEl) {
|
2055
|
+
return completed(false);
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
target = firstChild;
|
2059
|
+
targetRect = getRect(target);
|
2060
|
+
|
2061
|
+
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
|
2062
|
+
capture();
|
2063
|
+
el.insertBefore(dragEl, firstChild);
|
2002
2064
|
parentEl = el; // actualization
|
2003
2065
|
|
2004
2066
|
changed();
|
@@ -2302,9 +2364,9 @@
|
|
2302
2364
|
}
|
2303
2365
|
},
|
2304
2366
|
|
2305
|
-
/**
|
2306
|
-
* Serializes the item into an array of string.
|
2307
|
-
* @returns {String[]}
|
2367
|
+
/**
|
2368
|
+
* Serializes the item into an array of string.
|
2369
|
+
* @returns {String[]}
|
2308
2370
|
*/
|
2309
2371
|
toArray: function toArray() {
|
2310
2372
|
var order = [],
|
@@ -2325,9 +2387,9 @@
|
|
2325
2387
|
return order;
|
2326
2388
|
},
|
2327
2389
|
|
2328
|
-
/**
|
2329
|
-
* Sorts the elements according to the array.
|
2330
|
-
* @param {String[]} order order of the items
|
2390
|
+
/**
|
2391
|
+
* Sorts the elements according to the array.
|
2392
|
+
* @param {String[]} order order of the items
|
2331
2393
|
*/
|
2332
2394
|
sort: function sort(order, useAnimation) {
|
2333
2395
|
var items = {},
|
@@ -2349,29 +2411,29 @@
|
|
2349
2411
|
useAnimation && this.animateAll();
|
2350
2412
|
},
|
2351
2413
|
|
2352
|
-
/**
|
2353
|
-
* Save the current sorting
|
2414
|
+
/**
|
2415
|
+
* Save the current sorting
|
2354
2416
|
*/
|
2355
2417
|
save: function save() {
|
2356
2418
|
var store = this.options.store;
|
2357
2419
|
store && store.set && store.set(this);
|
2358
2420
|
},
|
2359
2421
|
|
2360
|
-
/**
|
2361
|
-
* 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.
|
2362
|
-
* @param {HTMLElement} el
|
2363
|
-
* @param {String} [selector] default: `options.draggable`
|
2364
|
-
* @returns {HTMLElement|null}
|
2422
|
+
/**
|
2423
|
+
* 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.
|
2424
|
+
* @param {HTMLElement} el
|
2425
|
+
* @param {String} [selector] default: `options.draggable`
|
2426
|
+
* @returns {HTMLElement|null}
|
2365
2427
|
*/
|
2366
2428
|
closest: function closest$1(el, selector) {
|
2367
2429
|
return closest(el, selector || this.options.draggable, this.el, false);
|
2368
2430
|
},
|
2369
2431
|
|
2370
|
-
/**
|
2371
|
-
* Set/get option
|
2372
|
-
* @param {string} name
|
2373
|
-
* @param {*} [value]
|
2374
|
-
* @returns {*}
|
2432
|
+
/**
|
2433
|
+
* Set/get option
|
2434
|
+
* @param {string} name
|
2435
|
+
* @param {*} [value]
|
2436
|
+
* @returns {*}
|
2375
2437
|
*/
|
2376
2438
|
option: function option(name, value) {
|
2377
2439
|
var options = this.options;
|
@@ -2393,8 +2455,8 @@
|
|
2393
2455
|
}
|
2394
2456
|
},
|
2395
2457
|
|
2396
|
-
/**
|
2397
|
-
* Destroy
|
2458
|
+
/**
|
2459
|
+
* Destroy
|
2398
2460
|
*/
|
2399
2461
|
destroy: function destroy() {
|
2400
2462
|
pluginEvent('destroy', this);
|
@@ -2514,6 +2576,12 @@
|
|
2514
2576
|
_silent = false;
|
2515
2577
|
}
|
2516
2578
|
|
2579
|
+
function _ghostIsFirst(evt, vertical, sortable) {
|
2580
|
+
var rect = getRect(getChild(sortable.el, 0, sortable.options, true));
|
2581
|
+
var spacer = 10;
|
2582
|
+
return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;
|
2583
|
+
}
|
2584
|
+
|
2517
2585
|
function _ghostIsLast(evt, vertical, sortable) {
|
2518
2586
|
var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
|
2519
2587
|
var spacer = 10;
|
@@ -2565,11 +2633,11 @@
|
|
2565
2633
|
|
2566
2634
|
return 0;
|
2567
2635
|
}
|
2568
|
-
/**
|
2569
|
-
* Gets the direction dragEl must be swapped relative to target in order to make it
|
2570
|
-
* seem that dragEl has been "inserted" into that element's position
|
2571
|
-
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
2572
|
-
* @return {Number} Direction dragEl must be swapped
|
2636
|
+
/**
|
2637
|
+
* Gets the direction dragEl must be swapped relative to target in order to make it
|
2638
|
+
* seem that dragEl has been "inserted" into that element's position
|
2639
|
+
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
2640
|
+
* @return {Number} Direction dragEl must be swapped
|
2573
2641
|
*/
|
2574
2642
|
|
2575
2643
|
|
@@ -2580,11 +2648,11 @@
|
|
2580
2648
|
return -1;
|
2581
2649
|
}
|
2582
2650
|
}
|
2583
|
-
/**
|
2584
|
-
* Generate id
|
2585
|
-
* @param {HTMLElement} el
|
2586
|
-
* @returns {String}
|
2587
|
-
* @private
|
2651
|
+
/**
|
2652
|
+
* Generate id
|
2653
|
+
* @param {HTMLElement} el
|
2654
|
+
* @returns {String}
|
2655
|
+
* @private
|
2588
2656
|
*/
|
2589
2657
|
|
2590
2658
|
|
@@ -2648,18 +2716,18 @@
|
|
2648
2716
|
detectDirection: _detectDirection,
|
2649
2717
|
getChild: getChild
|
2650
2718
|
};
|
2651
|
-
/**
|
2652
|
-
* Get the Sortable instance of an element
|
2653
|
-
* @param {HTMLElement} element The element
|
2654
|
-
* @return {Sortable|undefined} The instance of Sortable
|
2719
|
+
/**
|
2720
|
+
* Get the Sortable instance of an element
|
2721
|
+
* @param {HTMLElement} element The element
|
2722
|
+
* @return {Sortable|undefined} The instance of Sortable
|
2655
2723
|
*/
|
2656
2724
|
|
2657
2725
|
Sortable.get = function (element) {
|
2658
2726
|
return element[expando];
|
2659
2727
|
};
|
2660
|
-
/**
|
2661
|
-
* Mount a plugin to Sortable
|
2662
|
-
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
2728
|
+
/**
|
2729
|
+
* Mount a plugin to Sortable
|
2730
|
+
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
2663
2731
|
*/
|
2664
2732
|
|
2665
2733
|
|
@@ -2674,14 +2742,14 @@
|
|
2674
2742
|
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
|
2675
2743
|
}
|
2676
2744
|
|
2677
|
-
if (plugin.utils) Sortable.utils =
|
2745
|
+
if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
|
2678
2746
|
PluginManager.mount(plugin);
|
2679
2747
|
});
|
2680
2748
|
};
|
2681
|
-
/**
|
2682
|
-
* Create sortable instance
|
2683
|
-
* @param {HTMLElement} el
|
2684
|
-
* @param {Object} [options]
|
2749
|
+
/**
|
2750
|
+
* Create sortable instance
|
2751
|
+
* @param {HTMLElement} el
|
2752
|
+
* @param {Object} [options]
|
2685
2753
|
*/
|
2686
2754
|
|
2687
2755
|
|
@@ -2705,6 +2773,7 @@
|
|
2705
2773
|
function AutoScroll() {
|
2706
2774
|
this.defaults = {
|
2707
2775
|
scroll: true,
|
2776
|
+
forceAutoScrollFallback: false,
|
2708
2777
|
scrollSensitivity: 30,
|
2709
2778
|
scrollSpeed: 10,
|
2710
2779
|
bubbleScroll: true
|
@@ -2772,7 +2841,7 @@
|
|
2772
2841
|
// MACOS Safari does not have autoscroll,
|
2773
2842
|
// Firefox and Chrome are good
|
2774
2843
|
|
2775
|
-
if (fallback || Edge || IE11OrLess || Safari) {
|
2844
|
+
if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
|
2776
2845
|
autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
|
2777
2846
|
|
2778
2847
|
var ogElemScroller = getParentAutoScrollElement(elem, true);
|
@@ -3117,11 +3186,13 @@
|
|
3117
3186
|
}
|
3118
3187
|
}
|
3119
3188
|
|
3120
|
-
if (sortable.options.
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3189
|
+
if (!sortable.options.avoidImplicitDeselect) {
|
3190
|
+
if (sortable.options.supportPointer) {
|
3191
|
+
on(document, 'pointerup', this._deselectMultiDrag);
|
3192
|
+
} else {
|
3193
|
+
on(document, 'mouseup', this._deselectMultiDrag);
|
3194
|
+
on(document, 'touchend', this._deselectMultiDrag);
|
3195
|
+
}
|
3125
3196
|
}
|
3126
3197
|
|
3127
3198
|
on(document, 'keydown', this._checkKeyDown);
|
@@ -3129,6 +3200,7 @@
|
|
3129
3200
|
this.defaults = {
|
3130
3201
|
selectedClass: 'sortable-selected',
|
3131
3202
|
multiDragKey: null,
|
3203
|
+
avoidImplicitDeselect: false,
|
3132
3204
|
setData: function setData(dataTransfer, dragEl) {
|
3133
3205
|
var data = '';
|
3134
3206
|
|
@@ -3419,7 +3491,7 @@
|
|
3419
3491
|
rootEl: rootEl,
|
3420
3492
|
name: 'select',
|
3421
3493
|
targetEl: dragEl$1,
|
3422
|
-
|
3494
|
+
originalEvent: evt
|
3423
3495
|
}); // Modifier activated, select from last to dragEl
|
3424
3496
|
|
3425
3497
|
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
|
@@ -3448,7 +3520,7 @@
|
|
3448
3520
|
rootEl: rootEl,
|
3449
3521
|
name: 'select',
|
3450
3522
|
targetEl: children[i],
|
3451
|
-
|
3523
|
+
originalEvent: evt
|
3452
3524
|
});
|
3453
3525
|
}
|
3454
3526
|
}
|
@@ -3465,14 +3537,15 @@
|
|
3465
3537
|
rootEl: rootEl,
|
3466
3538
|
name: 'deselect',
|
3467
3539
|
targetEl: dragEl$1,
|
3468
|
-
|
3540
|
+
originalEvent: evt
|
3469
3541
|
});
|
3470
3542
|
}
|
3471
3543
|
} // Multi-drag drop
|
3472
3544
|
|
3473
3545
|
|
3474
3546
|
if (dragStarted && this.isMultiDrag) {
|
3475
|
-
// Do not "unfold" after around dragEl if reverted
|
3547
|
+
folding = false; // Do not "unfold" after around dragEl if reverted
|
3548
|
+
|
3476
3549
|
if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {
|
3477
3550
|
var dragRect = getRect(dragEl$1),
|
3478
3551
|
multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');
|
@@ -3575,7 +3648,7 @@
|
|
3575
3648
|
rootEl: this.sortable.el,
|
3576
3649
|
name: 'deselect',
|
3577
3650
|
targetEl: el,
|
3578
|
-
|
3651
|
+
originalEvent: evt
|
3579
3652
|
});
|
3580
3653
|
}
|
3581
3654
|
},
|
@@ -3718,4 +3791,4 @@
|
|
3718
3791
|
|
3719
3792
|
return Sortable;
|
3720
3793
|
|
3721
|
-
}));
|
3794
|
+
})));
|