@get-set/gs-sortable 0.0.35 → 0.0.37

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.
Files changed (110) hide show
  1. package/README.md +99 -1
  2. package/actions/afterAllImagesLoad.ts +36 -0
  3. package/actions/calculate.ts +155 -0
  4. package/actions/calculateOnSort.ts +270 -0
  5. package/actions/checkItemInContainer.ts +22 -0
  6. package/actions/destroy.ts +30 -0
  7. package/actions/general.ts +72 -0
  8. package/actions/getCurrentParams.ts +32 -0
  9. package/actions/init.ts +31 -0
  10. package/actions/initDraggable.ts +85 -0
  11. package/actions/initMouseMove.ts +120 -0
  12. package/actions/initScroll.ts +21 -0
  13. package/actions/initSortEnd.ts +87 -0
  14. package/components/GSSortable.tsx +160 -0
  15. package/components/styles/GSSortable.css +39 -0
  16. package/components/styles/GSSortable.scss +38 -0
  17. package/components/styles/GSSortableCSS.ts +41 -0
  18. package/constants/constParams.ts +5 -0
  19. package/constants/defaultParams.ts +20 -0
  20. package/constants/types.ts +7 -0
  21. package/dist/GSSortable.d.ts +2 -0
  22. package/dist/actions/afterAllImagesLoad.d.ts +4 -0
  23. package/dist/actions/afterAllImagesLoad.d.ts.map +1 -0
  24. package/dist/actions/afterAllImagesLoad.js +35 -0
  25. package/dist/actions/afterAllImagesLoad.js.map +1 -0
  26. package/dist/actions/calculate.d.ts +3 -2
  27. package/dist/actions/calculate.d.ts.map +1 -0
  28. package/dist/actions/calculate.js +13 -18
  29. package/dist/actions/calculate.js.map +1 -1
  30. package/dist/actions/calculateOnSort.d.ts +3 -2
  31. package/dist/actions/calculateOnSort.d.ts.map +1 -0
  32. package/dist/actions/calculateOnSort.js +164 -58
  33. package/dist/actions/calculateOnSort.js.map +1 -1
  34. package/dist/actions/checkItemInContainer.d.ts +1 -0
  35. package/dist/actions/checkItemInContainer.d.ts.map +1 -0
  36. package/dist/actions/checkItemInContainer.js +8 -17
  37. package/dist/actions/checkItemInContainer.js.map +1 -1
  38. package/dist/actions/destroy.d.ts +3 -8
  39. package/dist/actions/destroy.d.ts.map +1 -0
  40. package/dist/actions/destroy.js +7 -9
  41. package/dist/actions/destroy.js.map +1 -1
  42. package/dist/actions/general.d.ts +1 -0
  43. package/dist/actions/general.d.ts.map +1 -0
  44. package/dist/actions/general.js +5 -12
  45. package/dist/actions/general.js.map +1 -1
  46. package/dist/actions/getCurrentParams.d.ts +4 -9
  47. package/dist/actions/getCurrentParams.d.ts.map +1 -0
  48. package/dist/actions/getCurrentParams.js +15 -18
  49. package/dist/actions/getCurrentParams.js.map +1 -1
  50. package/dist/actions/init.d.ts +3 -2
  51. package/dist/actions/init.d.ts.map +1 -0
  52. package/dist/actions/init.js +13 -16
  53. package/dist/actions/init.js.map +1 -1
  54. package/dist/actions/initDraggable.d.ts +3 -2
  55. package/dist/actions/initDraggable.d.ts.map +1 -0
  56. package/dist/actions/initDraggable.js +14 -22
  57. package/dist/actions/initDraggable.js.map +1 -1
  58. package/dist/actions/initMouseMove.d.ts +1 -0
  59. package/dist/actions/initMouseMove.d.ts.map +1 -0
  60. package/dist/actions/initMouseMove.js +40 -53
  61. package/dist/actions/initMouseMove.js.map +1 -1
  62. package/dist/actions/initScroll.d.ts +1 -0
  63. package/dist/actions/initScroll.d.ts.map +1 -0
  64. package/dist/actions/initScroll.js +7 -15
  65. package/dist/actions/initScroll.js.map +1 -1
  66. package/dist/actions/initSortEnd.d.ts +2 -1
  67. package/dist/actions/initSortEnd.d.ts.map +1 -0
  68. package/dist/actions/initSortEnd.js +62 -71
  69. package/dist/actions/initSortEnd.js.map +1 -1
  70. package/dist/components/GSSortable.d.ts +4 -19
  71. package/dist/components/GSSortable.d.ts.map +1 -0
  72. package/dist/components/GSSortable.js +72 -105
  73. package/dist/components/GSSortable.js.map +1 -1
  74. package/dist/components/styles/GSSortableCSS.d.ts +2 -1
  75. package/dist/components/styles/GSSortableCSS.d.ts.map +1 -0
  76. package/dist/components/styles/GSSortableCSS.js +3 -4
  77. package/dist/components/styles/GSSortableCSS.js.map +1 -1
  78. package/dist/constants/constParams.d.ts +4 -3
  79. package/dist/constants/constParams.d.ts.map +1 -0
  80. package/dist/constants/constParams.js +2 -4
  81. package/dist/constants/constParams.js.map +1 -1
  82. package/dist/constants/defaultParams.d.ts +3 -2
  83. package/dist/constants/defaultParams.d.ts.map +1 -0
  84. package/dist/constants/defaultParams.js +3 -8
  85. package/dist/constants/defaultParams.js.map +1 -1
  86. package/dist/constants/types.d.ts +1 -0
  87. package/dist/constants/types.d.ts.map +1 -0
  88. package/dist/constants/types.js +1 -3
  89. package/dist/constants/types.js.map +1 -1
  90. package/dist/helpers/uihelpers.d.ts +2 -1
  91. package/dist/helpers/uihelpers.d.ts.map +1 -0
  92. package/dist/helpers/uihelpers.js +9 -23
  93. package/dist/helpers/uihelpers.js.map +1 -1
  94. package/dist/types/params.d.ts +23 -0
  95. package/dist/types/params.d.ts.map +1 -0
  96. package/dist/types/params.js +2 -0
  97. package/dist/types/params.js.map +1 -0
  98. package/dist/types/ref.d.ts +41 -0
  99. package/dist/types/ref.d.ts.map +1 -0
  100. package/dist/types/ref.js +2 -0
  101. package/dist/types/ref.js.map +1 -0
  102. package/dist-js/bundle.js +1181 -0
  103. package/helpers/uihelpers.ts +44 -0
  104. package/package.json +71 -43
  105. package/styles/GSSortable.css +39 -0
  106. package/styles/GSSortable.scss +38 -0
  107. package/types/global.d.ts +19 -0
  108. package/types/params.ts +24 -0
  109. package/types/ref.ts +41 -0
  110. package/index.js +0 -3
