@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.
@@ -1,22 +1,33 @@
1
- import types from '../constants/types';
2
-
3
- const destroy = ref => {
4
- ref.grid.classList.remove('gs-sortable-instance');
5
- ref.grid.classList.remove(`gs-sortable-${ref.currentParams.type}`);
6
- ref.grid.style.removeProperty('position');
7
- ref.grid.style.removeProperty('gap');
8
- ref.grid.style.removeProperty('height');
9
- if (ref.currentParams.type == types.row) {
10
- ref.grid.style.removeProperty('width');
11
- }
12
- [...ref.grid.children].map(el => {
13
- el.classList.remove('gs-sortable-item');
14
- el.style.removeProperty('position');
15
- el.style.removeProperty('width');
16
- el.style.removeProperty('left');
17
- el.style.removeProperty('top');
18
- el.style.removeProperty('transition');
19
- });
20
- };
21
-
22
- export default destroy;
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;
@@ -1,81 +1,90 @@
1
- export const getTranslateCoord = (element) => {
2
- const style = window.getComputedStyle(element);
3
- // eslint-disable-next-line no-undef
4
- const matrix = new WebKitCSSMatrix(style.transform);
5
- return {
6
- x: matrix.e,
7
- y: matrix.f,
8
- };
9
- };
10
- export const getOffsetFromBody = (el) => {
11
- let top = 0,
12
- left = 0;
13
-
14
- // Loop through every parent element
15
- while (el && el !== document.body) {
16
- top += el.offsetTop || 0;
17
- left += el.offsetLeft || 0;
18
-
19
- // Handle transformations (i.e., translate, scale)
20
- const transform = window.getComputedStyle(el).transform;
21
- if (transform !== 'none') {
22
- const matrix = new DOMMatrix(transform);
23
- top += matrix.m42 || 0;
24
- left += matrix.m41 || 0;
25
- }
26
-
27
- // If there's a positioned parent, move up the tree
28
- el = el.offsetParent;
29
- }
30
-
31
- // Add scroll offsets for body, in case of page scrolling
32
- top += document.body.scrollTop || document.documentElement.scrollTop || 0;
33
- left += document.body.scrollLeft || document.documentElement.scrollLeft || 0;
34
-
35
- return { top, left };
36
- };
37
- export const getOffsetFromWindow = (el) => {
38
- let top = 0,
39
- left = 0;
40
-
41
- // Loop through each parent, accumulating the offset relative to the viewport
42
- while (el) {
43
- top += el.offsetTop || 0;
44
- left += el.offsetLeft || 0;
45
-
46
- // Handle transforms (translate, scale, etc.)
47
- const transform = window.getComputedStyle(el).transform;
48
- if (transform !== 'none') {
49
- const matrix = new DOMMatrix(transform);
50
- top += matrix.m42 || 0;
51
- left += matrix.m41 || 0;
52
- }
53
-
54
- // Move to the next parent element
55
- el = el.offsetParent;
56
- }
57
-
58
- // Subtract scroll position from the window (not the document)
59
- top -= window.scrollY || 0;
60
- left -= window.scrollX || 0;
61
-
62
- return { top, left };
63
- };
64
- export const moveChildToIndex = (parent, child, newIndex) => {
65
- let children = Array.from(parent.children);
66
- let oldIndex = children.indexOf(child);
67
- if (oldIndex !== newIndex) {
68
- if (oldIndex === newIndex) return; // If not found or same position, do nothing
69
-
70
- // Ensure the new index is within valid bounds
71
- newIndex = Math.max(0, Math.min(newIndex, children.length - 1));
72
-
73
- if (newIndex > oldIndex && oldIndex != -1) {
74
- // Moving forward, so insert after the target index
75
- parent.insertBefore(child, children[newIndex].nextSibling);
76
- } else {
77
- // Moving backward, insert before the target index
78
- parent.insertBefore(child, children[newIndex]);
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
- import _defaultParams from "../constants/defaultParams";
2
-
3
- const getCurrentParams = (params) => {
4
- const defaultParams = { ..._defaultParams };
5
- let finalParams = {
6
- ...defaultParams,
7
- ...params,
8
- };
9
-
10
- if (finalParams.responsive.length > 0) {
11
- finalParams.responsive.sort((a, b) => b.windowSize - a.windowSize);
12
- }
13
-
14
- if (finalParams.responsive.length > 0) {
15
- const windowSize = window.innerWidth;
16
- const availableResponsives = finalParams.responsive.filter(
17
- (resp) => resp.windowSize >= windowSize
18
- );
19
-
20
- availableResponsives.map((resp) => {
21
- finalParams = {
22
- ...finalParams,
23
- ...resp.params,
24
- };
25
- return resp;
26
- });
27
- }
28
-
29
- return finalParams;
30
- };
31
-
32
- export default getCurrentParams;
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;
@@ -1,24 +1,33 @@
1
- import constParams from '../constants/constParams';
2
- import calculate from './calculate';
3
- import initDraggable from './initDraggable';
4
-
5
- const init = (ref) => {
6
- const transition = `left ${constParams.animateionSpeed}ms, top ${constParams.animateionSpeed}ms, transform ${constParams.animateionSpeed}ms`;
7
- ref.grid.classList.add('gs-sortable-instance');
8
- ref.grid.classList.add(`gs-sortable-${ref.currentParams.type}`);
9
- [...ref.grid.children].map((el) => {
10
- el.classList.add('gs-sortable-item');
11
- el.style.transition = transition;
12
- el.style.position = 'absolute';
13
-
14
- let resizeObserver = new ResizeObserver(() => {
15
- calculate(ref);
16
- });
17
- resizeObserver.observe(el);
18
- });
19
- ref.count = ref.grid.children.length;
20
-
21
- initDraggable(ref);
22
- };
23
-
24
- export default init;
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
- import constParams from "../constants/constParams";
2
- import { getOffsetFromBody, getOffsetFromWindow } from "./general";
3
-
4
- const initDraggable = (ref) => {
5
- const params = ref.currentParams;
6
-
7
- const $items = [...ref.grid.children];
8
- $items.map(($el, index) => {
9
- $el.onmousedown = null;
10
- const handler =
11
- params.handler != "" ? $el.querySelector(params.handler) : $el;
12
- if (handler != null) {
13
- handler.style.cursor = "move";
14
- handler.onmousedown = (e) => {
15
- if (!ref.isAddjusting) {
16
- window.GSSortableConfigue.overInItemRef = ref;
17
- window.GSSortableConfigue.takeFrom = ref;
18
- const container = ref.grid;
19
- const elStyles = getComputedStyle($el);
20
- const containerStyles = getComputedStyle(container);
21
- const paddingTop = parseFloat(containerStyles.paddingTop);
22
- const paddingLeft = parseFloat(containerStyles.paddingLeft);
23
- const top = parseFloat(elStyles.top);
24
- const left = parseFloat(elStyles.left);
25
- let $draggaleEl = $el;
26
- const placeholder = document.createElement("div");
27
- if (!params.takeClone) {
28
- placeholder.classList.add("gs-sortable-placeholder");
29
- placeholder.style.position = elStyles.position;
30
- placeholder.style.transition = `left ${constParams.animateionSpeed}ms, top ${constParams.animateionSpeed}ms, transform ${constParams.animateionSpeed}ms, opacity ${constParams.animateionSpeed}ms, opacity ${constParams.animateionSpeed}ms`;
31
- placeholder.style.width = `${$el.offsetWidth}px`;
32
- placeholder.style.height = `${$el.offsetHeight}px`;
33
- placeholder.style.top = `${top}px`;
34
- placeholder.style.left = `${left}px`;
35
- placeholder.style.border = elStyles.border;
36
- placeholder.style.borderRadius = elStyles.borderRadius;
37
- ref.grid.append(placeholder);
38
- } else {
39
- const $cloneEl = $el.cloneNode(true);
40
- ref.grid.append($cloneEl);
41
- $draggaleEl = $cloneEl;
42
- }
43
-
44
- const elOffsetWindow = getOffsetFromWindow($el);
45
-
46
- let translateX = 0;
47
- let translateY = 0;
48
- if (!isNaN(parseFloat(top))) {
49
- translateY = parseFloat(top);
50
- }
51
- if (!isNaN(parseFloat(left))) {
52
- translateX = parseFloat(left);
53
- }
54
- $draggaleEl.style.transform = ` translate(${
55
- translateX - paddingLeft
56
- }px, ${translateY - paddingTop}px)`;
57
- $draggaleEl.style.top = `${paddingTop}px`;
58
- $draggaleEl.style.left = `${paddingLeft}px`;
59
-
60
- window.GSSortableConfigue.draggableInfo = {
61
- moved: false,
62
- ref: ref,
63
- index,
64
- $el: $draggaleEl,
65
- clientX: e.clientX,
66
- clientY: e.clientY,
67
- placeholder,
68
- newLeft: left,
69
- newTop: top,
70
- fromLeft: (e.clientX - elOffsetWindow.left) / $el.offsetWidth,
71
- fromTop: (e.clientY - elOffsetWindow.top) / $el.offsetHeight,
72
- };
73
-
74
- $draggaleEl.classList.add("gs-sortable-item-inmove");
75
- ref.grid.classList.add("gs-sortable-active");
76
- if (ref.grid.closest(".gs-sortable-item") != null) {
77
- ref.grid
78
- .closest(".gs-sortable-item")
79
- .classList.add("gs-sortable-item-active-parent");
80
- }
81
- }
82
- };
83
- }
84
- });
85
- };
86
-
87
- export default initDraggable;
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;