@signiphi/page-assembly 0.2.0-beta.11 → 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 +49 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -15
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +9 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1414,11 +1414,17 @@ function getBaseFieldName(encodedName) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
return baseName;
|
|
1416
1416
|
}
|
|
1417
|
+
function stripFieldTypeSuffix(value) {
|
|
1418
|
+
const stripped = value.replace(/_(signature|initials|date)$/i, "");
|
|
1419
|
+
return stripped || value;
|
|
1420
|
+
}
|
|
1417
1421
|
function getSignerFromFieldName(encodedName) {
|
|
1418
1422
|
if (encodedName.includes("__SIGNER__")) {
|
|
1419
1423
|
const parts = encodedName.split("__SIGNER__");
|
|
1420
1424
|
if (parts[1]) {
|
|
1421
|
-
|
|
1425
|
+
const segment = parts[1].split("__")[0] || parts[1];
|
|
1426
|
+
const isTerminal = segment === parts[1];
|
|
1427
|
+
return isTerminal ? stripFieldTypeSuffix(segment) : segment;
|
|
1422
1428
|
}
|
|
1423
1429
|
}
|
|
1424
1430
|
return void 0;
|
|
@@ -1939,6 +1945,7 @@ function mapFieldPositionsAfterAssembly(fields, pageMapping) {
|
|
|
1939
1945
|
return pageMapping.has(mappingKey) || pageMapping.size === 0;
|
|
1940
1946
|
});
|
|
1941
1947
|
}
|
|
1948
|
+
var VISIBLE_PAGE_ROWS = 2;
|
|
1942
1949
|
var isMultiSelectModifier = (event) => {
|
|
1943
1950
|
return event.ctrlKey || event.metaKey;
|
|
1944
1951
|
};
|
|
@@ -2265,21 +2272,48 @@ var ReorderablePageGrid = ({
|
|
|
2265
2272
|
newPages.splice(hoverIndex, 0, draggedPage);
|
|
2266
2273
|
onReorderPages(file.id, newPages);
|
|
2267
2274
|
}, [file.id, file.pages, onReorderPages]);
|
|
2268
|
-
|
|
2269
|
-
|
|
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",
|
|
2270
2296
|
{
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
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
|
+
);
|
|
2283
2317
|
};
|
|
2284
2318
|
var FileDropZone = ({
|
|
2285
2319
|
targetIndex,
|