@signiphi/page-assembly 0.2.0-beta.12 → 0.2.0-beta.13
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/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -14
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +6 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1945,6 +1945,7 @@ function mapFieldPositionsAfterAssembly(fields, pageMapping) {
|
|
|
1945
1945
|
return pageMapping.has(mappingKey) || pageMapping.size === 0;
|
|
1946
1946
|
});
|
|
1947
1947
|
}
|
|
1948
|
+
var VISIBLE_PAGE_ROWS = 2;
|
|
1948
1949
|
var isMultiSelectModifier = (event) => {
|
|
1949
1950
|
return event.ctrlKey || event.metaKey;
|
|
1950
1951
|
};
|
|
@@ -2271,21 +2272,48 @@ var ReorderablePageGrid = ({
|
|
|
2271
2272
|
newPages.splice(hoverIndex, 0, draggedPage);
|
|
2272
2273
|
onReorderPages(file.id, newPages);
|
|
2273
2274
|
}, [file.id, file.pages, onReorderPages]);
|
|
2274
|
-
|
|
2275
|
-
|
|
2275
|
+
const gridRef = useRef(null);
|
|
2276
|
+
const [maxHeight, setMaxHeight] = useState(void 0);
|
|
2277
|
+
useEffect(() => {
|
|
2278
|
+
const grid = gridRef.current;
|
|
2279
|
+
if (!grid || typeof ResizeObserver === "undefined") return;
|
|
2280
|
+
const measure = () => {
|
|
2281
|
+
const firstThumbnail = grid.firstElementChild;
|
|
2282
|
+
if (!firstThumbnail) return;
|
|
2283
|
+
const rowHeight = firstThumbnail.getBoundingClientRect().height;
|
|
2284
|
+
if (rowHeight <= 0) return;
|
|
2285
|
+
const rowGap = parseFloat(getComputedStyle(grid).rowGap) || 0;
|
|
2286
|
+
setMaxHeight(Math.ceil(rowHeight * VISIBLE_PAGE_ROWS + rowGap * (VISIBLE_PAGE_ROWS - 1)));
|
|
2287
|
+
};
|
|
2288
|
+
measure();
|
|
2289
|
+
const observer = new ResizeObserver(measure);
|
|
2290
|
+
observer.observe(grid);
|
|
2291
|
+
if (grid.firstElementChild) observer.observe(grid.firstElementChild);
|
|
2292
|
+
return () => observer.disconnect();
|
|
2293
|
+
}, [file.pages]);
|
|
2294
|
+
return /* @__PURE__ */ jsx(
|
|
2295
|
+
"div",
|
|
2276
2296
|
{
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2297
|
+
ref: gridRef,
|
|
2298
|
+
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4 overflow-y-auto overflow-x-hidden",
|
|
2299
|
+
style: { maxHeight },
|
|
2300
|
+
children: file.pages.map((page, index) => /* @__PURE__ */ jsx(
|
|
2301
|
+
DraggablePageThumbnail,
|
|
2302
|
+
{
|
|
2303
|
+
page,
|
|
2304
|
+
fileId: file.id,
|
|
2305
|
+
index,
|
|
2306
|
+
isSelected: selectedPageIds.includes(page.id),
|
|
2307
|
+
onSingleSelect: onSingleSelectPage,
|
|
2308
|
+
onToggleSelect: onTogglePageSelect,
|
|
2309
|
+
onRangeSelect: onRangeSelectPage,
|
|
2310
|
+
movePageInFile,
|
|
2311
|
+
isDraggingPageRef
|
|
2312
|
+
},
|
|
2313
|
+
page.id
|
|
2314
|
+
))
|
|
2315
|
+
}
|
|
2316
|
+
);
|
|
2289
2317
|
};
|
|
2290
2318
|
var FileDropZone = ({
|
|
2291
2319
|
targetIndex,
|