@get-set/gs-sortable 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/afterAllImagesLoad.js +53 -43
- package/dist/actions/calculate.js +140 -145
- package/dist/actions/calculateOnSort.js +247 -278
- package/dist/actions/checkItemInContainer.js +26 -28
- package/dist/actions/destroy.js +33 -22
- package/dist/actions/general.js +90 -81
- package/dist/actions/getCurrentParams.js +35 -32
- package/dist/actions/init.js +33 -24
- package/dist/actions/initDraggable.js +88 -87
- package/dist/actions/initMouseMove.js +102 -117
- package/dist/actions/initScroll.js +26 -23
- package/dist/actions/initSortEnd.js +73 -84
- package/dist/components/GSSortable.js +154 -162
- package/dist/constants/constParams.js +10 -5
- package/dist/constants/defaultParams.js +24 -19
- package/dist/constants/types.js +12 -7
- package/dist/helpers/uihelpers.js +56 -52
- package/package.json +3 -3
package/dist/actions/destroy.js
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _types = _interopRequireDefault(require("../constants/types"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
var destroy = function destroy(ref) {
|
|
16
|
+
ref.grid.classList.remove('gs-sortable-instance');
|
|
17
|
+
ref.grid.classList.remove("gs-sortable-".concat(ref.currentParams.type));
|
|
18
|
+
ref.grid.style.removeProperty('position');
|
|
19
|
+
ref.grid.style.removeProperty('gap');
|
|
20
|
+
ref.grid.style.removeProperty('height');
|
|
21
|
+
if (ref.currentParams.type == _types["default"].row) {
|
|
22
|
+
ref.grid.style.removeProperty('width');
|
|
23
|
+
}
|
|
24
|
+
_toConsumableArray(ref.grid.children).map(function (el) {
|
|
25
|
+
el.classList.remove('gs-sortable-item');
|
|
26
|
+
el.style.removeProperty('position');
|
|
27
|
+
el.style.removeProperty('width');
|
|
28
|
+
el.style.removeProperty('left');
|
|
29
|
+
el.style.removeProperty('top');
|
|
30
|
+
el.style.removeProperty('transition');
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var _default = exports["default"] = destroy;
|
package/dist/actions/general.js
CHANGED
|
@@ -1,81 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.moveChildToIndex = exports.getTranslateCoord = exports.getOffsetFromWindow = exports.getOffsetFromBody = void 0;
|
|
7
|
+
var getTranslateCoord = exports.getTranslateCoord = function getTranslateCoord(element) {
|
|
8
|
+
var style = window.getComputedStyle(element);
|
|
9
|
+
// eslint-disable-next-line no-undef
|
|
10
|
+
var matrix = new WebKitCSSMatrix(style.transform);
|
|
11
|
+
return {
|
|
12
|
+
x: matrix.e,
|
|
13
|
+
y: matrix.f
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var getOffsetFromBody = exports.getOffsetFromBody = function getOffsetFromBody(el) {
|
|
17
|
+
var top = 0,
|
|
18
|
+
left = 0;
|
|
19
|
+
|
|
20
|
+
// Loop through every parent element
|
|
21
|
+
while (el && el !== document.body) {
|
|
22
|
+
top += el.offsetTop || 0;
|
|
23
|
+
left += el.offsetLeft || 0;
|
|
24
|
+
|
|
25
|
+
// Handle transformations (i.e., translate, scale)
|
|
26
|
+
var transform = window.getComputedStyle(el).transform;
|
|
27
|
+
if (transform !== 'none') {
|
|
28
|
+
var matrix = new DOMMatrix(transform);
|
|
29
|
+
top += matrix.m42 || 0;
|
|
30
|
+
left += matrix.m41 || 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// If there's a positioned parent, move up the tree
|
|
34
|
+
el = el.offsetParent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Add scroll offsets for body, in case of page scrolling
|
|
38
|
+
top += document.body.scrollTop || document.documentElement.scrollTop || 0;
|
|
39
|
+
left += document.body.scrollLeft || document.documentElement.scrollLeft || 0;
|
|
40
|
+
return {
|
|
41
|
+
top: top,
|
|
42
|
+
left: left
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var getOffsetFromWindow = exports.getOffsetFromWindow = function getOffsetFromWindow(el) {
|
|
46
|
+
var top = 0,
|
|
47
|
+
left = 0;
|
|
48
|
+
|
|
49
|
+
// Loop through each parent, accumulating the offset relative to the viewport
|
|
50
|
+
while (el) {
|
|
51
|
+
top += el.offsetTop || 0;
|
|
52
|
+
left += el.offsetLeft || 0;
|
|
53
|
+
|
|
54
|
+
// Handle transforms (translate, scale, etc.)
|
|
55
|
+
var transform = window.getComputedStyle(el).transform;
|
|
56
|
+
if (transform !== 'none') {
|
|
57
|
+
var matrix = new DOMMatrix(transform);
|
|
58
|
+
top += matrix.m42 || 0;
|
|
59
|
+
left += matrix.m41 || 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Move to the next parent element
|
|
63
|
+
el = el.offsetParent;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Subtract scroll position from the window (not the document)
|
|
67
|
+
top -= window.scrollY || 0;
|
|
68
|
+
left -= window.scrollX || 0;
|
|
69
|
+
return {
|
|
70
|
+
top: top,
|
|
71
|
+
left: left
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var moveChildToIndex = exports.moveChildToIndex = function moveChildToIndex(parent, child, newIndex) {
|
|
75
|
+
var children = Array.from(parent.children);
|
|
76
|
+
var oldIndex = children.indexOf(child);
|
|
77
|
+
if (oldIndex !== newIndex) {
|
|
78
|
+
if (oldIndex === newIndex) return; // If not found or same position, do nothing
|
|
79
|
+
|
|
80
|
+
// Ensure the new index is within valid bounds
|
|
81
|
+
newIndex = Math.max(0, Math.min(newIndex, children.length - 1));
|
|
82
|
+
if (newIndex > oldIndex && oldIndex != -1) {
|
|
83
|
+
// Moving forward, so insert after the target index
|
|
84
|
+
parent.insertBefore(child, children[newIndex].nextSibling);
|
|
85
|
+
} else {
|
|
86
|
+
// Moving backward, insert before the target index
|
|
87
|
+
parent.insertBefore(child, children[newIndex]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _defaultParams2 = _interopRequireDefault(require("../constants/defaultParams"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
var getCurrentParams = function getCurrentParams(params) {
|
|
16
|
+
var defaultParams = _objectSpread({}, _defaultParams2["default"]);
|
|
17
|
+
var finalParams = _objectSpread(_objectSpread({}, defaultParams), params);
|
|
18
|
+
if (finalParams.responsive.length > 0) {
|
|
19
|
+
finalParams.responsive.sort(function (a, b) {
|
|
20
|
+
return b.windowSize - a.windowSize;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (finalParams.responsive.length > 0) {
|
|
24
|
+
var windowSize = window.innerWidth;
|
|
25
|
+
var availableResponsives = finalParams.responsive.filter(function (resp) {
|
|
26
|
+
return resp.windowSize >= windowSize;
|
|
27
|
+
});
|
|
28
|
+
availableResponsives.map(function (resp) {
|
|
29
|
+
finalParams = _objectSpread(_objectSpread({}, finalParams), resp.params);
|
|
30
|
+
return resp;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return finalParams;
|
|
34
|
+
};
|
|
35
|
+
var _default = exports["default"] = getCurrentParams;
|
package/dist/actions/init.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ref.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _constParams = _interopRequireDefault(require("../constants/constParams"));
|
|
8
|
+
var _calculate = _interopRequireDefault(require("./calculate"));
|
|
9
|
+
var _initDraggable = _interopRequireDefault(require("./initDraggable"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
15
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
16
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
|
+
var init = function init(ref) {
|
|
18
|
+
var transition = "left ".concat(_constParams["default"].animateionSpeed, "ms, top ").concat(_constParams["default"].animateionSpeed, "ms, transform ").concat(_constParams["default"].animateionSpeed, "ms");
|
|
19
|
+
ref.grid.classList.add('gs-sortable-instance');
|
|
20
|
+
ref.grid.classList.add("gs-sortable-".concat(ref.currentParams.type));
|
|
21
|
+
_toConsumableArray(ref.grid.children).map(function (el) {
|
|
22
|
+
el.classList.add('gs-sortable-item');
|
|
23
|
+
el.style.transition = transition;
|
|
24
|
+
el.style.position = 'absolute';
|
|
25
|
+
var resizeObserver = new ResizeObserver(function () {
|
|
26
|
+
(0, _calculate["default"])(ref);
|
|
27
|
+
});
|
|
28
|
+
resizeObserver.observe(el);
|
|
29
|
+
});
|
|
30
|
+
ref.count = ref.grid.children.length;
|
|
31
|
+
(0, _initDraggable["default"])(ref);
|
|
32
|
+
};
|
|
33
|
+
var _default = exports["default"] = init;
|
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _constParams = _interopRequireDefault(require("../constants/constParams"));
|
|
8
|
+
var _general = require("./general");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
var initDraggable = function initDraggable(ref) {
|
|
17
|
+
var params = ref.currentParams;
|
|
18
|
+
var $items = _toConsumableArray(ref.grid.children);
|
|
19
|
+
$items.map(function ($el, index) {
|
|
20
|
+
$el.onmousedown = null;
|
|
21
|
+
var handler = params.handler != "" ? $el.querySelector(params.handler) : $el;
|
|
22
|
+
if (handler != null) {
|
|
23
|
+
handler.style.cursor = "move";
|
|
24
|
+
handler.onmousedown = function (e) {
|
|
25
|
+
if (!ref.isAddjusting) {
|
|
26
|
+
window.GSSortableConfigue.overInItemRef = ref;
|
|
27
|
+
window.GSSortableConfigue.takeFrom = ref;
|
|
28
|
+
var container = ref.grid;
|
|
29
|
+
var elStyles = getComputedStyle($el);
|
|
30
|
+
var containerStyles = getComputedStyle(container);
|
|
31
|
+
var paddingTop = parseFloat(containerStyles.paddingTop);
|
|
32
|
+
var paddingLeft = parseFloat(containerStyles.paddingLeft);
|
|
33
|
+
var top = parseFloat(elStyles.top);
|
|
34
|
+
var left = parseFloat(elStyles.left);
|
|
35
|
+
var $draggaleEl = $el;
|
|
36
|
+
var placeholder = document.createElement("div");
|
|
37
|
+
if (!params.takeClone) {
|
|
38
|
+
placeholder.classList.add("gs-sortable-placeholder");
|
|
39
|
+
placeholder.style.position = elStyles.position;
|
|
40
|
+
placeholder.style.transition = "left ".concat(_constParams["default"].animateionSpeed, "ms, top ").concat(_constParams["default"].animateionSpeed, "ms, transform ").concat(_constParams["default"].animateionSpeed, "ms, opacity ").concat(_constParams["default"].animateionSpeed, "ms, opacity ").concat(_constParams["default"].animateionSpeed, "ms");
|
|
41
|
+
placeholder.style.width = "".concat($el.offsetWidth, "px");
|
|
42
|
+
placeholder.style.height = "".concat($el.offsetHeight, "px");
|
|
43
|
+
placeholder.style.top = "".concat(top, "px");
|
|
44
|
+
placeholder.style.left = "".concat(left, "px");
|
|
45
|
+
placeholder.style.border = elStyles.border;
|
|
46
|
+
placeholder.style.borderRadius = elStyles.borderRadius;
|
|
47
|
+
ref.grid.append(placeholder);
|
|
48
|
+
} else {
|
|
49
|
+
var $cloneEl = $el.cloneNode(true);
|
|
50
|
+
ref.grid.append($cloneEl);
|
|
51
|
+
$draggaleEl = $cloneEl;
|
|
52
|
+
}
|
|
53
|
+
var elOffsetWindow = (0, _general.getOffsetFromWindow)($el);
|
|
54
|
+
var translateX = 0;
|
|
55
|
+
var translateY = 0;
|
|
56
|
+
if (!isNaN(parseFloat(top))) {
|
|
57
|
+
translateY = parseFloat(top);
|
|
58
|
+
}
|
|
59
|
+
if (!isNaN(parseFloat(left))) {
|
|
60
|
+
translateX = parseFloat(left);
|
|
61
|
+
}
|
|
62
|
+
$draggaleEl.style.transform = " translate(".concat(translateX - paddingLeft, "px, ").concat(translateY - paddingTop, "px)");
|
|
63
|
+
$draggaleEl.style.top = "".concat(paddingTop, "px");
|
|
64
|
+
$draggaleEl.style.left = "".concat(paddingLeft, "px");
|
|
65
|
+
window.GSSortableConfigue.draggableInfo = {
|
|
66
|
+
moved: false,
|
|
67
|
+
ref: ref,
|
|
68
|
+
index: index,
|
|
69
|
+
$el: $draggaleEl,
|
|
70
|
+
clientX: e.clientX,
|
|
71
|
+
clientY: e.clientY,
|
|
72
|
+
placeholder: placeholder,
|
|
73
|
+
newLeft: left,
|
|
74
|
+
newTop: top,
|
|
75
|
+
fromLeft: (e.clientX - elOffsetWindow.left) / $el.offsetWidth,
|
|
76
|
+
fromTop: (e.clientY - elOffsetWindow.top) / $el.offsetHeight
|
|
77
|
+
};
|
|
78
|
+
$draggaleEl.classList.add("gs-sortable-item-inmove");
|
|
79
|
+
ref.grid.classList.add("gs-sortable-active");
|
|
80
|
+
if (ref.grid.closest(".gs-sortable-item") != null) {
|
|
81
|
+
ref.grid.closest(".gs-sortable-item").classList.add("gs-sortable-item-active-parent");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var _default = exports["default"] = initDraggable;
|