@@ -0,0 +1,1181 @@
1
+
2
+ (() => {
3
+ if (window.jQuery) {
4
+ $.fn.GSSortable = function (params) {
5
+ this.each(function(){
6
+ new window.GSSortable(this, params);
7
+ })
8
+ };
9
+ }
10
+ HTMLElement.prototype.GSSortable = function(params) {
11
+ new window.GSSortable(this, params);
12
+ };
13
+ })();
14
+
15
+ /******/ (() => { // webpackBootstrap
16
+ /******/ "use strict";
17
+ /******/ var __webpack_modules__ = ({
18
+
19
+ /***/ 571
20
+ (__unused_webpack_module, exports, __webpack_require__) {
21
+
22
+
23
+ var __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
27
+ /// <reference path="./types/global.d.ts" />
28
+ const getCurrentParams_1 = __importDefault(__webpack_require__(238));
29
+ const afterAllImagesLoad_1 = __importDefault(__webpack_require__(502));
30
+ const init_1 = __importDefault(__webpack_require__(43));
31
+ const destroy_1 = __importDefault(__webpack_require__(403));
32
+ const initMouseMove_1 = __importDefault(__webpack_require__(705));
33
+ const initSortEnd_1 = __importDefault(__webpack_require__(518));
34
+ const initScroll_1 = __importDefault(__webpack_require__(618));
35
+ const calculate_1 = __importDefault(__webpack_require__(605));
36
+ const uihelpers_1 = __webpack_require__(432);
37
+ window.GSSortable = function (grid, params = {}) {
38
+ const _params = { ...params };
39
+ const _key = _params.reference != undefined && _params.reference !== ''
40
+ ? _params.reference
41
+ : (0, uihelpers_1.NewGuid)();
42
+ _params.reference = _key;
43
+ if (typeof window.GSSortableConfigue === 'undefined') {
44
+ window.GSSortableConfigue = {
45
+ references: [],
46
+ instance: (ref) => {
47
+ if (ref != undefined && ref !== '') {
48
+ const instance = window.GSSortableConfigue.references.find((x) => x.key === ref);
49
+ if (instance != undefined) {
50
+ return instance.ref;
51
+ }
52
+ }
53
+ },
54
+ };
55
+ window.addEventListener('mousemove', (e) => (0, initMouseMove_1.default)(e));
56
+ window.addEventListener('mouseup', (e) => (0, initSortEnd_1.default)(e));
57
+ window.addEventListener('scroll', () => (0, initScroll_1.default)());
58
+ }
59
+ if (window.GSSortableConfigue.references.find((x) => x.key === _key) === undefined) {
60
+ const currentParams = (0, getCurrentParams_1.default)(_params);
61
+ window.GSSortableConfigue.references.push({
62
+ key: _key,
63
+ ref: {
64
+ isAdjusting: false,
65
+ grid,
66
+ currentParams: { ...currentParams, reference: _key },
67
+ itemResizeObservers: [],
68
+ calculate: () => {
69
+ (0, calculate_1.default)(window.GSSortableConfigue.instance(_key));
70
+ },
71
+ destroy: () => {
72
+ (0, destroy_1.default)(window.GSSortableConfigue.instance(_key));
73
+ },
74
+ refresh: () => {
75
+ const ref = window.GSSortableConfigue.instance(_key);
76
+ (0, destroy_1.default)(ref);
77
+ (0, init_1.default)(ref);
78
+ },
79
+ },
80
+ });
81
+ const currentRef = window.GSSortableConfigue.references.find((x) => x.key === _key).ref;
82
+ (0, init_1.default)(currentRef);
83
+ (0, afterAllImagesLoad_1.default)(currentRef);
84
+ }
85
+ else {
86
+ console.error(`GSSortable with '${_key}' reference already exists`);
87
+ }
88
+ };
89
+ exports["default"] = window.GSSortable;
90
+
91
+
92
+ /***/ },
93
+
94
+ /***/ 502
95
+ (__unused_webpack_module, exports, __webpack_require__) {
96
+
97
+
98
+ var __importDefault = (this && this.__importDefault) || function (mod) {
99
+ return (mod && mod.__esModule) ? mod : { "default": mod };
100
+ };
101
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
102
+ const calculate_1 = __importDefault(__webpack_require__(605));
103
+ const afterAllImagesLoad = (ref) => {
104
+ const $images = [...ref.grid.querySelectorAll('img')];
105
+ const count = $images.length;
106
+ if (count > 0) {
107
+ let alreadyLoaded = 0;
108
+ $images.forEach((img) => {
109
+ if (img.complete) {
110
+ alreadyLoaded++;
111
+ if (alreadyLoaded === count) {
112
+ setTimeout(() => (0, calculate_1.default)(ref), 500);
113
+ }
114
+ }
115
+ else {
116
+ img.onload = () => {
117
+ alreadyLoaded++;
118
+ if (alreadyLoaded === count) {
119
+ setTimeout(() => (0, calculate_1.default)(ref), 500);
120
+ }
121
+ };
122
+ img.onerror = () => {
123
+ alreadyLoaded++;
124
+ if (alreadyLoaded === count) {
125
+ setTimeout(() => (0, calculate_1.default)(ref), 500);
126
+ }
127
+ };
128
+ }
129
+ });
130
+ }
131
+ else {
132
+ setTimeout(() => (0, calculate_1.default)(ref), 500);
133
+ }
134
+ };
135
+ exports["default"] = afterAllImagesLoad;
136
+
137
+
138
+ /***/ },
139
+
140
+ /***/ 605
141
+ (__unused_webpack_module, exports, __webpack_require__) {
142
+
143
+
144
+ var __importDefault = (this && this.__importDefault) || function (mod) {
145
+ return (mod && mod.__esModule) ? mod : { "default": mod };
146
+ };
147
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
148
+ const types_1 = __importDefault(__webpack_require__(178));
149
+ const calculate = (ref) => {
150
+ const params = ref.currentParams;
151
+ if (typeof params.beforeInit === 'function') {
152
+ params.beforeInit();
153
+ }
154
+ const $items = Array.from(ref.grid.children).filter((x) => !x.classList.contains('gs-sortable-item-inmove'));
155
+ const itemsCount = $items.length;
156
+ ref.grid.style.position = 'relative';
157
+ if (params.gap !== '') {
158
+ ref.grid.style.gap = params.gap;
159
+ }
160
+ const gridStyles = getComputedStyle(ref.grid);
161
+ const cssGap = gridStyles.gap;
162
+ let gapX = 0;
163
+ let gapY = 0;
164
+ if (cssGap) {
165
+ const [cssGapYValue, cssGapXValue] = cssGap.includes(' ')
166
+ ? cssGap.split(' ')
167
+ : [cssGap, cssGap];
168
+ const gapYSize = parseInt(cssGapYValue);
169
+ const gapXSize = parseInt(cssGapXValue);
170
+ if (!Number.isNaN(gapYSize))
171
+ gapY = gapYSize;
172
+ if (!Number.isNaN(gapXSize))
173
+ gapX = gapXSize;
174
+ }
175
+ const borderBottomWidth = parseFloat(gridStyles.borderBottomWidth);
176
+ const borderTopWidth = parseFloat(gridStyles.borderTopWidth);
177
+ const borderLeftWidth = parseFloat(gridStyles.borderLeftWidth);
178
+ const borderRightWidth = parseFloat(gridStyles.borderRightWidth);
179
+ const containerPT = parseFloat(gridStyles.paddingTop);
180
+ const containerPR = parseFloat(gridStyles.paddingRight);
181
+ const containerPB = parseFloat(gridStyles.paddingBottom);
182
+ const containerPL = parseFloat(gridStyles.paddingLeft);
183
+ const containerWidth = ref.grid.clientWidth - containerPR - containerPL;
184
+ let itemWidth = 0;
185
+ let strItemWidth = 'max-content';
186
+ if (params.type === types_1.default.grid) {
187
+ itemWidth = (containerWidth - (params.count - 1) * gapX) / params.count;
188
+ strItemWidth = `${itemWidth}px`;
189
+ }
190
+ else if (params.type === types_1.default.column) {
191
+ itemWidth = containerWidth;
192
+ strItemWidth = `${itemWidth}px`;
193
+ }
194
+ ref.itemWidth = strItemWidth;
195
+ let currentLeft = containerPL;
196
+ let currentTop = containerPT;
197
+ let currentHeight = containerPT + containerPB + borderBottomWidth + borderTopWidth;
198
+ let currentWidth = containerPL + containerPR + borderLeftWidth + borderRightWidth;
199
+ let maxHeight = 0;
200
+ $items.forEach((el) => {
201
+ if (params.type !== types_1.default.row ||
202
+ !el.classList.contains('gs-sortable-placeholder')) {
203
+ el.style.width = strItemWidth;
204
+ }
205
+ });
206
+ ref.uiData = {
207
+ containerPT,
208
+ containerPR,
209
+ containerPB,
210
+ containerPL,
211
+ containerWidth,
212
+ currentHeight,
213
+ currentWidth,
214
+ itemWidth,
215
+ gapX,
216
+ gapY,
217
+ };
218
+ let colHeight = 0;
219
+ $items.forEach((el, index) => {
220
+ const height = el.offsetHeight;
221
+ const width = el.offsetWidth;
222
+ if (params.type === types_1.default.column) {
223
+ el.style.left = `${containerPL}px`;
224
+ if (currentTop === containerPT) {
225
+ el.style.top = `${containerPT}px`;
226
+ currentTop += height;
227
+ currentHeight += height;
228
+ }
229
+ else {
230
+ el.style.top = `${currentTop + gapY}px`;
231
+ currentTop += gapY + height;
232
+ currentHeight += height + gapY;
233
+ }
234
+ }
235
+ else if (params.type === types_1.default.row) {
236
+ el.style.top = `${containerPT}px`;
237
+ if (currentLeft === containerPL) {
238
+ el.style.left = `${containerPL}px`;
239
+ currentLeft += width;
240
+ currentWidth += width;
241
+ }
242
+ else {
243
+ el.style.left = `${currentLeft + gapX}px`;
244
+ currentLeft += gapX + width;
245
+ currentWidth += width + gapX;
246
+ }
247
+ if (height > maxHeight) {
248
+ maxHeight = height;
249
+ }
250
+ }
251
+ else if (params.type === types_1.default.grid) {
252
+ const left = index % params.count === 0
253
+ ? containerPL
254
+ : containerPL + (index % params.count) * (itemWidth + gapX);
255
+ const top = currentTop;
256
+ if (height > colHeight) {
257
+ colHeight = height;
258
+ }
259
+ if (index % params.count === params.count - 1 ||
260
+ index === itemsCount - 1) {
261
+ if (top === containerPT) {
262
+ currentHeight += colHeight;
263
+ }
264
+ else {
265
+ currentHeight += colHeight + gapY;
266
+ }
267
+ currentTop += colHeight + gapY;
268
+ colHeight = 0;
269
+ }
270
+ el.style.left = `${left}px`;
271
+ el.style.top = `${top}px`;
272
+ }
273
+ });
274
+ ref.grid.style.height = `${currentHeight}px`;
275
+ if (params.type === types_1.default.row) {
276
+ ref.grid.style.height = `${currentHeight + maxHeight}px`;
277
+ ref.grid.style.width = `${currentWidth}px`;
278
+ }
279
+ };
280
+ exports["default"] = calculate;
281
+
282
+
283
+ /***/ },
284
+
285
+ /***/ 960
286
+ (__unused_webpack_module, exports, __webpack_require__) {
287
+
288
+
289
+ var __importDefault = (this && this.__importDefault) || function (mod) {
290
+ return (mod && mod.__esModule) ? mod : { "default": mod };
291
+ };
292
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
293
+ const types_1 = __importDefault(__webpack_require__(178));
294
+ const general_1 = __webpack_require__(577);
295
+ const calculateOnSort = (ref) => {
296
+ const params = ref.currentParams;
297
+ if (!params.takeClone) {
298
+ const $items = Array.from(ref.grid.children);
299
+ const itemsCount = $items.filter((x) => !x.classList.contains('gs-sortable-item-inmove')).length;
300
+ const info = window.GSSortableConfigue.draggableInfo;
301
+ let { containerPT, containerPL, currentHeight, currentWidth, itemWidth, gapX, gapY, } = ref.uiData;
302
+ let currentLeft = containerPL;
303
+ let currentTop = containerPT;
304
+ let maxHeight = 0;
305
+ let placeholderSeted = info === undefined;
306
+ let inProcessEl;
307
+ const containerCoord = (0, general_1.getOffsetFromWindow)(info?.ref.grid);
308
+ if (info !== undefined) {
309
+ const $el = info.$el;
310
+ const elCoord = (0, general_1.getOffsetFromWindow)($el);
311
+ inProcessEl = {
312
+ height: $el.offsetHeight,
313
+ width: $el.offsetWidth,
314
+ top: elCoord.top - containerCoord.top,
315
+ left: elCoord.left - containerCoord.left,
316
+ };
317
+ }
318
+ let plIndex = info?.index ?? 0;
319
+ let colHeight = 0;
320
+ let itIndex = 0;
321
+ // Pass 1 — find where the placeholder should land
322
+ $items.forEach((el) => {
323
+ if (!el.classList.contains('gs-sortable-item-inmove')) {
324
+ const height = el.offsetHeight;
325
+ const width = el.offsetWidth;
326
+ if (params.type === types_1.default.column) {
327
+ if (!placeholderSeted) {
328
+ const placeholderTop = currentTop === containerPT ? containerPT : currentTop + gapY;
329
+ const placeholderLeft = containerPL;
330
+ if (Math.abs(placeholderTop - inProcessEl.top) < inProcessEl.height / 2 &&
331
+ Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
332
+ info.newTop = placeholderTop;
333
+ info.newLeft = placeholderLeft;
334
+ placeholderSeted = true;
335
+ plIndex = itIndex;
336
+ }
337
+ }
338
+ if (!el.classList.contains('gs-sortable-placeholder')) {
339
+ if (currentTop === containerPT) {
340
+ currentTop = containerPT + height;
341
+ currentHeight += height;
342
+ }
343
+ else {
344
+ currentTop = currentTop + gapY + height;
345
+ currentHeight += height + gapY;
346
+ }
347
+ }
348
+ }
349
+ else if (params.type === types_1.default.row) {
350
+ if (!placeholderSeted) {
351
+ const placeholderLeft = currentLeft === containerPL ? containerPL : currentLeft + gapX;
352
+ const placeholderTop = containerPT;
353
+ if (Math.abs(placeholderTop - inProcessEl.top) < inProcessEl.height / 2 &&
354
+ Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
355
+ info.newTop = placeholderTop;
356
+ info.newLeft = placeholderLeft;
357
+ placeholderSeted = true;
358
+ plIndex = itIndex;
359
+ }
360
+ }
361
+ if (!el.classList.contains('gs-sortable-placeholder')) {
362
+ if (currentLeft === containerPL) {
363
+ currentLeft = containerPL + width;
364
+ currentWidth += width;
365
+ }
366
+ else {
367
+ currentLeft = currentLeft + gapX + width;
368
+ currentWidth += width + gapX;
369
+ }
370
+ if (height > maxHeight)
371
+ maxHeight = height;
372
+ }
373
+ }
374
+ else if (params.type === types_1.default.grid) {
375
+ const placeholderLeft = itIndex % params.count === 0
376
+ ? containerPL
377
+ : containerPL + (itIndex % params.count) * (itemWidth + gapX);
378
+ const placeholderTop = currentTop;
379
+ if (Math.abs(placeholderTop - inProcessEl.top) < inProcessEl.height / 2 &&
380
+ Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
381
+ info.newTop = placeholderTop;
382
+ info.newLeft = placeholderLeft;
383
+ placeholderSeted = true;
384
+ plIndex = itIndex;
385
+ }
386
+ if (!el.classList.contains('gs-sortable-placeholder')) {
387
+ const top = currentTop;
388
+ if (height > colHeight)
389
+ colHeight = height;
390
+ if (itIndex % params.count === params.count - 1 ||
391
+ itIndex === itemsCount - 1) {
392
+ if (top === containerPT) {
393
+ currentHeight += colHeight;
394
+ }
395
+ else {
396
+ currentHeight += colHeight + gapY;
397
+ }
398
+ currentTop += colHeight + gapY;
399
+ colHeight = 0;
400
+ }
401
+ }
402
+ }
403
+ itIndex += 1;
404
+ }
405
+ });
406
+ // Pass 2 — reposition everything including the placeholder
407
+ {
408
+ info.index = plIndex;
409
+ ({
410
+ containerPT,
411
+ containerPL,
412
+ currentHeight,
413
+ currentWidth,
414
+ itemWidth,
415
+ gapX,
416
+ gapY,
417
+ } = ref.uiData);
418
+ currentLeft = containerPL;
419
+ currentTop = containerPT;
420
+ itIndex = 0;
421
+ $items.forEach((el) => {
422
+ if (!el.classList.contains('gs-sortable-item-inmove')) {
423
+ const height = el.offsetHeight;
424
+ const width = el.offsetWidth;
425
+ if (params.type === types_1.default.column) {
426
+ if (itIndex === plIndex) {
427
+ info.placeholder.style.left = `${containerPL}px`;
428
+ info.newLeft = containerPL;
429
+ if (currentTop === containerPT) {
430
+ info.newTop = containerPT;
431
+ info.placeholder.style.top = `${containerPT}px`;
432
+ currentTop = containerPT + inProcessEl.height;
433
+ }
434
+ else {
435
+ info.newTop = currentTop + gapY;
436
+ info.placeholder.style.top = `${currentTop + gapY}px`;
437
+ currentTop = currentTop + gapY + inProcessEl.height;
438
+ }
439
+ }
440
+ if (!el.classList.contains('gs-sortable-placeholder')) {
441
+ el.style.left = `${containerPL}px`;
442
+ if (currentTop === containerPT) {
443
+ el.style.top = `${containerPT}px`;
444
+ currentTop = containerPT + height;
445
+ currentHeight += height;
446
+ }
447
+ else {
448
+ el.style.top = `${currentTop + gapY}px`;
449
+ currentTop = currentTop + gapY + height;
450
+ currentHeight += height + gapY;
451
+ }
452
+ }
453
+ }
454
+ else if (params.type === types_1.default.row) {
455
+ if (itIndex === plIndex) {
456
+ info.placeholder.style.top = `${containerPT}px`;
457
+ info.newTop = containerPT;
458
+ if (currentLeft === containerPL) {
459
+ info.newLeft = containerPL;
460
+ info.placeholder.style.left = `${containerPL}px`;
461
+ currentLeft = containerPL + inProcessEl.width;
462
+ }
463
+ else {
464
+ info.newLeft = currentLeft + gapX;
465
+ info.placeholder.style.left = `${currentLeft + gapX}px`;
466
+ currentLeft = currentLeft + gapX + inProcessEl.width;
467
+ }
468
+ }
469
+ if (!el.classList.contains('gs-sortable-placeholder')) {
470
+ el.style.top = `${containerPT}px`;
471
+ if (currentLeft === containerPL) {
472
+ el.style.left = `${containerPL}px`;
473
+ currentLeft = containerPL + width;
474
+ currentWidth += width;
475
+ }
476
+ else {
477
+ el.style.left = `${currentLeft + gapX}px`;
478
+ currentLeft = currentLeft + gapX + width;
479
+ currentWidth += width + gapX;
480
+ }
481
+ }
482
+ }
483
+ else if (params.type === types_1.default.grid) {
484
+ if (itIndex === plIndex) {
485
+ const left = itIndex % params.count === 0
486
+ ? containerPL
487
+ : containerPL + (itIndex % params.count) * (itemWidth + gapX);
488
+ const top = currentTop;
489
+ if (inProcessEl.height > colHeight)
490
+ colHeight = inProcessEl.height;
491
+ if (itIndex % params.count === params.count - 1 ||
492
+ itIndex === itemsCount - 1) {
493
+ if (top === containerPT) {
494
+ currentHeight += colHeight;
495
+ }
496
+ else {
497
+ currentHeight += colHeight + gapY;
498
+ }
499
+ currentTop += colHeight + gapY;
500
+ colHeight = 0;
501
+ ref.grid.style.height = `${currentHeight}px`;
502
+ }
503
+ itIndex += 1;
504
+ info.newTop = top;
505
+ info.newLeft = left;
506
+ info.placeholder.style.left = `${left}px`;
507
+ info.placeholder.style.top = `${top}px`;
508
+ }
509
+ if (!el.classList.contains('gs-sortable-placeholder')) {
510
+ const left = itIndex % params.count === 0
511
+ ? containerPL
512
+ : containerPL + (itIndex % params.count) * (itemWidth + gapX);
513
+ const top = currentTop;
514
+ if (height > colHeight)
515
+ colHeight = height;
516
+ if (itIndex % params.count === params.count - 1 ||
517
+ itIndex === itemsCount - 1) {
518
+ if (top === containerPT) {
519
+ currentHeight += colHeight;
520
+ }
521
+ else {
522
+ currentHeight += colHeight + gapY;
523
+ }
524
+ currentTop += colHeight + gapY;
525
+ colHeight = 0;
526
+ ref.grid.style.height = `${currentHeight}px`;
527
+ }
528
+ el.style.left = `${left}px`;
529
+ el.style.top = `${top}px`;
530
+ }
531
+ }
532
+ itIndex += 1;
533
+ }
534
+ });
535
+ }
536
+ }
537
+ };
538
+ exports["default"] = calculateOnSort;
539
+
540
+
541
+ /***/ },
542
+
543
+ /***/ 490
544
+ (__unused_webpack_module, exports, __webpack_require__) {
545
+
546
+
547
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
548
+ const general_1 = __webpack_require__(577);
549
+ const checkItemInContainer = (grid, el) => {
550
+ const gridOffset = (0, general_1.getOffsetFromWindow)(grid);
551
+ const elOffset = (0, general_1.getOffsetFromWindow)(el);
552
+ const offsetTopFromGrid = elOffset.top - gridOffset.top;
553
+ const offsetLeftFromGrid = elOffset.left - gridOffset.left;
554
+ const elHeight = el.offsetHeight;
555
+ const elWidth = el.offsetWidth;
556
+ const gridHeight = grid.offsetHeight;
557
+ const gridWidth = grid.offsetWidth;
558
+ return (offsetTopFromGrid >= (-1 * elHeight) / 2 &&
559
+ offsetLeftFromGrid >= (-1 * elWidth) / 2 &&
560
+ offsetTopFromGrid <= gridHeight - elHeight / 2 &&
561
+ offsetLeftFromGrid <= gridWidth - elWidth / 2);
562
+ };
563
+ exports["default"] = checkItemInContainer;
564
+
565
+
566
+ /***/ },
567
+
568
+ /***/ 403
569
+ (__unused_webpack_module, exports, __webpack_require__) {
570
+
571
+
572
+ var __importDefault = (this && this.__importDefault) || function (mod) {
573
+ return (mod && mod.__esModule) ? mod : { "default": mod };
574
+ };
575
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
576
+ const types_1 = __importDefault(__webpack_require__(178));
577
+ const destroy = (ref) => {
578
+ // Disconnect per-item resize observers to prevent leaks
579
+ ref.itemResizeObservers?.forEach((obs) => obs.disconnect());
580
+ ref.itemResizeObservers = [];
581
+ ref.grid.classList.remove('gs-sortable-instance');
582
+ ref.grid.classList.remove(`gs-sortable-${ref.currentParams.type}`);
583
+ ref.grid.style.removeProperty('position');
584
+ ref.grid.style.removeProperty('gap');
585
+ ref.grid.style.removeProperty('height');
586
+ if (ref.currentParams.type === types_1.default.row) {
587
+ ref.grid.style.removeProperty('width');
588
+ }
589
+ Array.from(ref.grid.children).forEach((el) => {
590
+ const element = el;
591
+ element.classList.remove('gs-sortable-item');
592
+ element.style.removeProperty('position');
593
+ element.style.removeProperty('width');
594
+ element.style.removeProperty('left');
595
+ element.style.removeProperty('top');
596
+ element.style.removeProperty('transition');
597
+ });
598
+ };
599
+ exports["default"] = destroy;
600
+
601
+
602
+ /***/ },
603
+
604
+ /***/ 577
605
+ (__unused_webpack_module, exports) {
606
+
607
+
608
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
609
+ exports.moveChildToIndex = exports.getOffsetFromWindow = exports.getOffsetFromBody = exports.getTranslateCoord = void 0;
610
+ const getTranslateCoord = (element) => {
611
+ const style = window.getComputedStyle(element);
612
+ const matrix = new DOMMatrix(style.transform);
613
+ return {
614
+ x: matrix.e,
615
+ y: matrix.f,
616
+ };
617
+ };
618
+ exports.getTranslateCoord = getTranslateCoord;
619
+ const getOffsetFromBody = (el) => {
620
+ let top = 0, left = 0;
621
+ while (el && el !== document.body) {
622
+ top += el.offsetTop || 0;
623
+ left += el.offsetLeft || 0;
624
+ const transform = window.getComputedStyle(el).transform;
625
+ if (transform !== 'none') {
626
+ const matrix = new DOMMatrix(transform);
627
+ top += matrix.m42 || 0;
628
+ left += matrix.m41 || 0;
629
+ }
630
+ el = el.offsetParent;
631
+ }
632
+ top += document.body.scrollTop || document.documentElement.scrollTop || 0;
633
+ left += document.body.scrollLeft || document.documentElement.scrollLeft || 0;
634
+ return { top, left };
635
+ };
636
+ exports.getOffsetFromBody = getOffsetFromBody;
637
+ const getOffsetFromWindow = (el) => {
638
+ let top = 0, left = 0;
639
+ while (el) {
640
+ top += el.offsetTop || 0;
641
+ left += el.offsetLeft || 0;
642
+ const transform = window.getComputedStyle(el).transform;
643
+ if (transform !== 'none') {
644
+ const matrix = new DOMMatrix(transform);
645
+ top += matrix.m42 || 0;
646
+ left += matrix.m41 || 0;
647
+ }
648
+ el = el.offsetParent;
649
+ }
650
+ top -= window.scrollY || 0;
651
+ left -= window.scrollX || 0;
652
+ return { top, left };
653
+ };
654
+ exports.getOffsetFromWindow = getOffsetFromWindow;
655
+ const moveChildToIndex = (parent, child, newIndex) => {
656
+ const children = Array.from(parent.children);
657
+ const oldIndex = children.indexOf(child);
658
+ if (oldIndex !== newIndex) {
659
+ newIndex = Math.max(0, Math.min(newIndex, children.length - 1));
660
+ if (newIndex > oldIndex && oldIndex !== -1) {
661
+ parent.insertBefore(child, children[newIndex].nextSibling);
662
+ }
663
+ else {
664
+ parent.insertBefore(child, children[newIndex]);
665
+ }
666
+ }
667
+ };
668
+ exports.moveChildToIndex = moveChildToIndex;
669
+
670
+
671
+ /***/ },
672
+
673
+ /***/ 238
674
+ (__unused_webpack_module, exports, __webpack_require__) {
675
+
676
+
677
+ var __importDefault = (this && this.__importDefault) || function (mod) {
678
+ return (mod && mod.__esModule) ? mod : { "default": mod };
679
+ };
680
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
681
+ const defaultParams_1 = __importDefault(__webpack_require__(636));
682
+ const getCurrentParams = (params) => {
683
+ const defaultParams = { ...defaultParams_1.default };
684
+ let finalParams = {
685
+ ...defaultParams,
686
+ ...params,
687
+ };
688
+ if (finalParams.responsive && finalParams.responsive.length > 0) {
689
+ finalParams.responsive.sort((a, b) => b.windowSize - a.windowSize);
690
+ }
691
+ if (finalParams.responsive && finalParams.responsive.length > 0) {
692
+ const windowSize = window.innerWidth;
693
+ const availableResponsives = finalParams.responsive.filter((resp) => resp.windowSize >= windowSize);
694
+ availableResponsives.forEach((resp) => {
695
+ finalParams = {
696
+ ...finalParams,
697
+ ...resp.params,
698
+ };
699
+ });
700
+ }
701
+ return finalParams;
702
+ };
703
+ exports["default"] = getCurrentParams;
704
+
705
+
706
+ /***/ },
707
+
708
+ /***/ 43
709
+ (__unused_webpack_module, exports, __webpack_require__) {
710
+
711
+
712
+ var __importDefault = (this && this.__importDefault) || function (mod) {
713
+ return (mod && mod.__esModule) ? mod : { "default": mod };
714
+ };
715
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
716
+ const constParams_1 = __importDefault(__webpack_require__(742));
717
+ const calculate_1 = __importDefault(__webpack_require__(605));
718
+ const initDraggable_1 = __importDefault(__webpack_require__(304));
719
+ const init = (ref) => {
720
+ const transition = `left ${constParams_1.default.animationSpeed}ms, top ${constParams_1.default.animationSpeed}ms, transform ${constParams_1.default.animationSpeed}ms`;
721
+ ref.grid.classList.add('gs-sortable-instance');
722
+ ref.grid.classList.add(`gs-sortable-${ref.currentParams.type}`);
723
+ // Disconnect any observers from a previous init/refresh cycle
724
+ ref.itemResizeObservers?.forEach((obs) => obs.disconnect());
725
+ ref.itemResizeObservers = [];
726
+ Array.from(ref.grid.children).forEach((el) => {
727
+ const element = el;
728
+ element.classList.add('gs-sortable-item');
729
+ element.style.transition = transition;
730
+ element.style.position = 'absolute';
731
+ const obs = new ResizeObserver(() => (0, calculate_1.default)(ref));
732
+ obs.observe(element);
733
+ ref.itemResizeObservers.push(obs);
734
+ });
735
+ ref.count = ref.grid.children.length;
736
+ (0, initDraggable_1.default)(ref);
737
+ };
738
+ exports["default"] = init;
739
+
740
+
741
+ /***/ },
742
+
743
+ /***/ 304
744
+ (__unused_webpack_module, exports, __webpack_require__) {
745
+
746
+
747
+ var __importDefault = (this && this.__importDefault) || function (mod) {
748
+ return (mod && mod.__esModule) ? mod : { "default": mod };
749
+ };
750
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
751
+ const constParams_1 = __importDefault(__webpack_require__(742));
752
+ const general_1 = __webpack_require__(577);
753
+ const initDraggable = (ref) => {
754
+ const params = ref.currentParams;
755
+ const $items = Array.from(ref.grid.children);
756
+ $items.forEach(($el, index) => {
757
+ $el.onmousedown = null;
758
+ const handler = params.handler
759
+ ? $el.querySelector(params.handler)
760
+ : $el;
761
+ if (handler instanceof HTMLElement) {
762
+ handler.style.cursor = 'move';
763
+ handler.onmousedown = (e) => {
764
+ if (!ref.isAdjusting) {
765
+ window.GSSortableConfigue.overInItemRef = ref;
766
+ window.GSSortableConfigue.takeFrom = ref;
767
+ const container = ref.grid;
768
+ const elStyles = getComputedStyle($el);
769
+ const containerStyles = getComputedStyle(container);
770
+ const paddingTop = parseFloat(containerStyles.paddingTop);
771
+ const paddingLeft = parseFloat(containerStyles.paddingLeft);
772
+ const top = parseFloat(elStyles.top);
773
+ const left = parseFloat(elStyles.left);
774
+ let $draggableEl = $el;
775
+ let placeholder;
776
+ if (!params.takeClone) {
777
+ placeholder = document.createElement('div');
778
+ placeholder.classList.add('gs-sortable-placeholder');
779
+ placeholder.style.position = elStyles.position;
780
+ placeholder.style.transition = `left ${constParams_1.default.animationSpeed}ms, top ${constParams_1.default.animationSpeed}ms, transform ${constParams_1.default.animationSpeed}ms, opacity ${constParams_1.default.animationSpeed}ms`;
781
+ placeholder.style.width = `${$el.offsetWidth}px`;
782
+ placeholder.style.height = `${$el.offsetHeight}px`;
783
+ placeholder.style.top = `${top}px`;
784
+ placeholder.style.left = `${left}px`;
785
+ placeholder.style.border = elStyles.border;
786
+ placeholder.style.borderRadius = elStyles.borderRadius;
787
+ ref.grid.append(placeholder);
788
+ }
789
+ else {
790
+ const $cloneEl = $el.cloneNode(true);
791
+ ref.grid.append($cloneEl);
792
+ $draggableEl = $cloneEl;
793
+ }
794
+ const elOffsetWindow = (0, general_1.getOffsetFromWindow)($el);
795
+ let translateX = !isNaN(left) ? left : 0;
796
+ let translateY = !isNaN(top) ? top : 0;
797
+ $draggableEl.style.transform = `translate(${translateX - paddingLeft}px, ${translateY - paddingTop}px)`;
798
+ $draggableEl.style.top = `${paddingTop}px`;
799
+ $draggableEl.style.left = `${paddingLeft}px`;
800
+ window.GSSortableConfigue.draggableInfo = {
801
+ moved: false,
802
+ ref,
803
+ index,
804
+ $el: $draggableEl,
805
+ clientX: e.clientX,
806
+ clientY: e.clientY,
807
+ placeholder,
808
+ newLeft: left,
809
+ newTop: top,
810
+ fromLeft: (e.clientX - elOffsetWindow.left) / $el.offsetWidth,
811
+ fromTop: (e.clientY - elOffsetWindow.top) / $el.offsetHeight,
812
+ };
813
+ $draggableEl.classList.add('gs-sortable-item-inmove');
814
+ ref.grid.classList.add('gs-sortable-active');
815
+ const closestItem = ref.grid.closest('.gs-sortable-item');
816
+ if (closestItem) {
817
+ closestItem.classList.add('gs-sortable-item-active-parent');
818
+ }
819
+ }
820
+ };
821
+ }
822
+ });
823
+ };
824
+ exports["default"] = initDraggable;
825
+
826
+
827
+ /***/ },
828
+
829
+ /***/ 705
830
+ (__unused_webpack_module, exports, __webpack_require__) {
831
+
832
+
833
+ var __importDefault = (this && this.__importDefault) || function (mod) {
834
+ return (mod && mod.__esModule) ? mod : { "default": mod };
835
+ };
836
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
837
+ const general_1 = __webpack_require__(577);
838
+ const checkItemInContainer_1 = __importDefault(__webpack_require__(490));
839
+ const calculate_1 = __importDefault(__webpack_require__(605));
840
+ const constParams_1 = __importDefault(__webpack_require__(742));
841
+ const calculateOnSort_1 = __importDefault(__webpack_require__(960));
842
+ const initMouseMove = (event) => {
843
+ const info = window.GSSortableConfigue?.draggableInfo;
844
+ if (info !== undefined) {
845
+ info.moved = true;
846
+ const allRefs = [];
847
+ if (window.GSSortableConfigue.takeFrom !== undefined) {
848
+ allRefs.push(window.GSSortableConfigue.takeFrom);
849
+ }
850
+ window.GSSortableConfigue.references.forEach((item) => {
851
+ if (item.ref.currentParams.acceptFrom.includes(window.GSSortableConfigue.takeFrom.currentParams.reference)) {
852
+ allRefs.push(item.ref);
853
+ }
854
+ });
855
+ let findedRef = '';
856
+ allRefs.forEach((item) => {
857
+ if ((0, checkItemInContainer_1.default)(item.grid, info.$el)) {
858
+ findedRef = item.currentParams.reference;
859
+ }
860
+ });
861
+ if (findedRef !== '') {
862
+ const newRef = window.GSSortableConfigue.instance(findedRef);
863
+ if (newRef !== undefined &&
864
+ info.ref.currentParams.reference !== newRef.currentParams.reference) {
865
+ const placeholder = document.querySelector('.gs-sortable-placeholder');
866
+ if (placeholder != null) {
867
+ placeholder.remove();
868
+ (0, calculate_1.default)(window.GSSortableConfigue.overInItemRef);
869
+ }
870
+ window.GSSortableConfigue.overInItemRef = newRef;
871
+ info.$el.style.width = window.GSSortableConfigue.overInItemRef.itemWidth;
872
+ const newWidth = info.$el.clientWidth;
873
+ const newHeight = info.$el.clientHeight;
874
+ const newContainerOffset = (0, general_1.getOffsetFromWindow)(window.GSSortableConfigue.takeFrom.grid);
875
+ const translateY = event.clientY - newContainerOffset.top - newHeight * info.fromTop;
876
+ const translateX = event.clientX - newContainerOffset.left - newWidth * info.fromLeft;
877
+ const elStyles = getComputedStyle(info.$el);
878
+ const top = parseFloat(elStyles.top);
879
+ const left = parseFloat(elStyles.left);
880
+ if (!window.GSSortableConfigue.overInItemRef.currentParams.takeClone) {
881
+ const newPlaceholder = document.createElement('div');
882
+ newPlaceholder.classList.add('gs-sortable-placeholder');
883
+ newPlaceholder.style.position = elStyles.position;
884
+ info.$el.style.transform = `translate(${translateX}px, ${translateY}px)`;
885
+ newPlaceholder.style.transition = `left ${constParams_1.default.animationSpeed}ms, top ${constParams_1.default.animationSpeed}ms, transform ${constParams_1.default.animationSpeed}ms, opacity ${constParams_1.default.animationSpeed}ms`;
886
+ newPlaceholder.style.top = `${top}px`;
887
+ newPlaceholder.style.left = `${left}px`;
888
+ newPlaceholder.style.border = elStyles.border;
889
+ newPlaceholder.style.borderRadius = elStyles.borderRadius;
890
+ info.placeholder = newPlaceholder;
891
+ info.ref = newRef;
892
+ newPlaceholder.style.width = `${info.$el.offsetWidth}px`;
893
+ newPlaceholder.style.height = `${info.$el.offsetHeight}px`;
894
+ newRef.grid.append(newPlaceholder);
895
+ (0, calculate_1.default)(newRef);
896
+ return;
897
+ }
898
+ else {
899
+ info.ref = newRef;
900
+ }
901
+ }
902
+ }
903
+ const params = info.ref.currentParams;
904
+ const $el = info.$el;
905
+ const containerStyles = getComputedStyle(info.ref.grid);
906
+ const paddingLeft = parseFloat(containerStyles.paddingLeft);
907
+ const paddingTop = parseFloat(containerStyles.paddingTop);
908
+ const paddingRight = parseFloat(containerStyles.paddingRight);
909
+ const paddingBottom = parseFloat(containerStyles.paddingBottom);
910
+ const containerInnerHeight = info.ref.grid.clientHeight - paddingTop - paddingBottom;
911
+ const containerInnerWidth = info.ref.grid.clientWidth - paddingLeft - paddingRight;
912
+ const moveX = event.clientX - info.clientX;
913
+ const moveY = event.clientY - info.clientY;
914
+ const coord = (0, general_1.getTranslateCoord)($el);
915
+ info.clientX = event.clientX;
916
+ info.clientY = event.clientY;
917
+ let translateX = moveX + coord.x;
918
+ let translateY = moveY + coord.y;
919
+ if (!params.allowOutOfBox) {
920
+ translateX = Math.min(Math.max(translateX, 0), containerInnerWidth - $el.offsetWidth);
921
+ translateY = Math.min(Math.max(translateY, 0), containerInnerHeight - $el.offsetHeight);
922
+ }
923
+ $el.style.transform = `translate(${translateX}px, ${translateY}px)`;
924
+ if (findedRef !== '') {
925
+ (0, calculateOnSort_1.default)(window.GSSortableConfigue.overInItemRef);
926
+ }
927
+ }
928
+ window.scrollY = document.documentElement.scrollTop;
929
+ window.scrollX = document.documentElement.scrollLeft;
930
+ };
931
+ exports["default"] = initMouseMove;
932
+
933
+
934
+ /***/ },
935
+
936
+ /***/ 618
937
+ (__unused_webpack_module, exports, __webpack_require__) {
938
+
939
+
940
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
941
+ const general_1 = __webpack_require__(577);
942
+ const initScroll = () => {
943
+ const info = window.GSSortableConfigue?.draggableInfo;
944
+ if (info !== undefined) {
945
+ const coord = (0, general_1.getTranslateCoord)(info.$el);
946
+ const scrollY = document.documentElement.scrollTop;
947
+ const scrollX = document.documentElement.scrollLeft;
948
+ const translateX = coord.x + (scrollX - (window.scrollX || 0));
949
+ const translateY = coord.y + (scrollY - (window.scrollY || 0));
950
+ window.scrollY = scrollY;
951
+ window.scrollX = scrollX;
952
+ info.$el.style.transform = `translate(${translateX}px, ${translateY}px)`;
953
+ }
954
+ };
955
+ exports["default"] = initScroll;
956
+
957
+
958
+ /***/ },
959
+
960
+ /***/ 518
961
+ (__unused_webpack_module, exports, __webpack_require__) {
962
+
963
+
964
+ var __importDefault = (this && this.__importDefault) || function (mod) {
965
+ return (mod && mod.__esModule) ? mod : { "default": mod };
966
+ };
967
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
968
+ const constParams_1 = __importDefault(__webpack_require__(742));
969
+ const calculate_1 = __importDefault(__webpack_require__(605));
970
+ const general_1 = __webpack_require__(577);
971
+ const initSortEnd = (_event) => {
972
+ if (window.GSSortableConfigue?.draggableInfo === undefined)
973
+ return;
974
+ // Capture all needed values before clearing the global — prevents a second
975
+ // mousedown during the animation from reading stale isAdjusting state.
976
+ const draggableInfo = window.GSSortableConfigue.draggableInfo;
977
+ const { $el, ref, placeholder, moved, newTop, newLeft, index } = draggableInfo;
978
+ const takeFrom = window.GSSortableConfigue.takeFrom;
979
+ // Clear global immediately so new drags are not blocked
980
+ window.GSSortableConfigue.draggableInfo = undefined;
981
+ if (moved) {
982
+ let containerDifX = 0;
983
+ let containerDifY = 0;
984
+ if (ref.currentParams.reference !== takeFrom.currentParams.reference) {
985
+ const fromCoord = (0, general_1.getOffsetFromBody)(takeFrom.grid);
986
+ const toCoord = (0, general_1.getOffsetFromBody)(ref.grid);
987
+ containerDifY = toCoord.top - fromCoord.top;
988
+ containerDifX = toCoord.left - fromCoord.left;
989
+ }
990
+ ref.isAdjusting = true;
991
+ $el.classList.remove('gs-sortable-item-inmove');
992
+ ref.grid.classList.remove('gs-sortable-active');
993
+ const activeParent = ref.grid.closest('.gs-sortable-item-active-parent');
994
+ if (activeParent) {
995
+ activeParent.classList.remove('gs-sortable-item-active-parent');
996
+ }
997
+ $el.classList.add('gs-sortable-item-adjusting');
998
+ $el.style.top = `${newTop + containerDifY}px`;
999
+ $el.style.left = `${newLeft + containerDifX}px`;
1000
+ $el.style.removeProperty('transform');
1001
+ setTimeout(() => {
1002
+ $el.classList.remove('gs-sortable-item-adjusting');
1003
+ if (ref.currentParams.reference === takeFrom.currentParams.reference &&
1004
+ takeFrom.currentParams.takeClone) {
1005
+ $el.remove();
1006
+ }
1007
+ else {
1008
+ if (index !== undefined) {
1009
+ (0, general_1.moveChildToIndex)(ref.grid, $el, index);
1010
+ }
1011
+ }
1012
+ placeholder?.remove();
1013
+ if (ref.currentParams.reference !== takeFrom.currentParams.reference) {
1014
+ takeFrom.currentParams.afterSort?.(takeFrom.grid.querySelectorAll('.gs-sortable-item'));
1015
+ ref.currentParams.afterSort?.(ref.grid.querySelectorAll('.gs-sortable-item'));
1016
+ takeFrom.refresh();
1017
+ ref.refresh();
1018
+ }
1019
+ else {
1020
+ (0, calculate_1.default)(ref);
1021
+ ref.currentParams.afterSort?.(ref.grid.querySelectorAll('.gs-sortable-item'));
1022
+ }
1023
+ ref.isAdjusting = false;
1024
+ }, constParams_1.default.animationSpeed);
1025
+ }
1026
+ else {
1027
+ $el.style.top = `${newTop}px`;
1028
+ $el.style.left = `${newLeft}px`;
1029
+ $el.style.removeProperty('transform');
1030
+ placeholder?.remove();
1031
+ }
1032
+ };
1033
+ exports["default"] = initSortEnd;
1034
+
1035
+
1036
+ /***/ },
1037
+
1038
+ /***/ 742
1039
+ (__unused_webpack_module, exports) {
1040
+
1041
+
1042
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1043
+ const constParams = {
1044
+ animationSpeed: 400,
1045
+ };
1046
+ exports["default"] = Object.freeze(constParams);
1047
+
1048
+
1049
+ /***/ },
1050
+
1051
+ /***/ 636
1052
+ (__unused_webpack_module, exports, __webpack_require__) {
1053
+
1054
+
1055
+ var __importDefault = (this && this.__importDefault) || function (mod) {
1056
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1057
+ };
1058
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1059
+ const types_1 = __importDefault(__webpack_require__(178));
1060
+ const defaultParams = {
1061
+ acceptFrom: [],
1062
+ className: '',
1063
+ takeClone: false,
1064
+ reference: '',
1065
+ count: 3,
1066
+ gap: '',
1067
+ gsx: undefined,
1068
+ handler: '',
1069
+ width: 'auto',
1070
+ type: types_1.default.column,
1071
+ allowOutOfBox: true,
1072
+ responsive: [],
1073
+ afterSort: () => { },
1074
+ };
1075
+ exports["default"] = Object.freeze(defaultParams);
1076
+
1077
+
1078
+ /***/ },
1079
+
1080
+ /***/ 178
1081
+ (__unused_webpack_module, exports) {
1082
+
1083
+
1084
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1085
+ const types = {
1086
+ row: 'row',
1087
+ column: 'column',
1088
+ grid: 'grid',
1089
+ };
1090
+ exports["default"] = Object.freeze(types);
1091
+
1092
+
1093
+ /***/ },
1094
+
1095
+ /***/ 432
1096
+ (__unused_webpack_module, exports) {
1097
+
1098
+
1099
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1100
+ exports.convertScssToCss = exports.injectCssToHead = exports.removeCssFromHead = exports.NewGuid = void 0;
1101
+ const NewGuid = () => {
1102
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
1103
+ const r = (Math.random() * 16) | 0;
1104
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
1105
+ return v.toString(16);
1106
+ });
1107
+ };
1108
+ exports.NewGuid = NewGuid;
1109
+ const removeCssFromHead = (key) => {
1110
+ const style = document.querySelector(`head style[data-key='${key}']`);
1111
+ if (style != null) {
1112
+ style.remove();
1113
+ }
1114
+ };
1115
+ exports.removeCssFromHead = removeCssFromHead;
1116
+ const injectCssToHead = (css, key) => {
1117
+ const style = document.createElement('style');
1118
+ style.dataset.key = key;
1119
+ style.innerHTML = css;
1120
+ document.head.appendChild(style);
1121
+ };
1122
+ exports.injectCssToHead = injectCssToHead;
1123
+ const camelToKebab = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
1124
+ const convertScssToCss = (scssObj) => {
1125
+ const convertObjectToCss = (obj, parent = '') => {
1126
+ let css = '';
1127
+ for (const key in obj) {
1128
+ const value = obj[key];
1129
+ if (typeof value === 'object') {
1130
+ const newParent = parent ? `${parent} ${key}` : key;
1131
+ css += convertObjectToCss(value, newParent);
1132
+ }
1133
+ else {
1134
+ css += `${parent} { ${camelToKebab(key)}: ${value}; }\n`;
1135
+ }
1136
+ }
1137
+ return css;
1138
+ };
1139
+ return convertObjectToCss(scssObj, '');
1140
+ };
1141
+ exports.convertScssToCss = convertScssToCss;
1142
+
1143
+
1144
+ /***/ }
1145
+
1146
+ /******/ });
1147
+ /************************************************************************/
1148
+ /******/ // The module cache
1149
+ /******/ var __webpack_module_cache__ = {};
1150
+ /******/
1151
+ /******/ // The require function
1152
+ /******/ function __webpack_require__(moduleId) {
1153
+ /******/ // Check if module is in cache
1154
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1155
+ /******/ if (cachedModule !== undefined) {
1156
+ /******/ return cachedModule.exports;
1157
+ /******/ }
1158
+ /******/ // Create a new module (and put it into the cache)
1159
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1160
+ /******/ // no module.id needed
1161
+ /******/ // no module.loaded needed
1162
+ /******/ exports: {}
1163
+ /******/ };
1164
+ /******/
1165
+ /******/ // Execute the module function
1166
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1167
+ /******/
1168
+ /******/ // Return the exports of the module
1169
+ /******/ return module.exports;
1170
+ /******/ }
1171
+ /******/
1172
+ /************************************************************************/
1173
+ /******/
1174
+ /******/ // startup
1175
+ /******/ // Load entry module and return exports
1176
+ /******/ // This entry module is referenced by other modules so it can't be inlined
1177
+ /******/ var __webpack_exports__ = __webpack_require__(571);
1178
+ /******/ window.GSSortable = __webpack_exports__["default"];
1179
+ /******/
1180
+ /******/ })()
1181
+ ;