@get-set/gs-sortable 0.0.22 → 0.0.24
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/calculate.d.ts +3 -0
- package/dist/actions/calculate.js +132 -133
- package/dist/actions/calculate.js.map +1 -0
- package/dist/actions/calculateOnSort.d.ts +3 -0
- package/dist/actions/calculateOnSort.js +141 -239
- package/dist/actions/calculateOnSort.js.map +1 -0
- package/dist/actions/checkItemInContainer.d.ts +2 -0
- package/dist/actions/checkItemInContainer.js +24 -24
- package/dist/actions/checkItemInContainer.js.map +1 -0
- package/dist/actions/destroy.d.ts +9 -0
- package/dist/actions/destroy.js +25 -31
- package/dist/actions/destroy.js.map +1 -0
- package/dist/actions/general.d.ts +13 -0
- package/dist/actions/general.js +56 -83
- package/dist/actions/general.js.map +1 -0
- package/dist/actions/getCurrentParams.d.ts +9 -0
- package/dist/actions/getCurrentParams.js +25 -33
- package/dist/actions/getCurrentParams.js.map +1 -0
- package/dist/actions/init.d.ts +3 -0
- package/dist/actions/init.js +24 -30
- package/dist/actions/init.js.map +1 -0
- package/dist/actions/initDraggable.d.ts +3 -0
- package/dist/actions/initDraggable.js +80 -85
- package/dist/actions/initDraggable.js.map +1 -0
- package/dist/actions/initMouseMove.d.ts +2 -0
- package/dist/actions/initMouseMove.js +104 -97
- package/dist/actions/initMouseMove.js.map +1 -0
- package/dist/actions/initScroll.d.ts +2 -0
- package/dist/actions/initScroll.js +22 -24
- package/dist/actions/initScroll.js.map +1 -0
- package/dist/actions/initSortEnd.d.ts +2 -0
- package/dist/actions/initSortEnd.js +71 -68
- package/dist/actions/initSortEnd.js.map +1 -0
- package/dist/components/GSSortable.d.ts +24 -0
- package/dist/components/GSSortable.js +127 -166
- package/dist/components/GSSortable.js.map +1 -0
- package/dist/constants/constParams.d.ts +4 -0
- package/dist/constants/constParams.js +5 -8
- package/dist/constants/constParams.js.map +1 -0
- package/dist/constants/defaultParams.d.ts +3 -0
- package/dist/constants/defaultParams.js +21 -22
- package/dist/constants/defaultParams.js.map +1 -0
- package/dist/constants/types.d.ts +6 -0
- package/dist/constants/types.js +7 -10
- package/dist/constants/types.js.map +1 -0
- package/dist/helpers/uihelpers.d.ts +4 -0
- package/dist/helpers/uihelpers.js +47 -51
- package/dist/helpers/uihelpers.js.map +1 -0
- package/package.json +3 -2
- package/dist/actions/afterAllImagesLoad.js +0 -53
|
@@ -1,247 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
}
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const types_1 = __importDefault(require("../constants/types"));
|
|
7
|
+
const general_1 = require("./general");
|
|
8
|
+
const calculateOnSort = (ref) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const params = ref.currentParams;
|
|
11
|
+
if (!params.takeClone) {
|
|
12
|
+
const $items = Array.from(ref.grid.children);
|
|
13
|
+
const itemsCount = $items.filter(x => !x.classList.contains('gs-sortable-item-inmove')).length;
|
|
14
|
+
const info = (_a = window.GSSortableConfigue) === null || _a === void 0 ? void 0 : _a.draggableInfo;
|
|
15
|
+
let containerPT = 0, containerPL = 0, currentHeight = 0, currentWidth = 0, itemWidth = 0, gapX = 0, gapY = 0;
|
|
16
|
+
if (ref.uiData) {
|
|
17
|
+
containerPT = ref.uiData.containerPT;
|
|
18
|
+
containerPL = ref.uiData.containerPL;
|
|
19
|
+
currentHeight = ref.uiData.currentHeight;
|
|
20
|
+
currentWidth = ref.uiData.currentWidth;
|
|
21
|
+
itemWidth = ref.uiData.itemWidth;
|
|
22
|
+
gapX = ref.uiData.gapX;
|
|
23
|
+
gapY = ref.uiData.gapY;
|
|
122
24
|
}
|
|
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
|
-
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;
|
|
25
|
+
let currentLeft = containerPL;
|
|
26
|
+
let currentTop = containerPT;
|
|
27
|
+
let maxHeight = 0;
|
|
28
|
+
let placeholderSeted = info === undefined;
|
|
29
|
+
let inProcessEl;
|
|
30
|
+
const containerCoord = (0, general_1.getOffsetFromWindow)(ref.grid);
|
|
31
|
+
if (info) {
|
|
32
|
+
const $el = info.$el;
|
|
33
|
+
const elCoord = (0, general_1.getOffsetFromWindow)($el);
|
|
34
|
+
inProcessEl = {
|
|
35
|
+
height: $el.offsetHeight,
|
|
36
|
+
width: $el.offsetWidth,
|
|
37
|
+
top: elCoord.top - containerCoord.top,
|
|
38
|
+
left: elCoord.left - containerCoord.left,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
let plIndex = (_b = info === null || info === void 0 ? void 0 : info.index) !== null && _b !== void 0 ? _b : 0;
|
|
42
|
+
let colHeight = 0;
|
|
43
|
+
let itIndex = 0;
|
|
44
|
+
$items.forEach(el => {
|
|
45
|
+
if (!el.classList.contains('gs-sortable-item-inmove')) {
|
|
46
|
+
const height = el.offsetHeight;
|
|
47
|
+
const width = el.offsetWidth;
|
|
48
|
+
if (params.type === types_1.default.column) {
|
|
49
|
+
if (!placeholderSeted && inProcessEl) {
|
|
50
|
+
const placeholderTop = currentTop === containerPT ? containerPT : currentTop + gapY;
|
|
51
|
+
const placeholderLeft = containerPL;
|
|
52
|
+
if (Math.abs(placeholderTop - inProcessEl.top) <
|
|
53
|
+
inProcessEl.height / 2 &&
|
|
54
|
+
Math.abs(placeholderLeft - inProcessEl.left) <
|
|
55
|
+
inProcessEl.width / 2) {
|
|
56
|
+
if (info) {
|
|
57
|
+
info.newTop = placeholderTop;
|
|
58
|
+
info.newLeft = placeholderLeft;
|
|
59
|
+
}
|
|
60
|
+
placeholderSeted = true;
|
|
61
|
+
plIndex = itIndex;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!el.classList.contains('gs-sortable-placeholder')) {
|
|
65
|
+
if (currentTop === containerPT) {
|
|
66
|
+
currentTop += height;
|
|
67
|
+
currentHeight += height;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
currentTop += gapY + height;
|
|
71
|
+
currentHeight += gapY + height;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
210
74
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
75
|
+
else if (params.type === types_1.default.row) {
|
|
76
|
+
if (!placeholderSeted && inProcessEl) {
|
|
77
|
+
const placeholderLeft = currentLeft === containerPL ? containerPL : currentLeft + gapX;
|
|
78
|
+
const placeholderTop = containerPT;
|
|
79
|
+
if (Math.abs(placeholderTop - inProcessEl.top) <
|
|
80
|
+
inProcessEl.height / 2 &&
|
|
81
|
+
Math.abs(placeholderLeft - inProcessEl.left) <
|
|
82
|
+
inProcessEl.width / 2) {
|
|
83
|
+
if (info) {
|
|
84
|
+
info.newTop = placeholderTop;
|
|
85
|
+
info.newLeft = placeholderLeft;
|
|
86
|
+
}
|
|
87
|
+
placeholderSeted = true;
|
|
88
|
+
plIndex = itIndex;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!el.classList.contains('gs-sortable-placeholder')) {
|
|
92
|
+
if (currentLeft === containerPL) {
|
|
93
|
+
currentLeft += width;
|
|
94
|
+
currentWidth += width;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
currentLeft += gapX + width;
|
|
98
|
+
currentWidth += gapX + width;
|
|
99
|
+
}
|
|
100
|
+
if (height > maxHeight) {
|
|
101
|
+
maxHeight = height;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if (params.type === types_1.default.grid) {
|
|
106
|
+
const placeholderLeft = itIndex % params.count === 0
|
|
107
|
+
? containerPL
|
|
108
|
+
: containerPL + (itIndex % params.count) * (itemWidth + gapX);
|
|
109
|
+
const placeholderTop = currentTop;
|
|
110
|
+
if (inProcessEl &&
|
|
111
|
+
Math.abs(placeholderTop - inProcessEl.top) <
|
|
112
|
+
inProcessEl.height / 2 &&
|
|
113
|
+
Math.abs(placeholderLeft - inProcessEl.left) < inProcessEl.width / 2) {
|
|
114
|
+
if (info) {
|
|
115
|
+
info.newTop = placeholderTop;
|
|
116
|
+
info.newLeft = placeholderLeft;
|
|
117
|
+
}
|
|
118
|
+
placeholderSeted = true;
|
|
119
|
+
plIndex = itIndex;
|
|
120
|
+
}
|
|
121
|
+
if (!el.classList.contains('gs-sortable-placeholder')) {
|
|
122
|
+
const top = currentTop;
|
|
123
|
+
if (height > colHeight) {
|
|
124
|
+
colHeight = height;
|
|
125
|
+
}
|
|
126
|
+
if (itIndex % params.count === params.count - 1 ||
|
|
127
|
+
itIndex === itemsCount - 1) {
|
|
128
|
+
if (top === containerPT) {
|
|
129
|
+
currentHeight += colHeight;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
currentHeight += colHeight + gapY;
|
|
133
|
+
}
|
|
134
|
+
currentTop += colHeight + gapY;
|
|
135
|
+
colHeight = 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
232
138
|
}
|
|
233
|
-
|
|
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");
|
|
139
|
+
itIndex += 1;
|
|
239
140
|
}
|
|
240
|
-
|
|
241
|
-
|
|
141
|
+
});
|
|
142
|
+
// Update placeholder and element positions
|
|
143
|
+
if (info) {
|
|
144
|
+
info.index = plIndex;
|
|
242
145
|
}
|
|
243
|
-
});
|
|
244
146
|
}
|
|
245
|
-
}
|
|
246
147
|
};
|
|
247
|
-
|
|
148
|
+
exports.default = calculateOnSort;
|
|
149
|
+
//# sourceMappingURL=calculateOnSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateOnSort.js","sourceRoot":"","sources":["../../src/actions/calculateOnSort.tsx"],"names":[],"mappings":";;;;;AACA,+DAAuC;AACvC,uCAAgD;AAEhD,MAAM,eAAe,GAAG,CAAC,GAAkB,EAAQ,EAAE;;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC;IAEjC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QACrB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAK,CAAC,QAAQ,CAAkB,CAAC;QAC/D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAC9B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CACtD,CAAC,MAAM,CAAC;QAET,MAAM,IAAI,GAAG,MAAA,MAAM,CAAC,kBAAkB,0CAAE,aAE3B,CAAC;QAEd,IAAI,WAAW,GAAG,CAAC,EACjB,WAAW,GAAG,CAAC,EACf,aAAa,GAAG,CAAC,EACjB,YAAY,GAAG,CAAC,EAChB,SAAS,GAAG,CAAC,EACb,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,CAAC,CAAC;QAEX,IAAI,GAAG,CAAC,MAAM,EAAE;YACd,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YACrC,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YACrC,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC;YACzC,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,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
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return false;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const general_1 = require("./general");
|
|
4
|
+
const checkItemInContainer = (grid, el) => {
|
|
5
|
+
const gridOffset = (0, general_1.getOffsetFromWindow)(grid);
|
|
6
|
+
const elOffset = (0, general_1.getOffsetFromWindow)(el);
|
|
7
|
+
const gridTop = gridOffset.top;
|
|
8
|
+
const gridLeft = gridOffset.left;
|
|
9
|
+
const elTop = elOffset.top;
|
|
10
|
+
const elLeft = elOffset.left;
|
|
11
|
+
const offsetTopFromGrid = elTop - gridTop;
|
|
12
|
+
const offsetLeftFromGrid = elLeft - gridLeft;
|
|
13
|
+
const elHeight = el.offsetHeight;
|
|
14
|
+
const elWidth = el.offsetWidth;
|
|
15
|
+
const gridHeight = grid.offsetHeight;
|
|
16
|
+
const gridWidth = grid.offsetWidth;
|
|
17
|
+
if (offsetTopFromGrid >= (-1 * elHeight) / 2 &&
|
|
18
|
+
offsetLeftFromGrid >= (-1 * elWidth) / 2 &&
|
|
19
|
+
offsetTopFromGrid <= gridHeight - elHeight / 2 &&
|
|
20
|
+
offsetLeftFromGrid <= gridWidth - elWidth / 2) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
25
24
|
};
|
|
26
|
-
|
|
25
|
+
exports.default = checkItemInContainer;
|
|
26
|
+
//# sourceMappingURL=checkItemInContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkItemInContainer.js","sourceRoot":"","sources":["../../src/actions/checkItemInContainer.tsx"],"names":[],"mappings":";;AAAA,uCAAgD;AAEhD,MAAM,oBAAoB,GAAG,CAAC,IAAiB,EAAE,EAAe,EAAW,EAAE;IAC3E,MAAM,UAAU,GAAG,IAAA,6BAAmB,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAA,6BAAmB,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC;IAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC;IAE7B,MAAM,iBAAiB,GAAG,KAAK,GAAG,OAAO,CAAC;IAC1C,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC7C,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC;IACjC,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC;IAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;IAEnC,IACE,iBAAiB,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxC,kBAAkB,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;QACxC,iBAAiB,IAAI,UAAU,GAAG,QAAQ,GAAG,CAAC;QAC9C,kBAAkB,IAAI,SAAS,GAAG,OAAO,GAAG,CAAC,EAC7C;QACA,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
package/dist/actions/destroy.js
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
4
|
};
|
|
33
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const types_1 = __importDefault(require("../constants/types"));
|
|
7
|
+
const destroy = (ref) => {
|
|
8
|
+
ref.grid.classList.remove('gs-sortable-instance');
|
|
9
|
+
ref.grid.classList.remove(`gs-sortable-${ref.currentParams.type}`);
|
|
10
|
+
ref.grid.style.removeProperty('position');
|
|
11
|
+
ref.grid.style.removeProperty('gap');
|
|
12
|
+
ref.grid.style.removeProperty('height');
|
|
13
|
+
if (ref.currentParams.type === types_1.default.row) {
|
|
14
|
+
ref.grid.style.removeProperty('width');
|
|
15
|
+
}
|
|
16
|
+
Array.from(ref.grid.children).forEach(el => {
|
|
17
|
+
const element = el;
|
|
18
|
+
element.classList.remove('gs-sortable-item');
|
|
19
|
+
element.style.removeProperty('position');
|
|
20
|
+
element.style.removeProperty('width');
|
|
21
|
+
element.style.removeProperty('left');
|
|
22
|
+
element.style.removeProperty('top');
|
|
23
|
+
element.style.removeProperty('transition');
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.default = destroy;
|
|
27
|
+
//# sourceMappingURL=destroy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../src/actions/destroy.tsx"],"names":[],"mappings":";;;;;AACA,+DAAuC;AAOvC,MAAM,OAAO,GAAG,CAAC,GAAkB,EAAQ,EAAE;IAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAClD,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAExC,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,KAAK,eAAK,CAAC,GAAG,EAAE;QACxC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;KACxC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACzC,MAAM,OAAO,GAAG,EAAiB,CAAC;QAClC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const getTranslateCoord: (element: HTMLElement) => {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const getOffsetFromBody: (el: HTMLElement | null) => {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const getOffsetFromWindow: (el: HTMLElement | null) => {
|
|
10
|
+
top: number;
|
|
11
|
+
left: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const moveChildToIndex: (parent: HTMLElement, child: HTMLElement, newIndex: number) => void;
|