@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
|
@@ -1,278 +1,247 @@
|
|
|
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
|
-
info.newTop = placeholderTop;
|
|
61
|
-
info.newLeft = placeholderLeft;
|
|
62
|
-
placeholderSeted = true;
|
|
63
|
-
plIndex = itIndex;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
67
|
-
if (currentTop == containerPT) {
|
|
68
|
-
currentTop = containerPT + height;
|
|
69
|
-
currentHeight = currentHeight + height;
|
|
70
|
-
} else {
|
|
71
|
-
currentTop = currentTop + gapY + height;
|
|
72
|
-
currentHeight = currentHeight + height + gapY;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} else if (params.type ==
|
|
76
|
-
if (!placeholderSeted) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
? containerPL
|
|
249
|
-
: containerPL + (itIndex % params.count) * (itemWidth + gapX);
|
|
250
|
-
const top = currentTop;
|
|
251
|
-
if (height > colHeight) {
|
|
252
|
-
colHeight = height;
|
|
253
|
-
}
|
|
254
|
-
if (
|
|
255
|
-
itIndex % params.count === params.count - 1 ||
|
|
256
|
-
itIndex === itemsCount - 1
|
|
257
|
-
) {
|
|
258
|
-
if (top === containerPT) {
|
|
259
|
-
currentHeight = currentHeight + colHeight;
|
|
260
|
-
} else {
|
|
261
|
-
currentHeight = currentHeight + colHeight + gapY;
|
|
262
|
-
}
|
|
263
|
-
currentTop = currentTop + colHeight + gapY;
|
|
264
|
-
colHeight = 0;
|
|
265
|
-
ref.grid.style.height = `${currentHeight}px`;
|
|
266
|
-
}
|
|
267
|
-
el.style.left = `${left}px`;
|
|
268
|
-
el.style.top = `${top}px`;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
itIndex += 1;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export default calculateOnSort;
|
|
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
|
+
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 calculateOnSort = function calculateOnSort(ref) {
|
|
17
|
+
var params = ref.currentParams;
|
|
18
|
+
if (!params.takeClone) {
|
|
19
|
+
var $items = _toConsumableArray(ref.grid.children);
|
|
20
|
+
var itemsCount = $items.filter(function (x) {
|
|
21
|
+
return !x.classList.contains("gs-sortable-item-inmove");
|
|
22
|
+
}).length;
|
|
23
|
+
var info = window.GSSortableConfigue.draggableInfo;
|
|
24
|
+
var _ref$uiData = ref.uiData,
|
|
25
|
+
containerPT = _ref$uiData.containerPT,
|
|
26
|
+
containerPL = _ref$uiData.containerPL,
|
|
27
|
+
currentHeight = _ref$uiData.currentHeight,
|
|
28
|
+
currentWidth = _ref$uiData.currentWidth,
|
|
29
|
+
itemWidth = _ref$uiData.itemWidth,
|
|
30
|
+
gapX = _ref$uiData.gapX,
|
|
31
|
+
gapY = _ref$uiData.gapY;
|
|
32
|
+
var currentLeft = containerPL;
|
|
33
|
+
var currentTop = containerPT;
|
|
34
|
+
var maxHeight = 0;
|
|
35
|
+
var placeholderSeted = info === undefined;
|
|
36
|
+
var inProcessEl = undefined;
|
|
37
|
+
var containerCoord = (0, _general.getOffsetFromWindow)(info.ref.grid);
|
|
38
|
+
if (info !== undefined) {
|
|
39
|
+
var $el = info.$el;
|
|
40
|
+
var elCoord = (0, _general.getOffsetFromWindow)($el);
|
|
41
|
+
inProcessEl = {
|
|
42
|
+
height: $el.offsetHeight,
|
|
43
|
+
width: $el.offsetWidth,
|
|
44
|
+
top: elCoord.top - containerCoord.top,
|
|
45
|
+
left: elCoord.left - containerCoord.left
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var plIndex = info.index;
|
|
49
|
+
var colHeight = 0;
|
|
50
|
+
var itIndex = 0;
|
|
51
|
+
$items.map(function (el) {
|
|
52
|
+
if (!el.classList.contains("gs-sortable-item-inmove")) {
|
|
53
|
+
var height = el.offsetHeight;
|
|
54
|
+
var width = el.offsetWidth;
|
|
55
|
+
if (params.type == _types["default"].column) {
|
|
56
|
+
if (!placeholderSeted) {
|
|
57
|
+
var placeholderTop = currentTop == containerPT ? containerPT : currentTop + gapY;
|
|
58
|
+
var placeholderLeft = containerPL;
|
|
59
|
+
if (Math.abs(placeholderTop - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
|
|
60
|
+
info.newTop = placeholderTop;
|
|
61
|
+
info.newLeft = placeholderLeft;
|
|
62
|
+
placeholderSeted = true;
|
|
63
|
+
plIndex = itIndex;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
67
|
+
if (currentTop == containerPT) {
|
|
68
|
+
currentTop = containerPT + height;
|
|
69
|
+
currentHeight = currentHeight + height;
|
|
70
|
+
} else {
|
|
71
|
+
currentTop = currentTop + gapY + height;
|
|
72
|
+
currentHeight = currentHeight + height + gapY;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} else if (params.type == _types["default"].row) {
|
|
76
|
+
if (!placeholderSeted) {
|
|
77
|
+
var _placeholderLeft = currentLeft == containerPL ? containerPL : currentLeft + gapX;
|
|
78
|
+
var _placeholderTop = containerPT;
|
|
79
|
+
if (Math.abs(_placeholderTop - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(_placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
|
|
80
|
+
info.newTop = _placeholderTop;
|
|
81
|
+
info.newLeft = _placeholderLeft;
|
|
82
|
+
placeholderSeted = true;
|
|
83
|
+
plIndex = itIndex;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
87
|
+
if (currentLeft == containerPL) {
|
|
88
|
+
currentLeft = containerPL + width;
|
|
89
|
+
currentWidth = currentWidth + width;
|
|
90
|
+
} else {
|
|
91
|
+
currentLeft = currentLeft + gapX + width;
|
|
92
|
+
currentWidth = currentWidth + width + gapX;
|
|
93
|
+
}
|
|
94
|
+
if (height > maxHeight) {
|
|
95
|
+
maxHeight = height;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} else if (params.type == _types["default"].grid) {
|
|
99
|
+
var _placeholderLeft2 = itIndex % params.count == 0 ? containerPL : containerPL + itIndex % params.count * (itemWidth + gapX);
|
|
100
|
+
var _placeholderTop2 = currentTop;
|
|
101
|
+
if (Math.abs(_placeholderTop2 - inProcessEl.top) < inProcessEl.height / 2 && Math.abs(_placeholderLeft2 - inProcessEl.left) < inProcessEl.width / 2) {
|
|
102
|
+
info.newTop = _placeholderTop2;
|
|
103
|
+
info.newLeft = _placeholderLeft2;
|
|
104
|
+
placeholderSeted = true;
|
|
105
|
+
plIndex = itIndex;
|
|
106
|
+
}
|
|
107
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
108
|
+
var top = currentTop;
|
|
109
|
+
if (height > colHeight) {
|
|
110
|
+
colHeight = height;
|
|
111
|
+
}
|
|
112
|
+
if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
|
|
113
|
+
if (top === containerPT) {
|
|
114
|
+
currentHeight = currentHeight + colHeight;
|
|
115
|
+
} else {
|
|
116
|
+
currentHeight = currentHeight + colHeight + gapY;
|
|
117
|
+
}
|
|
118
|
+
currentTop = currentTop + colHeight + gapY;
|
|
119
|
+
colHeight = 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
itIndex += 1;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
{
|
|
127
|
+
info.index = plIndex;
|
|
128
|
+
var _ref$uiData2 = ref.uiData,
|
|
129
|
+
_containerPT = _ref$uiData2.containerPT,
|
|
130
|
+
_containerPL = _ref$uiData2.containerPL,
|
|
131
|
+
_currentHeight = _ref$uiData2.currentHeight,
|
|
132
|
+
_currentWidth = _ref$uiData2.currentWidth,
|
|
133
|
+
_itemWidth = _ref$uiData2.itemWidth,
|
|
134
|
+
_gapX = _ref$uiData2.gapX,
|
|
135
|
+
_gapY = _ref$uiData2.gapY;
|
|
136
|
+
currentLeft = _containerPL;
|
|
137
|
+
currentTop = _containerPT;
|
|
138
|
+
itIndex = 0;
|
|
139
|
+
$items.map(function (el) {
|
|
140
|
+
if (!el.classList.contains("gs-sortable-item-inmove")) {
|
|
141
|
+
var height = el.offsetHeight;
|
|
142
|
+
var width = el.offsetWidth;
|
|
143
|
+
if (params.type == _types["default"].column) {
|
|
144
|
+
if (itIndex == plIndex) {
|
|
145
|
+
info.placeholder.style.left = "".concat(_containerPL, "px");
|
|
146
|
+
info.newLeft = _containerPL;
|
|
147
|
+
if (currentTop == _containerPT) {
|
|
148
|
+
info.newTop = _containerPT;
|
|
149
|
+
info.placeholder.style.top = "".concat(_containerPT, "px");
|
|
150
|
+
currentTop = _containerPT + inProcessEl.height;
|
|
151
|
+
} else {
|
|
152
|
+
info.newTop = currentTop + _gapY;
|
|
153
|
+
info.placeholder.style.top = "".concat(currentTop + _gapY, "px");
|
|
154
|
+
currentTop = currentTop + _gapY + inProcessEl.height;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
158
|
+
el.style.left = "".concat(_containerPL, "px");
|
|
159
|
+
if (currentTop == _containerPT) {
|
|
160
|
+
el.style.top = "".concat(_containerPT, "px");
|
|
161
|
+
currentTop = _containerPT + height;
|
|
162
|
+
_currentHeight = _currentHeight + height;
|
|
163
|
+
} else {
|
|
164
|
+
el.style.top = "".concat(currentTop + _gapY, "px");
|
|
165
|
+
currentTop = currentTop + _gapY + height;
|
|
166
|
+
_currentHeight = _currentHeight + height + _gapY;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} else if (params.type == _types["default"].row) {
|
|
170
|
+
if (itIndex == plIndex) {
|
|
171
|
+
info.placeholder.style.top = "".concat(_containerPT, "px");
|
|
172
|
+
info.newTop = _containerPT;
|
|
173
|
+
if (currentLeft == _containerPL) {
|
|
174
|
+
info.newLeft = _containerPL;
|
|
175
|
+
info.placeholder.style.left = "".concat(_containerPL, "px");
|
|
176
|
+
currentLeft = _containerPL + inProcessEl.width;
|
|
177
|
+
} else {
|
|
178
|
+
info.newLeft = currentLeft + _gapX;
|
|
179
|
+
info.placeholder.style.left = "".concat(currentLeft + _gapX, "px");
|
|
180
|
+
currentLeft = currentLeft + _gapX + inProcessEl.width;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
184
|
+
el.style.top = "".concat(_containerPT, "px");
|
|
185
|
+
if (currentLeft == _containerPL) {
|
|
186
|
+
el.style.left = "".concat(_containerPL, "px");
|
|
187
|
+
currentLeft = _containerPL + width;
|
|
188
|
+
_currentWidth = _currentWidth + width;
|
|
189
|
+
} else {
|
|
190
|
+
el.style.left = "".concat(currentLeft + _gapX, "px");
|
|
191
|
+
currentLeft = currentLeft + _gapX + width;
|
|
192
|
+
_currentWidth = _currentWidth + width + _gapX;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (height > maxHeight) {
|
|
196
|
+
maxHeight = height;
|
|
197
|
+
}
|
|
198
|
+
} else if (params.type == _types["default"].grid) {
|
|
199
|
+
if (itIndex == plIndex) {
|
|
200
|
+
var left = itIndex % params.count == 0 ? _containerPL : _containerPL + itIndex % params.count * (_itemWidth + _gapX);
|
|
201
|
+
var top = currentTop;
|
|
202
|
+
if (inProcessEl.height > colHeight) {
|
|
203
|
+
colHeight = inProcessEl.height;
|
|
204
|
+
}
|
|
205
|
+
if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
|
|
206
|
+
if (top === _containerPT) {
|
|
207
|
+
_currentHeight = _currentHeight + colHeight;
|
|
208
|
+
} else {
|
|
209
|
+
_currentHeight = _currentHeight + colHeight + _gapY;
|
|
210
|
+
}
|
|
211
|
+
currentTop = currentTop + colHeight + _gapY;
|
|
212
|
+
colHeight = 0;
|
|
213
|
+
ref.grid.style.height = "".concat(_currentHeight, "px");
|
|
214
|
+
}
|
|
215
|
+
itIndex += 1;
|
|
216
|
+
info.newTop = top;
|
|
217
|
+
info.newLeft = left;
|
|
218
|
+
info.placeholder.style.left = "".concat(left, "px");
|
|
219
|
+
info.placeholder.style.top = "".concat(top, "px");
|
|
220
|
+
}
|
|
221
|
+
if (!el.classList.contains("gs-sortable-placeholder")) {
|
|
222
|
+
var _left = itIndex % params.count == 0 ? _containerPL : _containerPL + itIndex % params.count * (_itemWidth + _gapX);
|
|
223
|
+
var _top = currentTop;
|
|
224
|
+
if (height > colHeight) {
|
|
225
|
+
colHeight = height;
|
|
226
|
+
}
|
|
227
|
+
if (itIndex % params.count === params.count - 1 || itIndex === itemsCount - 1) {
|
|
228
|
+
if (_top === _containerPT) {
|
|
229
|
+
_currentHeight = _currentHeight + colHeight;
|
|
230
|
+
} else {
|
|
231
|
+
_currentHeight = _currentHeight + colHeight + _gapY;
|
|
232
|
+
}
|
|
233
|
+
currentTop = currentTop + colHeight + _gapY;
|
|
234
|
+
colHeight = 0;
|
|
235
|
+
ref.grid.style.height = "".concat(_currentHeight, "px");
|
|
236
|
+
}
|
|
237
|
+
el.style.left = "".concat(_left, "px");
|
|
238
|
+
el.style.top = "".concat(_top, "px");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
itIndex += 1;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var _default = exports["default"] = calculateOnSort;
|
|
@@ -1,28 +1,26 @@
|
|
|
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
|
-
export default checkItemInContainer;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _general = require("./general");
|
|
8
|
+
var checkItemInContainer = function checkItemInContainer(grid, el) {
|
|
9
|
+
var gridOffset = (0, _general.getOffsetFromWindow)(grid);
|
|
10
|
+
var elOffset = (0, _general.getOffsetFromWindow)(el);
|
|
11
|
+
var gridTop = gridOffset.top;
|
|
12
|
+
var gridLeft = gridOffset.left;
|
|
13
|
+
var elTop = elOffset.top;
|
|
14
|
+
var elLeft = elOffset.left;
|
|
15
|
+
var offsetTopFromGrid = elTop - gridTop;
|
|
16
|
+
var offsetLeftFromGrid = elLeft - gridLeft;
|
|
17
|
+
var elHeight = el.offsetHeight;
|
|
18
|
+
var elWidth = el.offsetWidth;
|
|
19
|
+
var gridHeight = grid.offsetHeight;
|
|
20
|
+
var gridWidth = grid.offsetWidth;
|
|
21
|
+
if (offsetTopFromGrid >= -1 * elHeight / 2 && offsetLeftFromGrid >= -1 * elWidth / 2 && offsetTopFromGrid <= gridHeight - elHeight / 2 && offsetLeftFromGrid <= gridWidth - elWidth / 2) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
var _default = exports["default"] = checkItemInContainer;
|