@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.js
CHANGED
|
@@ -1972,6 +1972,7 @@ function mapFieldPositionsAfterAssembly(fields, pageMapping) {
|
|
|
1972
1972
|
return pageMapping.has(mappingKey) || pageMapping.size === 0;
|
|
1973
1973
|
});
|
|
1974
1974
|
}
|
|
1975
|
+
var VISIBLE_PAGE_ROWS = 2;
|
|
1975
1976
|
var isMultiSelectModifier = (event) => {
|
|
1976
1977
|
return event.ctrlKey || event.metaKey;
|
|
1977
1978
|
};
|
|
@@ -2298,21 +2299,48 @@ var ReorderablePageGrid = ({
|
|
|
2298
2299
|
newPages.splice(hoverIndex, 0, draggedPage);
|
|
2299
2300
|
onReorderPages(file.id, newPages);
|
|
2300
2301
|
}, [file.id, file.pages, onReorderPages]);
|
|
2301
|
-
|
|
2302
|
-
|
|
2302
|
+
const gridRef = React7.useRef(null);
|
|
2303
|
+
const [maxHeight, setMaxHeight] = React7.useState(void 0);
|
|
2304
|
+
React7.useEffect(() => {
|
|
2305
|
+
const grid = gridRef.current;
|
|
2306
|
+
if (!grid || typeof ResizeObserver === "undefined") return;
|
|
2307
|
+
const measure = () => {
|
|
2308
|
+
const firstThumbnail = grid.firstElementChild;
|
|
2309
|
+
if (!firstThumbnail) return;
|
|
2310
|
+
const rowHeight = firstThumbnail.getBoundingClientRect().height;
|
|
2311
|
+
if (rowHeight <= 0) return;
|
|
2312
|
+
const rowGap = parseFloat(getComputedStyle(grid).rowGap) || 0;
|
|
2313
|
+
setMaxHeight(Math.ceil(rowHeight * VISIBLE_PAGE_ROWS + rowGap * (VISIBLE_PAGE_ROWS - 1)));
|
|
2314
|
+
};
|
|
2315
|
+
measure();
|
|
2316
|
+
const observer = new ResizeObserver(measure);
|
|
2317
|
+
observer.observe(grid);
|
|
2318
|
+
if (grid.firstElementChild) observer.observe(grid.firstElementChild);
|
|
2319
|
+
return () => observer.disconnect();
|
|
2320
|
+
}, [file.pages]);
|
|
2321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2322
|
+
"div",
|
|
2303
2323
|
{
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2324
|
+
ref: gridRef,
|
|
2325
|
+
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",
|
|
2326
|
+
style: { maxHeight },
|
|
2327
|
+
children: file.pages.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2328
|
+
DraggablePageThumbnail,
|
|
2329
|
+
{
|
|
2330
|
+
page,
|
|
2331
|
+
fileId: file.id,
|
|
2332
|
+
index,
|
|
2333
|
+
isSelected: selectedPageIds.includes(page.id),
|
|
2334
|
+
onSingleSelect: onSingleSelectPage,
|
|
2335
|
+
onToggleSelect: onTogglePageSelect,
|
|
2336
|
+
onRangeSelect: onRangeSelectPage,
|
|
2337
|
+
movePageInFile,
|
|
2338
|
+
isDraggingPageRef
|
|
2339
|
+
},
|
|
2340
|
+
page.id
|
|
2341
|
+
))
|
|
2342
|
+
}
|
|
2343
|
+
);
|
|
2316
2344
|
};
|
|
2317
2345
|
var FileDropZone = ({
|
|
2318
2346
|
targetIndex,
|