react-grid-layout 2.0.0 → 2.1.1
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/README.md +117 -28
- package/css/styles.css +0 -1
- package/dist/{ResponsiveGridLayout-D6lFRE3f.d.mts → ResponsiveGridLayout-BkHF9YHa.d.mts} +10 -1
- package/dist/{ResponsiveGridLayout-CH4s0tKj.d.ts → ResponsiveGridLayout-CLn16-X3.d.ts} +10 -1
- package/dist/{calculate-CwYDW8na.d.mts → calculate-DsVTldEE.d.ts} +30 -2
- package/dist/{calculate-mgLpNJ5O.d.ts → calculate-DwbL1D06.d.mts} +30 -2
- package/dist/chunk-526JND3R.mjs +3 -0
- package/dist/{chunk-ZWN22PS2.mjs.map → chunk-526JND3R.mjs.map} +1 -1
- package/dist/chunk-7ELO5FRW.js +4 -0
- package/dist/{chunk-PBQSHIID.js.map → chunk-7ELO5FRW.js.map} +1 -1
- package/dist/chunk-AWM66AWF.mjs +422 -0
- package/dist/chunk-AWM66AWF.mjs.map +1 -0
- package/dist/chunk-BJFPTW5Q.js +449 -0
- package/dist/chunk-BJFPTW5Q.js.map +1 -0
- package/dist/{chunk-4HNUMWQK.mjs → chunk-FLITZMQC.mjs} +198 -311
- package/dist/chunk-FLITZMQC.mjs.map +1 -0
- package/dist/{chunk-ZCXE6SR5.mjs → chunk-LIKX67MZ.mjs} +7 -5
- package/dist/chunk-LIKX67MZ.mjs.map +1 -0
- package/dist/{chunk-R35HZZTA.mjs → chunk-PLWMASMX.mjs} +208 -90
- package/dist/chunk-PLWMASMX.mjs.map +1 -0
- package/dist/{chunk-BFTKGAP3.js → chunk-RB2IKK5B.js} +260 -142
- package/dist/chunk-RB2IKK5B.js.map +1 -0
- package/dist/{chunk-3WO4SAYB.js → chunk-WWS3M5Y3.js} +238 -355
- package/dist/chunk-WWS3M5Y3.js.map +1 -0
- package/dist/{chunk-H5KMDLY3.js → chunk-YQQYHEEG.js} +43 -41
- package/dist/chunk-YQQYHEEG.js.map +1 -0
- package/dist/core.d.mts +159 -6
- package/dist/core.d.ts +159 -6
- package/dist/core.js +145 -85
- package/dist/core.mjs +3 -3
- package/dist/extras.d.mts +133 -3
- package/dist/extras.d.ts +133 -3
- package/dist/extras.js +373 -2
- package/dist/extras.js.map +1 -1
- package/dist/extras.mjs +367 -2
- package/dist/extras.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +64 -64
- package/dist/index.mjs +5 -5
- package/dist/legacy.d.mts +2 -2
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.js +26 -25
- package/dist/legacy.js.map +1 -1
- package/dist/legacy.mjs +16 -15
- package/dist/legacy.mjs.map +1 -1
- package/dist/{position-Dk2b4ZMS.d.ts → position-CXNzFxI0.d.mts} +18 -7
- package/dist/{position-BmN1z36J.d.mts → position-Dk0FRWA9.d.ts} +18 -7
- package/dist/react.d.mts +11 -5
- package/dist/react.d.ts +11 -5
- package/dist/react.js +38 -38
- package/dist/react.mjs +5 -5
- package/dist/{responsive-CJxefsYw.d.mts → responsive-BB5d98xz.d.mts} +1 -1
- package/dist/{responsive-C4L1ESlm.d.ts → responsive-BXI-GCXG.d.ts} +1 -1
- package/dist/{types-Cxf4nHNr.d.mts → types-CokovIMH.d.mts} +98 -4
- package/dist/{types-Cxf4nHNr.d.ts → types-CokovIMH.d.ts} +98 -4
- package/index-dev.js +16 -0
- package/package.json +5 -3
- package/dist/chunk-2KUHNJXF.mjs +0 -90
- package/dist/chunk-2KUHNJXF.mjs.map +0 -1
- package/dist/chunk-3WO4SAYB.js.map +0 -1
- package/dist/chunk-4HNUMWQK.mjs.map +0 -1
- package/dist/chunk-BFTKGAP3.js.map +0 -1
- package/dist/chunk-F6NQPYKT.js +0 -98
- package/dist/chunk-F6NQPYKT.js.map +0 -1
- package/dist/chunk-H5KMDLY3.js.map +0 -1
- package/dist/chunk-PBQSHIID.js +0 -4
- package/dist/chunk-R35HZZTA.mjs.map +0 -1
- package/dist/chunk-ZCXE6SR5.mjs.map +0 -1
- package/dist/chunk-ZWN22PS2.mjs +0 -3
package/dist/extras.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ function GridBackground({
|
|
|
18
18
|
style
|
|
19
19
|
}) {
|
|
20
20
|
const dims = react.useMemo(
|
|
21
|
-
() =>
|
|
21
|
+
() => chunkBJFPTW5Q_js.calcGridCellDimensions({
|
|
22
22
|
width,
|
|
23
23
|
cols,
|
|
24
24
|
rowHeight,
|
|
@@ -86,6 +86,377 @@ function GridBackground({
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// src/extras/fastVerticalCompactor.ts
|
|
90
|
+
function collides(l1, l2) {
|
|
91
|
+
if (l1.i === l2.i) return false;
|
|
92
|
+
return l1.x < l2.x + l2.w && l1.x + l1.w > l2.x && l1.y < l2.y + l2.h && l1.y + l1.h > l2.y;
|
|
93
|
+
}
|
|
94
|
+
function compactVerticalFast(layout, cols, allowOverlap) {
|
|
95
|
+
const numItems = layout.length;
|
|
96
|
+
layout.sort((a, b) => {
|
|
97
|
+
if (a.y < b.y) return -1;
|
|
98
|
+
if (a.y > b.y) return 1;
|
|
99
|
+
if (a.x < b.x) return -1;
|
|
100
|
+
if (a.x > b.x) return 1;
|
|
101
|
+
if (a.static && !b.static) return -1;
|
|
102
|
+
if (!a.static && b.static) return 1;
|
|
103
|
+
return 0;
|
|
104
|
+
});
|
|
105
|
+
const tide = new Array(cols).fill(0);
|
|
106
|
+
const staticItems = layout.filter((item) => item.static);
|
|
107
|
+
const numStatics = staticItems.length;
|
|
108
|
+
let staticOffset = 0;
|
|
109
|
+
for (let i = 0; i < numItems; i++) {
|
|
110
|
+
const item = layout[i];
|
|
111
|
+
let x2 = item.x + item.w;
|
|
112
|
+
if (x2 > cols) {
|
|
113
|
+
x2 = cols;
|
|
114
|
+
}
|
|
115
|
+
if (item.static) {
|
|
116
|
+
++staticOffset;
|
|
117
|
+
} else {
|
|
118
|
+
let minGap = Infinity;
|
|
119
|
+
for (let x = item.x; x < x2; ++x) {
|
|
120
|
+
const tideValue = tide[x] ?? 0;
|
|
121
|
+
const gap = item.y - tideValue;
|
|
122
|
+
if (gap < minGap) {
|
|
123
|
+
minGap = gap;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (!allowOverlap || minGap > 0) {
|
|
127
|
+
item.y -= minGap;
|
|
128
|
+
}
|
|
129
|
+
for (let j = staticOffset; !allowOverlap && j < numStatics; ++j) {
|
|
130
|
+
const staticItem = staticItems[j];
|
|
131
|
+
if (staticItem === void 0) continue;
|
|
132
|
+
if (staticItem.y >= item.y + item.h) {
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (collides(item, staticItem)) {
|
|
136
|
+
item.y = staticItem.y + staticItem.h;
|
|
137
|
+
if (j > staticOffset) {
|
|
138
|
+
j = staticOffset;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
item.moved = false;
|
|
143
|
+
}
|
|
144
|
+
const t = item.y + item.h;
|
|
145
|
+
for (let x = item.x; x < x2; ++x) {
|
|
146
|
+
const currentTide = tide[x] ?? 0;
|
|
147
|
+
if (currentTide < t) {
|
|
148
|
+
tide[x] = t;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
var fastVerticalCompactor = {
|
|
154
|
+
type: "vertical",
|
|
155
|
+
allowOverlap: false,
|
|
156
|
+
compact(layout, cols) {
|
|
157
|
+
const out = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
158
|
+
compactVerticalFast(out, cols, false);
|
|
159
|
+
return out;
|
|
160
|
+
},
|
|
161
|
+
onMove(layout, item, x, y, _cols) {
|
|
162
|
+
const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
163
|
+
const movedItem = newLayout.find((l) => l.i === item.i);
|
|
164
|
+
if (movedItem) {
|
|
165
|
+
movedItem.x = x;
|
|
166
|
+
movedItem.y = y;
|
|
167
|
+
movedItem.moved = true;
|
|
168
|
+
}
|
|
169
|
+
return newLayout;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var fastVerticalOverlapCompactor = {
|
|
173
|
+
...fastVerticalCompactor,
|
|
174
|
+
allowOverlap: true,
|
|
175
|
+
compact(layout, cols) {
|
|
176
|
+
const out = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
177
|
+
compactVerticalFast(out, cols, true);
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/extras/fastHorizontalCompactor.ts
|
|
183
|
+
function ensureTideRows(tide, neededRows) {
|
|
184
|
+
while (tide.length < neededRows) {
|
|
185
|
+
tide.push(0);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function getMaxTideForItem(tide, y, h) {
|
|
189
|
+
let maxTide = 0;
|
|
190
|
+
for (let row = y; row < y + h; row++) {
|
|
191
|
+
const tideValue = tide[row] ?? 0;
|
|
192
|
+
if (tideValue > maxTide) {
|
|
193
|
+
maxTide = tideValue;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return maxTide;
|
|
197
|
+
}
|
|
198
|
+
function canPlaceAt(item, x, y, staticItems, cols) {
|
|
199
|
+
if (x + item.w > cols) return false;
|
|
200
|
+
for (const staticItem of staticItems) {
|
|
201
|
+
if (x < staticItem.x + staticItem.w && x + item.w > staticItem.x && y < staticItem.y + staticItem.h && y + item.h > staticItem.y) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
function compactHorizontalFast(layout, cols, allowOverlap) {
|
|
208
|
+
const numItems = layout.length;
|
|
209
|
+
if (numItems === 0) return;
|
|
210
|
+
layout.sort((a, b) => {
|
|
211
|
+
if (a.x !== b.x) return a.x - b.x;
|
|
212
|
+
if (a.y !== b.y) return a.y - b.y;
|
|
213
|
+
if (a.static !== b.static) return a.static ? -1 : 1;
|
|
214
|
+
return 0;
|
|
215
|
+
});
|
|
216
|
+
let maxRow = 0;
|
|
217
|
+
for (let i = 0; i < numItems; i++) {
|
|
218
|
+
const item = layout[i];
|
|
219
|
+
if (item !== void 0) {
|
|
220
|
+
const bottom = item.y + item.h;
|
|
221
|
+
if (bottom > maxRow) maxRow = bottom;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const tide = new Array(maxRow).fill(0);
|
|
225
|
+
const staticItems = layout.filter((item) => item.static);
|
|
226
|
+
const maxRowLimit = Math.max(1e4, numItems * 100);
|
|
227
|
+
for (let i = 0; i < numItems; i++) {
|
|
228
|
+
const item = layout[i];
|
|
229
|
+
if (item.static) {
|
|
230
|
+
ensureTideRows(tide, item.y + item.h);
|
|
231
|
+
const t2 = item.x + item.w;
|
|
232
|
+
for (let y = item.y; y < item.y + item.h; y++) {
|
|
233
|
+
if ((tide[y] ?? 0) < t2) {
|
|
234
|
+
tide[y] = t2;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
let targetY = item.y;
|
|
240
|
+
let targetX = 0;
|
|
241
|
+
let placed = false;
|
|
242
|
+
while (!placed) {
|
|
243
|
+
ensureTideRows(tide, targetY + item.h);
|
|
244
|
+
const maxTide = getMaxTideForItem(tide, targetY, item.h);
|
|
245
|
+
targetX = maxTide;
|
|
246
|
+
if (targetX + item.w <= cols) {
|
|
247
|
+
if (allowOverlap || canPlaceAt(item, targetX, targetY, staticItems, cols)) {
|
|
248
|
+
placed = true;
|
|
249
|
+
} else {
|
|
250
|
+
let maxStaticRight = targetX;
|
|
251
|
+
let foundCollision = false;
|
|
252
|
+
for (const staticItem of staticItems) {
|
|
253
|
+
if (targetX < staticItem.x + staticItem.w && targetX + item.w > staticItem.x && targetY < staticItem.y + staticItem.h && targetY + item.h > staticItem.y) {
|
|
254
|
+
maxStaticRight = Math.max(
|
|
255
|
+
maxStaticRight,
|
|
256
|
+
staticItem.x + staticItem.w
|
|
257
|
+
);
|
|
258
|
+
foundCollision = true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (foundCollision) {
|
|
262
|
+
targetX = maxStaticRight;
|
|
263
|
+
}
|
|
264
|
+
if (foundCollision && targetX + item.w <= cols) {
|
|
265
|
+
if (canPlaceAt(item, targetX, targetY, staticItems, cols)) {
|
|
266
|
+
placed = true;
|
|
267
|
+
} else {
|
|
268
|
+
targetY++;
|
|
269
|
+
}
|
|
270
|
+
} else if (foundCollision) {
|
|
271
|
+
targetY++;
|
|
272
|
+
} else {
|
|
273
|
+
placed = true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
targetY++;
|
|
278
|
+
}
|
|
279
|
+
if (targetY > maxRowLimit) {
|
|
280
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
281
|
+
console.warn(
|
|
282
|
+
`Fast horizontal compactor: Item "${item.i}" exceeded max row limit (${targetY}). This may indicate a layout that cannot be compacted within grid bounds.`
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
targetX = 0;
|
|
286
|
+
placed = true;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
item.x = targetX;
|
|
290
|
+
item.y = targetY;
|
|
291
|
+
item.moved = false;
|
|
292
|
+
ensureTideRows(tide, targetY + item.h);
|
|
293
|
+
const t = targetX + item.w;
|
|
294
|
+
for (let y = targetY; y < targetY + item.h; y++) {
|
|
295
|
+
if ((tide[y] ?? 0) < t) {
|
|
296
|
+
tide[y] = t;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
var fastHorizontalCompactor = {
|
|
302
|
+
type: "horizontal",
|
|
303
|
+
allowOverlap: false,
|
|
304
|
+
compact(layout, cols) {
|
|
305
|
+
const out = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
306
|
+
compactHorizontalFast(out, cols, false);
|
|
307
|
+
return out;
|
|
308
|
+
},
|
|
309
|
+
onMove(layout, item, x, y, _cols) {
|
|
310
|
+
const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
311
|
+
const movedItem = newLayout.find((l) => l.i === item.i);
|
|
312
|
+
if (movedItem) {
|
|
313
|
+
movedItem.x = x;
|
|
314
|
+
movedItem.y = y;
|
|
315
|
+
movedItem.moved = true;
|
|
316
|
+
}
|
|
317
|
+
return newLayout;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
var fastHorizontalOverlapCompactor = {
|
|
321
|
+
...fastHorizontalCompactor,
|
|
322
|
+
allowOverlap: true,
|
|
323
|
+
compact(layout, cols) {
|
|
324
|
+
const out = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
325
|
+
compactHorizontalFast(out, cols, true);
|
|
326
|
+
return out;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// src/extras/wrapCompactor.ts
|
|
331
|
+
function sortByWrapOrder(layout) {
|
|
332
|
+
return [...layout].sort((a, b) => {
|
|
333
|
+
if (a.y !== b.y) return a.y - b.y;
|
|
334
|
+
return a.x - b.x;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function getWrapPosition(item, cols) {
|
|
338
|
+
return item.y * cols + item.x;
|
|
339
|
+
}
|
|
340
|
+
function fromWrapPosition(pos, cols) {
|
|
341
|
+
return {
|
|
342
|
+
x: pos % cols,
|
|
343
|
+
y: Math.floor(pos / cols)
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function compactWrap(layout, cols) {
|
|
347
|
+
if (layout.length === 0) return [];
|
|
348
|
+
const sorted = sortByWrapOrder(layout);
|
|
349
|
+
const out = new Array(layout.length);
|
|
350
|
+
const statics = sorted.filter((item) => item.static);
|
|
351
|
+
const staticPositions = /* @__PURE__ */ new Set();
|
|
352
|
+
for (const s of statics) {
|
|
353
|
+
for (let dy = 0; dy < s.h; dy++) {
|
|
354
|
+
for (let dx = 0; dx < s.w; dx++) {
|
|
355
|
+
staticPositions.add((s.y + dy) * cols + (s.x + dx));
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
let nextPos = 0;
|
|
360
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
361
|
+
const sortedItem = sorted[i];
|
|
362
|
+
if (sortedItem === void 0) continue;
|
|
363
|
+
const l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
|
|
364
|
+
if (l.static) {
|
|
365
|
+
const originalIndex2 = layout.indexOf(sortedItem);
|
|
366
|
+
out[originalIndex2] = l;
|
|
367
|
+
l.moved = false;
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
while (staticPositions.has(nextPos)) {
|
|
371
|
+
nextPos++;
|
|
372
|
+
}
|
|
373
|
+
const { x, y } = fromWrapPosition(nextPos, cols);
|
|
374
|
+
if (x + l.w > cols) {
|
|
375
|
+
nextPos = (y + 1) * cols;
|
|
376
|
+
while (staticPositions.has(nextPos)) {
|
|
377
|
+
nextPos++;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const newCoords = fromWrapPosition(nextPos, cols);
|
|
381
|
+
l.x = newCoords.x;
|
|
382
|
+
l.y = newCoords.y;
|
|
383
|
+
nextPos += l.w;
|
|
384
|
+
const originalIndex = layout.indexOf(sortedItem);
|
|
385
|
+
out[originalIndex] = l;
|
|
386
|
+
l.moved = false;
|
|
387
|
+
}
|
|
388
|
+
return out;
|
|
389
|
+
}
|
|
390
|
+
function moveInWrapMode(layout, item, x, y, cols) {
|
|
391
|
+
const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
392
|
+
const movedItem = newLayout.find((l) => l.i === item.i);
|
|
393
|
+
if (!movedItem) {
|
|
394
|
+
return newLayout;
|
|
395
|
+
}
|
|
396
|
+
const oldPos = getWrapPosition(movedItem, cols);
|
|
397
|
+
const newPos = getWrapPosition({ ...movedItem, x, y }, cols);
|
|
398
|
+
if (oldPos === newPos) {
|
|
399
|
+
movedItem.x = x;
|
|
400
|
+
movedItem.y = y;
|
|
401
|
+
movedItem.moved = true;
|
|
402
|
+
return newLayout;
|
|
403
|
+
}
|
|
404
|
+
const isMovingEarlier = newPos < oldPos;
|
|
405
|
+
const sortedItems = newLayout.filter((l) => !l.static).sort((a, b) => getWrapPosition(a, cols) - getWrapPosition(b, cols));
|
|
406
|
+
if (isMovingEarlier) {
|
|
407
|
+
for (const l of sortedItems) {
|
|
408
|
+
const pos = getWrapPosition(l, cols);
|
|
409
|
+
if (l.i === item.i) continue;
|
|
410
|
+
if (pos >= newPos && pos < oldPos) {
|
|
411
|
+
const shiftedPos = pos + 1;
|
|
412
|
+
const coords = fromWrapPosition(shiftedPos, cols);
|
|
413
|
+
l.x = coords.x;
|
|
414
|
+
l.y = coords.y;
|
|
415
|
+
l.moved = true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
for (const l of sortedItems) {
|
|
420
|
+
const pos = getWrapPosition(l, cols);
|
|
421
|
+
if (l.i === item.i) continue;
|
|
422
|
+
if (pos > oldPos && pos <= newPos) {
|
|
423
|
+
const shiftedPos = pos - 1;
|
|
424
|
+
const coords = fromWrapPosition(shiftedPos, cols);
|
|
425
|
+
l.x = coords.x;
|
|
426
|
+
l.y = coords.y;
|
|
427
|
+
l.moved = true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
movedItem.x = x;
|
|
432
|
+
movedItem.y = y;
|
|
433
|
+
movedItem.moved = true;
|
|
434
|
+
return newLayout;
|
|
435
|
+
}
|
|
436
|
+
var wrapCompactor = {
|
|
437
|
+
type: "wrap",
|
|
438
|
+
allowOverlap: false,
|
|
439
|
+
compact(layout, cols) {
|
|
440
|
+
return compactWrap(layout, cols);
|
|
441
|
+
},
|
|
442
|
+
onMove(layout, item, x, y, cols) {
|
|
443
|
+
return moveInWrapMode(layout, item, x, y, cols);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
var wrapOverlapCompactor = {
|
|
447
|
+
...wrapCompactor,
|
|
448
|
+
allowOverlap: true,
|
|
449
|
+
compact(layout, _cols) {
|
|
450
|
+
return chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
|
|
89
454
|
exports.GridBackground = GridBackground;
|
|
455
|
+
exports.fastHorizontalCompactor = fastHorizontalCompactor;
|
|
456
|
+
exports.fastHorizontalOverlapCompactor = fastHorizontalOverlapCompactor;
|
|
457
|
+
exports.fastVerticalCompactor = fastVerticalCompactor;
|
|
458
|
+
exports.fastVerticalOverlapCompactor = fastVerticalOverlapCompactor;
|
|
459
|
+
exports.wrapCompactor = wrapCompactor;
|
|
460
|
+
exports.wrapOverlapCompactor = wrapOverlapCompactor;
|
|
90
461
|
//# sourceMappingURL=extras.js.map
|
|
91
462
|
//# sourceMappingURL=extras.js.map
|
package/dist/extras.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/extras/GridBackground.tsx"],"names":["useMemo","calcGridCellDimensions","jsx"],"mappings":";;;;;;AAkFO,SAAS,cAAA,CAAe;AAAA,EAC7B,KAAA;AAAA,EACA,IAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA,GAAS,CAAC,EAAA,EAAI,EAAE,CAAA;AAAA,EAChB,gBAAA;AAAA,EACA,IAAA,GAAO,EAAA;AAAA,EACP,MAAA;AAAA,EACA,KAAA,GAAQ,SAAA;AAAA,EACR,YAAA,GAAe,CAAA;AAAA,EACf,SAAA;AAAA,EACA;AACF,CAAA,EAA4C;AAC1C,EAAA,MAAM,IAAA,GAAOA,aAAA;AAAA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,GAAA,EAAA,EAAO;AACvC,MAAA,KAAA,IAAS,GAAA,GAAM,CAAA,EAAG,GAAA,GAAM,IAAA,EAAM,GAAA,EAAA,EAAO;AACnC,QAAA,MAAM,CAAA,GAAI,OAAA,GAAU,GAAA,IAAO,SAAA,GAAY,IAAA,CAAA;AACvC,QAAA,MAAM,CAAA,GAAI,OAAA,GAAU,GAAA,IAAO,UAAA,GAAa,IAAA,CAAA;AAExC,QAAA,KAAA,CAAM,IAAA;AAAA,0BACJE,cAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,CAAA;AAAA,cACA,CAAA;AAAA,cACA,KAAA,EAAO,SAAA;AAAA,cACP,MAAA,EAAQ,UAAA;AAAA,cACR,EAAA,EAAI,YAAA;AAAA,cACJ,EAAA,EAAI,YAAA;AAAA,cACJ,IAAA,EAAM;AAAA,aAAA;AAAA,YAPD,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA;AAAA;AAQpB,SACF;AAAA,MACF;AAAA,IACF;AAEA,IAAA,OAAO,KAAA;AAAA,EACT,GAAG,CAAC,IAAA,EAAM,UAAU,IAAA,EAAM,YAAA,EAAc,KAAK,CAAC,CAAA;AAE9C,EAAA,uBACEA,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,KAAA,EAAO;AAAA,QACL,QAAA,EAAU,UAAA;AAAA,QACV,GAAA,EAAK,CAAA;AAAA,QACL,IAAA,EAAM,CAAA;AAAA,QACN,KAAA;AAAA,QACA,MAAA,EAAQ,WAAA;AAAA,QACR,aAAA,EAAe,MAAA;AAAA,QACf,GAAG;AAAA,OACL;AAAA,MACA,aAAA,EAAY,MAAA;AAAA,MAEX,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"extras.js","sourcesContent":["/**\n * GridBackground component\n *\n * Renders an SVG grid background that aligns with GridLayout cells.\n * Use this to visualize the grid structure behind your layout.\n */\n\nimport * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { calcGridCellDimensions } from \"../core/calculate.js\";\nimport type { GridCellConfig } from \"../core/calculate.js\";\n\nexport interface GridBackgroundProps extends GridCellConfig {\n /**\n * Number of rows to display. If \"auto\", calculates based on height.\n * @default 10\n */\n rows?: number | \"auto\";\n\n /**\n * Height of the background in pixels. Used when rows=\"auto\".\n */\n height?: number;\n\n /**\n * Color of the grid cell backgrounds.\n * @default \"#e0e0e0\"\n */\n color?: string;\n\n /**\n * Border radius of grid cells in pixels.\n * @default 4\n */\n borderRadius?: number;\n\n /**\n * Additional CSS class name.\n */\n className?: string;\n\n /**\n * Additional inline styles.\n */\n style?: React.CSSProperties;\n}\n\n/**\n * SVG grid background component.\n *\n * Renders a visual grid that aligns with GridLayout cells. Position this\n * behind your GridLayout using CSS positioning.\n *\n * @example\n * ```tsx\n * import { GridBackground } from 'react-grid-layout/extras';\n *\n * function MyGrid() {\n * const { width, containerRef, mounted } = useContainerWidth();\n *\n * return (\n * <div ref={containerRef} style={{ position: 'relative' }}>\n * {mounted && (\n * <>\n * <GridBackground\n * width={width}\n * cols={12}\n * rowHeight={30}\n * margin={[10, 10]}\n * rows={10}\n * color=\"#f0f0f0\"\n * />\n * <GridLayout width={width} gridConfig={{ cols: 12, rowHeight: 30 }}>\n * {children}\n * </GridLayout>\n * </>\n * )}\n * </div>\n * );\n * }\n * ```\n */\nexport function GridBackground({\n width,\n cols,\n rowHeight,\n margin = [10, 10],\n containerPadding,\n rows = 10,\n height,\n color = \"#e0e0e0\",\n borderRadius = 4,\n className,\n style\n}: GridBackgroundProps): React.ReactElement {\n const dims = useMemo(\n () =>\n calcGridCellDimensions({\n width,\n cols,\n rowHeight,\n margin,\n containerPadding\n }),\n [width, cols, rowHeight, margin, containerPadding]\n );\n\n // Calculate number of rows\n const rowCount = useMemo(() => {\n if (rows !== \"auto\") return rows;\n if (height) {\n // Calculate rows that fit in the given height\n const padding = containerPadding ?? margin;\n return Math.ceil(\n (height - padding[1] * 2 + margin[1]) / (rowHeight + margin[1])\n );\n }\n return 10;\n }, [rows, height, rowHeight, margin, containerPadding]);\n\n // Calculate total height\n const totalHeight = useMemo(() => {\n const padding = containerPadding ?? margin;\n return padding[1] * 2 + rowCount * rowHeight + (rowCount - 1) * margin[1];\n }, [rowCount, rowHeight, margin, containerPadding]);\n\n // Generate cell rectangles\n const cells = useMemo(() => {\n const rects: React.ReactElement[] = [];\n const { cellWidth, cellHeight, offsetX, offsetY, gapX, gapY } = dims;\n\n for (let row = 0; row < rowCount; row++) {\n for (let col = 0; col < cols; col++) {\n const x = offsetX + col * (cellWidth + gapX);\n const y = offsetY + row * (cellHeight + gapY);\n\n rects.push(\n <rect\n key={`${row}-${col}`}\n x={x}\n y={y}\n width={cellWidth}\n height={cellHeight}\n rx={borderRadius}\n ry={borderRadius}\n fill={color}\n />\n );\n }\n }\n\n return rects;\n }, [dims, rowCount, cols, borderRadius, color]);\n\n return (\n <svg\n className={className}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: width,\n height: totalHeight,\n pointerEvents: \"none\",\n ...style\n }}\n aria-hidden=\"true\"\n >\n {cells}\n </svg>\n );\n}\n\nexport default GridBackground;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/extras/GridBackground.tsx","../src/extras/fastVerticalCompactor.ts","../src/extras/fastHorizontalCompactor.ts","../src/extras/wrapCompactor.ts"],"names":["useMemo","calcGridCellDimensions","jsx","cloneLayout","t","cloneLayoutItem","originalIndex"],"mappings":";;;;;;AAkFO,SAAS,cAAA,CAAe;AAAA,EAC7B,KAAA;AAAA,EACA,IAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA,GAAS,CAAC,EAAA,EAAI,EAAE,CAAA;AAAA,EAChB,gBAAA;AAAA,EACA,IAAA,GAAO,EAAA;AAAA,EACP,MAAA;AAAA,EACA,KAAA,GAAQ,SAAA;AAAA,EACR,YAAA,GAAe,CAAA;AAAA,EACf,SAAA;AAAA,EACA;AACF,CAAA,EAA4C;AAC1C,EAAA,MAAM,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,QAAA,CAAA,CAAE,IAAI,MAAA,CAAO,CAAA;AACb,QAAA,CAAA,CAAE,KAAA,GAAQ,IAAA;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAGA,EAAA,SAAA,CAAU,CAAA,GAAI,CAAA;AACd,EAAA,SAAA,CAAU,CAAA,GAAI,CAAA;AACd,EAAA,SAAA,CAAU,KAAA,GAAQ,IAAA;AAElB,EAAA,OAAO,SAAA;AACT;AAYO,IAAM,aAAA,GAA2B;AAAA,EACtC,IAAA,EAAM,MAAA;AAAA,EACN,YAAA,EAAc,KAAA;AAAA,EAEd,OAAA,CAAQ,QAAgB,IAAA,EAAsB;AAC5C,IAAA,OAAO,WAAA,CAAY,QAAQ,IAAI,CAAA;AAAA,EACjC,CAAA;AAAA,EAEA,MAAA,CACE,MAAA,EACA,IAAA,EACA,CAAA,EACA,GACA,IAAA,EACQ;AACR,IAAA,OAAO,cAAA,CAAe,MAAA,EAAQ,IAAA,EAAM,CAAA,EAAG,GAAG,IAAI,CAAA;AAAA,EAChD;AACF;AAKO,IAAM,oBAAA,GAAkC;AAAA,EAC7C,GAAG,aAAA;AAAA,EACH,YAAA,EAAc,IAAA;AAAA,EAEd,OAAA,CAAQ,QAAgB,KAAA,EAAuB;AAE7C,IAAA,OAAOA,6BAAY,MAAM,CAAA;AAAA,EAC3B;AACF","file":"extras.js","sourcesContent":["/**\n * GridBackground component\n *\n * Renders an SVG grid background that aligns with GridLayout cells.\n * Use this to visualize the grid structure behind your layout.\n */\n\nimport * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { calcGridCellDimensions } from \"../core/calculate.js\";\nimport type { GridCellConfig } from \"../core/calculate.js\";\n\nexport interface GridBackgroundProps extends GridCellConfig {\n /**\n * Number of rows to display. If \"auto\", calculates based on height.\n * @default 10\n */\n rows?: number | \"auto\";\n\n /**\n * Height of the background in pixels. Used when rows=\"auto\".\n */\n height?: number;\n\n /**\n * Color of the grid cell backgrounds.\n * @default \"#e0e0e0\"\n */\n color?: string;\n\n /**\n * Border radius of grid cells in pixels.\n * @default 4\n */\n borderRadius?: number;\n\n /**\n * Additional CSS class name.\n */\n className?: string;\n\n /**\n * Additional inline styles.\n */\n style?: React.CSSProperties;\n}\n\n/**\n * SVG grid background component.\n *\n * Renders a visual grid that aligns with GridLayout cells. Position this\n * behind your GridLayout using CSS positioning.\n *\n * @example\n * ```tsx\n * import { GridBackground } from 'react-grid-layout/extras';\n *\n * function MyGrid() {\n * const { width, containerRef, mounted } = useContainerWidth();\n *\n * return (\n * <div ref={containerRef} style={{ position: 'relative' }}>\n * {mounted && (\n * <>\n * <GridBackground\n * width={width}\n * cols={12}\n * rowHeight={30}\n * margin={[10, 10]}\n * rows={10}\n * color=\"#f0f0f0\"\n * />\n * <GridLayout width={width} gridConfig={{ cols: 12, rowHeight: 30 }}>\n * {children}\n * </GridLayout>\n * </>\n * )}\n * </div>\n * );\n * }\n * ```\n */\nexport function GridBackground({\n width,\n cols,\n rowHeight,\n margin = [10, 10],\n containerPadding,\n rows = 10,\n height,\n color = \"#e0e0e0\",\n borderRadius = 4,\n className,\n style\n}: GridBackgroundProps): React.ReactElement {\n const dims = useMemo(\n () =>\n calcGridCellDimensions({\n width,\n cols,\n rowHeight,\n margin,\n containerPadding\n }),\n [width, cols, rowHeight, margin, containerPadding]\n );\n\n // Calculate number of rows\n const rowCount = useMemo(() => {\n if (rows !== \"auto\") return rows;\n if (height) {\n // Calculate rows that fit in the given height\n const padding = containerPadding ?? margin;\n return Math.ceil(\n (height - padding[1] * 2 + margin[1]) / (rowHeight + margin[1])\n );\n }\n return 10;\n }, [rows, height, rowHeight, margin, containerPadding]);\n\n // Calculate total height\n const totalHeight = useMemo(() => {\n const padding = containerPadding ?? margin;\n return padding[1] * 2 + rowCount * rowHeight + (rowCount - 1) * margin[1];\n }, [rowCount, rowHeight, margin, containerPadding]);\n\n // Generate cell rectangles\n const cells = useMemo(() => {\n const rects: React.ReactElement[] = [];\n const { cellWidth, cellHeight, offsetX, offsetY, gapX, gapY } = dims;\n\n for (let row = 0; row < rowCount; row++) {\n for (let col = 0; col < cols; col++) {\n const x = offsetX + col * (cellWidth + gapX);\n const y = offsetY + row * (cellHeight + gapY);\n\n rects.push(\n <rect\n key={`${row}-${col}`}\n x={x}\n y={y}\n width={cellWidth}\n height={cellHeight}\n rx={borderRadius}\n ry={borderRadius}\n fill={color}\n />\n );\n }\n }\n\n return rects;\n }, [dims, rowCount, cols, borderRadius, color]);\n\n return (\n <svg\n className={className}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: width,\n height: totalHeight,\n pointerEvents: \"none\",\n ...style\n }}\n aria-hidden=\"true\"\n >\n {cells}\n </svg>\n );\n}\n\nexport default GridBackground;\n","/**\n * Fast Vertical Compactor\n *\n * An optimized vertical compaction algorithm using a \"rising tide\" approach.\n * This algorithm has O(n log n) complexity (dominated by sorting) compared to\n * the default vertical compactor which can have O(n²) complexity due to\n * recursive collision resolution.\n *\n * Best suited for large layouts (200+ items) where compaction performance\n * is critical. For smaller layouts, the difference is negligible.\n *\n * Based on the algorithm from PR #2152 by Morris Brodersen (@morris).\n *\n * @example\n * ```tsx\n * import { fastVerticalCompactor } from 'react-grid-layout/extras';\n *\n * <GridLayout\n * compactor={fastVerticalCompactor}\n * layout={layout}\n * // ...\n * />\n * ```\n */\n\nimport type { Compactor, Layout, LayoutItem, Mutable } from \"../core/types.js\";\nimport { cloneLayout } from \"../core/layout.js\";\n\n/**\n * Check if two layout items collide (overlap).\n */\nfunction collides(l1: LayoutItem, l2: LayoutItem): boolean {\n if (l1.i === l2.i) return false;\n return (\n l1.x < l2.x + l2.w &&\n l1.x + l1.w > l2.x &&\n l1.y < l2.y + l2.h &&\n l1.y + l1.h > l2.y\n );\n}\n\n/**\n * Fast vertical compaction using a \"rising tide\" algorithm.\n *\n * The algorithm works by:\n * 1. Sorting items by (y, x, static) - top-to-bottom, left-to-right\n * 2. Maintaining a \"tide\" array that tracks the highest occupied row per column\n * 3. For each item, moving it up to meet the tide (closing gaps)\n * 4. Checking for collisions with static items and adjusting as needed\n *\n * This avoids recursive collision resolution, making it O(n log n) overall.\n *\n * @param layout - The layout to compact (will be modified in place)\n * @param cols - Number of columns in the grid\n * @param allowOverlap - Whether to allow overlapping items\n */\nfunction compactVerticalFast(\n layout: LayoutItem[],\n cols: number,\n allowOverlap: boolean\n): void {\n const numItems = layout.length;\n\n // Sort items by position: top-to-bottom, left-to-right\n // Static items are sorted first at each position to reduce collision checks\n layout.sort((a, b) => {\n if (a.y < b.y) return -1;\n if (a.y > b.y) return 1;\n if (a.x < b.x) return -1;\n if (a.x > b.x) return 1;\n // Static items sorted first to reduce collision checks\n if (a.static && !b.static) return -1;\n if (!a.static && b.static) return 1;\n return 0;\n });\n\n // \"Rising tide\" - tracks the highest blocked row per column\n const tide: number[] = new Array(cols).fill(0);\n\n // Collect static items for collision checking\n const staticItems = layout.filter(item => item.static);\n const numStatics = staticItems.length;\n let staticOffset = 0;\n\n for (let i = 0; i < numItems; i++) {\n const item = layout[i] as Mutable<LayoutItem>;\n\n // Clamp x2 to grid bounds\n let x2 = item.x + item.w;\n if (x2 > cols) {\n x2 = cols;\n }\n\n if (item.static) {\n // Static items don't move; they become part of the tide\n // and don't need collision checks against themselves\n ++staticOffset;\n } else {\n // Find the minimum gap between the item and the tide\n let minGap = Infinity;\n for (let x = item.x; x < x2; ++x) {\n const tideValue = tide[x] ?? 0;\n const gap = item.y - tideValue;\n if (gap < minGap) {\n minGap = gap;\n }\n }\n\n // Close the gap (move item up to meet the tide)\n if (!allowOverlap || minGap > 0) {\n item.y -= minGap;\n }\n\n // Handle collisions with static items\n for (let j = staticOffset; !allowOverlap && j < numStatics; ++j) {\n const staticItem = staticItems[j];\n if (staticItem === undefined) continue;\n\n // Early exit: if static item is below current item, no more collisions possible\n if (staticItem.y >= item.y + item.h) {\n break;\n }\n\n if (collides(item, staticItem)) {\n // Move current item below the static item\n item.y = staticItem.y + staticItem.h;\n\n if (j > staticOffset) {\n // Item was moved; need to recheck with earlier static items\n // Note: j = staticOffset means after ++j we start at staticOffset + 1,\n // but staticItems[staticOffset] was already checked or is above us\n j = staticOffset;\n }\n }\n }\n\n // Reset moved flag\n item.moved = false;\n }\n\n // Update tide: mark columns as blocked up to item's bottom\n const t = item.y + item.h;\n for (let x = item.x; x < x2; ++x) {\n const currentTide = tide[x] ?? 0;\n if (currentTide < t) {\n tide[x] = t;\n }\n }\n }\n}\n\n/**\n * Fast vertical compactor - optimized for large layouts.\n *\n * Uses a \"rising tide\" algorithm that achieves O(n log n) complexity\n * instead of the potentially O(n²) recursive collision resolution.\n *\n * Best suited for layouts with 200+ items where compaction performance\n * becomes noticeable. For smaller layouts, the standard verticalCompactor\n * works equally well.\n */\nexport const fastVerticalCompactor: Compactor = {\n type: \"vertical\",\n allowOverlap: false,\n\n compact(layout: Layout, cols: number): Layout {\n // Clone the layout since we modify in place\n const out = cloneLayout(layout) as LayoutItem[];\n compactVerticalFast(out, cols, false);\n return out;\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n _cols: number\n ): Layout {\n // Simple move - compact() will be called after\n const newLayout = cloneLayout(layout) as Mutable<LayoutItem>[];\n const movedItem = newLayout.find(l => l.i === item.i);\n if (movedItem) {\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n }\n return newLayout;\n }\n};\n\n/**\n * Fast vertical compactor that allows overlapping items.\n *\n * Compacts items upward but allows them to overlap each other.\n */\nexport const fastVerticalOverlapCompactor: Compactor = {\n ...fastVerticalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, cols: number): Layout {\n const out = cloneLayout(layout) as LayoutItem[];\n compactVerticalFast(out, cols, true);\n return out;\n }\n};\n","/**\n * Fast Horizontal Compactor\n *\n * An optimized horizontal compaction algorithm using a \"sweeping tide\" approach.\n * This algorithm has O(n log n) complexity (dominated by sorting) compared to\n * the default horizontal compactor which can have O(n²) complexity due to\n * recursive collision resolution.\n *\n * Best suited for large layouts (200+ items) where compaction performance\n * is critical. For smaller layouts, the difference is negligible.\n *\n * Adapted from the vertical fast compactor algorithm from PR #2152 by Morris Brodersen (@morris).\n *\n * @example\n * ```tsx\n * import { fastHorizontalCompactor } from 'react-grid-layout/extras';\n *\n * <GridLayout\n * compactor={fastHorizontalCompactor}\n * layout={layout}\n * // ...\n * />\n * ```\n */\n\nimport type { Compactor, Layout, LayoutItem, Mutable } from \"../core/types.js\";\nimport { cloneLayout } from \"../core/layout.js\";\n\n/**\n * Ensure the tide array has enough rows.\n */\nfunction ensureTideRows(tide: number[], neededRows: number): void {\n while (tide.length < neededRows) {\n tide.push(0);\n }\n}\n\n/**\n * Find the maximum tide value for a range of rows.\n */\nfunction getMaxTideForItem(tide: number[], y: number, h: number): number {\n let maxTide = 0;\n for (let row = y; row < y + h; row++) {\n const tideValue = tide[row] ?? 0;\n if (tideValue > maxTide) {\n maxTide = tideValue;\n }\n }\n return maxTide;\n}\n\n/**\n * Check if an item can be placed at a given position without colliding with static items.\n */\nfunction canPlaceAt(\n item: LayoutItem,\n x: number,\n y: number,\n staticItems: LayoutItem[],\n cols: number\n): boolean {\n // Check grid bounds\n if (x + item.w > cols) return false;\n\n // Check static collisions\n for (const staticItem of staticItems) {\n if (\n x < staticItem.x + staticItem.w &&\n x + item.w > staticItem.x &&\n y < staticItem.y + staticItem.h &&\n y + item.h > staticItem.y\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Fast horizontal compaction using a \"sweeping tide\" algorithm with row wrapping.\n *\n * The algorithm works by:\n * 1. Sorting items by (y, x, static) - top-to-bottom, left-to-right (like standard compactor)\n * 2. Maintaining a \"tide\" array that tracks the rightmost occupied column per row\n * 3. For each item, finding the leftmost position it can occupy\n * 4. If the item doesn't fit in its current row, wrapping to the next row\n * 5. Checking for collisions with static items and adjusting as needed\n *\n * This avoids recursive collision resolution, making it O(n log n) overall.\n *\n * @param layout - The layout to compact (will be modified in place)\n * @param cols - Number of columns in the grid\n * @param allowOverlap - Whether to allow overlapping items\n */\nfunction compactHorizontalFast(\n layout: LayoutItem[],\n cols: number,\n allowOverlap: boolean\n): void {\n const numItems = layout.length;\n if (numItems === 0) return;\n\n // Sort items by column then row (same as standard horizontal compactor)\n // Static items are sorted first at each position to reduce collision checks\n layout.sort((a, b) => {\n if (a.x !== b.x) return a.x - b.x;\n if (a.y !== b.y) return a.y - b.y;\n if (a.static !== b.static) return a.static ? -1 : 1;\n return 0;\n });\n\n // Calculate max row extent for pre-allocation\n let maxRow = 0;\n for (let i = 0; i < numItems; i++) {\n const item = layout[i];\n if (item !== undefined) {\n const bottom = item.y + item.h;\n if (bottom > maxRow) maxRow = bottom;\n }\n }\n\n // \"Sweeping tide\" - tracks the rightmost blocked column per row\n // Pre-allocate based on max row extent to avoid repeated reallocations\n const tide: number[] = new Array(maxRow).fill(0);\n\n // Collect static items for collision checking\n const staticItems = layout.filter(item => item.static);\n\n // Safety limit for row wrapping (prevents infinite loops)\n // Use a limit relative to layout size (at least 10_000, or 100x the number of items)\n const maxRowLimit = Math.max(10_000, numItems * 100);\n\n for (let i = 0; i < numItems; i++) {\n const item = layout[i] as Mutable<LayoutItem>;\n\n if (item.static) {\n // Static items don't move; they become part of the tide\n ensureTideRows(tide, item.y + item.h);\n const t = item.x + item.w;\n for (let y = item.y; y < item.y + item.h; y++) {\n if ((tide[y] ?? 0) < t) {\n tide[y] = t;\n }\n }\n continue;\n }\n\n // For non-static items, find the best position\n let targetY = item.y;\n let targetX = 0;\n let placed = false;\n\n // Try to place the item, wrapping to lower rows if needed\n while (!placed) {\n ensureTideRows(tide, targetY + item.h);\n\n // Find the maximum tide across the rows this item spans\n const maxTide = getMaxTideForItem(tide, targetY, item.h);\n\n // Try to place at the tide position\n targetX = maxTide;\n\n // Check if item fits within grid bounds\n if (targetX + item.w <= cols) {\n // Check for static item collisions\n if (\n allowOverlap ||\n canPlaceAt(item, targetX, targetY, staticItems, cols)\n ) {\n placed = true;\n } else {\n // Find the rightmost static collision and try past it\n let maxStaticRight = targetX;\n let foundCollision = false;\n for (const staticItem of staticItems) {\n if (\n targetX < staticItem.x + staticItem.w &&\n targetX + item.w > staticItem.x &&\n targetY < staticItem.y + staticItem.h &&\n targetY + item.h > staticItem.y\n ) {\n maxStaticRight = Math.max(\n maxStaticRight,\n staticItem.x + staticItem.w\n );\n foundCollision = true;\n }\n }\n if (foundCollision) {\n targetX = maxStaticRight;\n }\n\n // After moving past static, check if we still fit\n if (foundCollision && targetX + item.w <= cols) {\n // Verify no more collisions at new position\n if (canPlaceAt(item, targetX, targetY, staticItems, cols)) {\n placed = true;\n } else {\n // Can't fit in this row, wrap to next\n targetY++;\n }\n } else if (foundCollision) {\n // Pushed past grid edge, wrap to next row\n targetY++;\n } else {\n // No collision but can't place - shouldn't happen\n placed = true;\n }\n }\n } else {\n // Doesn't fit in this row, wrap to next\n targetY++;\n }\n\n // Safety check to prevent infinite loops\n if (targetY > maxRowLimit) {\n if (typeof console !== \"undefined\" && console.warn) {\n console.warn(\n `Fast horizontal compactor: Item \"${item.i}\" exceeded max row limit (${targetY}). ` +\n `This may indicate a layout that cannot be compacted within grid bounds.`\n );\n }\n // Give up and place at current position\n targetX = 0;\n placed = true;\n }\n }\n\n // Update item position\n item.x = targetX;\n item.y = targetY;\n item.moved = false;\n\n // Update tide: mark rows as blocked up to item's right edge\n ensureTideRows(tide, targetY + item.h);\n const t = targetX + item.w;\n for (let y = targetY; y < targetY + item.h; y++) {\n if ((tide[y] ?? 0) < t) {\n tide[y] = t;\n }\n }\n }\n}\n\n/**\n * Fast horizontal compactor - optimized for large layouts.\n *\n * Uses a \"sweeping tide\" algorithm that achieves O(n log n) complexity\n * instead of the potentially O(n²) recursive collision resolution.\n *\n * Best suited for layouts with 200+ items where compaction performance\n * becomes noticeable. For smaller layouts, the standard horizontalCompactor\n * works equally well.\n */\nexport const fastHorizontalCompactor: Compactor = {\n type: \"horizontal\",\n allowOverlap: false,\n\n compact(layout: Layout, cols: number): Layout {\n // Clone the layout since we modify in place\n const out = cloneLayout(layout) as LayoutItem[];\n compactHorizontalFast(out, cols, false);\n return out;\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n _cols: number\n ): Layout {\n // Simple move - compact() will be called after\n const newLayout = cloneLayout(layout) as Mutable<LayoutItem>[];\n const movedItem = newLayout.find(l => l.i === item.i);\n if (movedItem) {\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n }\n return newLayout;\n }\n};\n\n/**\n * Fast horizontal compactor that allows overlapping items.\n *\n * Compacts items leftward but allows them to overlap each other.\n */\nexport const fastHorizontalOverlapCompactor: Compactor = {\n ...fastHorizontalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, cols: number): Layout {\n const out = cloneLayout(layout) as LayoutItem[];\n compactHorizontalFast(out, cols, true);\n return out;\n }\n};\n","/**\n * Wrap Compactor\n *\n * A compaction algorithm that treats grid items like words in a paragraph.\n * Items flow left-to-right, wrapping to the next row when they reach\n * the grid edge.\n *\n * When dragging:\n * - Moving an item earlier in the sequence shifts other items down/right\n * - Moving an item later in the sequence shifts other items up/left\n *\n * This creates a natural reordering behavior similar to drag-and-drop\n * in file managers or card layouts.\n *\n * Based on the algorithm from PR #1773 by John Thomson (@JohnThomson).\n *\n * @example\n * ```tsx\n * import { wrapCompactor } from 'react-grid-layout/extras';\n *\n * <GridLayout\n * compactor={wrapCompactor}\n * layout={layout}\n * // ...\n * />\n * ```\n */\n\nimport type { Compactor, Layout, LayoutItem, Mutable } from \"../core/types.js\";\nimport { cloneLayout, cloneLayoutItem } from \"../core/layout.js\";\n\n/**\n * Sort items in wrap order: left-to-right, top-to-bottom.\n * This is the visual reading order for wrapped content.\n */\nfunction sortByWrapOrder(layout: Layout): LayoutItem[] {\n return [...layout].sort((a, b) => {\n // Primary: top-to-bottom (by row)\n if (a.y !== b.y) return a.y - b.y;\n // Secondary: left-to-right (by column)\n return a.x - b.x;\n });\n}\n\n/**\n * Get the linear position of an item in wrap order.\n * Position 0 is top-left, increasing left-to-right then top-to-bottom.\n */\nfunction getWrapPosition(item: LayoutItem, cols: number): number {\n return item.y * cols + item.x;\n}\n\n/**\n * Convert a linear wrap position back to x,y coordinates.\n */\nfunction fromWrapPosition(pos: number, cols: number): { x: number; y: number } {\n return {\n x: pos % cols,\n y: Math.floor(pos / cols)\n };\n}\n\n/**\n * Compact items in wrap order, filling gaps from left-to-right, top-to-bottom.\n * All items are assumed to be 1x1 for wrap mode to work correctly.\n */\nfunction compactWrap(layout: Layout, cols: number): LayoutItem[] {\n if (layout.length === 0) return [];\n\n const sorted = sortByWrapOrder(layout);\n const out: LayoutItem[] = new Array(layout.length);\n const statics = sorted.filter(item => item.static);\n\n // Track which positions are occupied by static items\n const staticPositions = new Set<number>();\n for (const s of statics) {\n // For static items, mark all cells they occupy\n for (let dy = 0; dy < s.h; dy++) {\n for (let dx = 0; dx < s.w; dx++) {\n staticPositions.add((s.y + dy) * cols + (s.x + dx));\n }\n }\n }\n\n let nextPos = 0;\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n const l = cloneLayoutItem(sortedItem);\n\n if (l.static) {\n // Static items stay in place\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n continue;\n }\n\n // Find next available position that doesn't conflict with statics\n while (staticPositions.has(nextPos)) {\n nextPos++;\n }\n\n // For items larger than 1x1, we need to check if the full item fits\n const { x, y } = fromWrapPosition(nextPos, cols);\n\n // Check if item would overflow the row\n if (x + l.w > cols) {\n // Move to start of next row\n nextPos = (y + 1) * cols;\n // Skip any static positions on the new row\n while (staticPositions.has(nextPos)) {\n nextPos++;\n }\n }\n\n const newCoords = fromWrapPosition(nextPos, cols);\n (l as Mutable<LayoutItem>).x = newCoords.x;\n (l as Mutable<LayoutItem>).y = newCoords.y;\n\n // Advance past this item\n nextPos += l.w;\n\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n }\n\n return out;\n}\n\n/**\n * Move an item in wrap mode, shifting other items to maintain sequence.\n *\n * When moving an item:\n * - If moving to an earlier position: items between shift right/down\n * - If moving to a later position: items between shift left/up\n */\nfunction moveInWrapMode(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n cols: number\n): Layout {\n const newLayout = cloneLayout(layout) as Mutable<LayoutItem>[];\n const movedItem = newLayout.find(l => l.i === item.i);\n\n if (!movedItem) {\n return newLayout;\n }\n\n const oldPos = getWrapPosition(movedItem, cols);\n const newPos = getWrapPosition({ ...movedItem, x, y }, cols);\n\n if (oldPos === newPos) {\n // No actual movement in wrap order\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n return newLayout;\n }\n\n const isMovingEarlier = newPos < oldPos;\n\n // Get all non-static items sorted by wrap position\n const sortedItems = newLayout\n .filter(l => !l.static)\n .sort((a, b) => getWrapPosition(a, cols) - getWrapPosition(b, cols));\n\n if (isMovingEarlier) {\n // Moving item earlier: shift items in [newPos, oldPos) to the right\n for (const l of sortedItems) {\n const pos = getWrapPosition(l, cols);\n if (l.i === item.i) continue;\n\n if (pos >= newPos && pos < oldPos) {\n // Shift this item right by 1 position in wrap order\n const shiftedPos = pos + 1;\n const coords = fromWrapPosition(shiftedPos, cols);\n l.x = coords.x;\n l.y = coords.y;\n l.moved = true;\n }\n }\n } else {\n // Moving item later: shift items in (oldPos, newPos] to the left\n for (const l of sortedItems) {\n const pos = getWrapPosition(l, cols);\n if (l.i === item.i) continue;\n\n if (pos > oldPos && pos <= newPos) {\n // Shift this item left by 1 position in wrap order\n const shiftedPos = pos - 1;\n const coords = fromWrapPosition(shiftedPos, cols);\n l.x = coords.x;\n l.y = coords.y;\n l.moved = true;\n }\n }\n }\n\n // Finally, move the dragged item to its new position\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n\n return newLayout;\n}\n\n/**\n * Wrap compactor - arranges items like words in a paragraph.\n *\n * Items flow left-to-right and wrap to the next row when they\n * reach the grid edge. Dragging an item reorders the sequence,\n * with other items shifting to maintain the flow.\n *\n * Works best with uniformly-sized items (especially 1x1), but\n * handles larger items by ensuring they fit within row bounds.\n */\nexport const wrapCompactor: Compactor = {\n type: \"wrap\",\n allowOverlap: false,\n\n compact(layout: Layout, cols: number): Layout {\n return compactWrap(layout, cols);\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n cols: number\n ): Layout {\n return moveInWrapMode(layout, item, x, y, cols);\n }\n};\n\n/**\n * Wrap compactor that allows overlapping items.\n */\nexport const wrapOverlapCompactor: Compactor = {\n ...wrapCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, _cols: number): Layout {\n // With overlap allowed, just clone without compacting\n return cloneLayout(layout);\n }\n};\n"]}
|