@signiphi/page-assembly 0.2.0-beta.4 → 0.2.0-beta.6
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -33
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +18 -18
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1019,8 +1019,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1019
1019
|
try {
|
|
1020
1020
|
const fieldType = typeof field.type === "string" ? field.type : field.type;
|
|
1021
1021
|
switch (fieldType) {
|
|
1022
|
-
case "text" /* TEXT */:
|
|
1023
|
-
case "text": {
|
|
1022
|
+
case "text" /* TEXT */: {
|
|
1024
1023
|
const encodedName = encodeFieldNameWithSigner(uniqueFieldName, field.assignedSignerEmail);
|
|
1025
1024
|
const textField = form.createTextField(encodedName);
|
|
1026
1025
|
textField.addToPage(page, {
|
|
@@ -1065,8 +1064,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1065
1064
|
}
|
|
1066
1065
|
break;
|
|
1067
1066
|
}
|
|
1068
|
-
case "checkbox" /* CHECKBOX */:
|
|
1069
|
-
case "checkbox": {
|
|
1067
|
+
case "checkbox" /* CHECKBOX */: {
|
|
1070
1068
|
const encodedName = encodeFieldNameWithSigner(uniqueFieldName, field.assignedSignerEmail);
|
|
1071
1069
|
const checkBox = form.createCheckBox(encodedName);
|
|
1072
1070
|
checkBox.addToPage(page, {
|
|
@@ -1097,8 +1095,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1097
1095
|
}
|
|
1098
1096
|
break;
|
|
1099
1097
|
}
|
|
1100
|
-
case "signature" /* SIGNATURE */:
|
|
1101
|
-
case "signature": {
|
|
1098
|
+
case "signature" /* SIGNATURE */: {
|
|
1102
1099
|
const baseWithSuffix = field.name.endsWith("_signature") ? field.name : `${field.name}_signature`;
|
|
1103
1100
|
const finalName = conflictingNames.has(field.name) ? `${baseWithSuffix}_p${field.position.page}` : baseWithSuffix;
|
|
1104
1101
|
const encodedName = encodeFieldNameWithLabelAndSigner(finalName, field.label, field.assignedSignerEmail);
|
|
@@ -1120,8 +1117,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1120
1117
|
}
|
|
1121
1118
|
break;
|
|
1122
1119
|
}
|
|
1123
|
-
case "initials" /* INITIALS */:
|
|
1124
|
-
case "initials": {
|
|
1120
|
+
case "initials" /* INITIALS */: {
|
|
1125
1121
|
const baseWithSuffix = field.name.endsWith("_initials") ? field.name : `${field.name}_initials`;
|
|
1126
1122
|
const finalName = conflictingNames.has(field.name) ? `${baseWithSuffix}_p${field.position.page}` : baseWithSuffix;
|
|
1127
1123
|
const encodedName = encodeFieldNameWithLabelAndSigner(finalName, field.label, field.assignedSignerEmail);
|
|
@@ -1143,8 +1139,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1143
1139
|
}
|
|
1144
1140
|
break;
|
|
1145
1141
|
}
|
|
1146
|
-
case "date" /* DATE */:
|
|
1147
|
-
case "date": {
|
|
1142
|
+
case "date" /* DATE */: {
|
|
1148
1143
|
const baseWithSuffix = field.name.endsWith("_date") ? field.name : `${field.name}_date`;
|
|
1149
1144
|
const finalName = conflictingNames.has(field.name) ? `${baseWithSuffix}_p${field.position.page}` : baseWithSuffix;
|
|
1150
1145
|
const encodedName = encodeFieldNameWithLabelAndSigner(finalName, field.label, field.assignedSignerEmail);
|
|
@@ -1165,8 +1160,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1165
1160
|
}
|
|
1166
1161
|
break;
|
|
1167
1162
|
}
|
|
1168
|
-
case "dropdown" /* DROPDOWN */:
|
|
1169
|
-
case "dropdown": {
|
|
1163
|
+
case "dropdown" /* DROPDOWN */: {
|
|
1170
1164
|
const encodedName = encodeFieldNameWithSigner(uniqueFieldName, field.assignedSignerEmail);
|
|
1171
1165
|
const dropdown = form.createDropdown(encodedName);
|
|
1172
1166
|
dropdown.addToPage(page, {
|
|
@@ -1199,8 +1193,7 @@ async function addFormFieldsToPdf(pdfBytes, formFields, options = {}) {
|
|
|
1199
1193
|
}
|
|
1200
1194
|
break;
|
|
1201
1195
|
}
|
|
1202
|
-
case "radio" /* RADIO */:
|
|
1203
|
-
case "radio": {
|
|
1196
|
+
case "radio" /* RADIO */: {
|
|
1204
1197
|
const encodedName = encodeFieldNameWithSigner(uniqueFieldName, field.assignedSignerEmail);
|
|
1205
1198
|
const radioGroup = form.createRadioGroup(encodedName);
|
|
1206
1199
|
if (field.options && field.options.length > 0) {
|
|
@@ -1663,6 +1656,7 @@ var FileCard = ({
|
|
|
1663
1656
|
const [newName, setNewName] = useState(file.name);
|
|
1664
1657
|
const fileSelectedPages = file.pages.filter((p) => selectedPageIds.includes(p.id));
|
|
1665
1658
|
const allPagesSelected = file.pages.length > 0 && fileSelectedPages.length === file.pages.length;
|
|
1659
|
+
const pendingDropdownAction = useRef(null);
|
|
1666
1660
|
const [{ isDraggingFile }, dragFile] = useDrag({
|
|
1667
1661
|
type: DND_TYPES.FILE,
|
|
1668
1662
|
item: () => {
|
|
@@ -1767,23 +1761,38 @@ var FileCard = ({
|
|
|
1767
1761
|
] }) }),
|
|
1768
1762
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1769
1763
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "hover:bg-gray-100 rounded-lg", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }),
|
|
1770
|
-
/* @__PURE__ */ jsxs(
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1764
|
+
/* @__PURE__ */ jsxs(
|
|
1765
|
+
DropdownMenuContent,
|
|
1766
|
+
{
|
|
1767
|
+
align: "end",
|
|
1768
|
+
className: "w-52",
|
|
1769
|
+
onCloseAutoFocus: () => {
|
|
1770
|
+
pendingDropdownAction.current?.();
|
|
1771
|
+
pendingDropdownAction.current = null;
|
|
1772
|
+
},
|
|
1773
|
+
children: [
|
|
1774
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: () => {
|
|
1775
|
+
pendingDropdownAction.current = () => setIsRenaming(true);
|
|
1776
|
+
}, children: [
|
|
1777
|
+
/* @__PURE__ */ jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) }),
|
|
1778
|
+
"Rename File"
|
|
1779
|
+
] }),
|
|
1780
|
+
/* @__PURE__ */ jsxs(
|
|
1781
|
+
DropdownMenuItem,
|
|
1782
|
+
{
|
|
1783
|
+
onSelect: () => {
|
|
1784
|
+
pendingDropdownAction.current = () => onRemoveFile(file.id);
|
|
1785
|
+
},
|
|
1786
|
+
className: "text-red-600 hover:text-red-700 hover:bg-red-50 focus:text-red-700 focus:bg-red-50",
|
|
1787
|
+
children: [
|
|
1788
|
+
/* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4 mr-2" }),
|
|
1789
|
+
"Remove File"
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
)
|
|
1793
|
+
]
|
|
1794
|
+
}
|
|
1795
|
+
)
|
|
1787
1796
|
] })
|
|
1788
1797
|
] })
|
|
1789
1798
|
] }) }),
|
|
@@ -2642,8 +2651,7 @@ function debounce(func, wait) {
|
|
|
2642
2651
|
timeout = setTimeout(() => func(...args), wait);
|
|
2643
2652
|
});
|
|
2644
2653
|
}
|
|
2645
|
-
var PageAssembler_default = PageAssembler;
|
|
2646
2654
|
|
|
2647
|
-
export { Button, FormFieldType, PageAssembler, addFormFieldsToPdf, createPdfBlobUrl,
|
|
2655
|
+
export { Button, FormFieldType, PageAssembler, addFormFieldsToPdf, createPdfBlobUrl, downloadPdf, extractFieldsFromPdf, getSigniphiMetadata, imageToPdf, mapFieldPositionsAfterAssembly, pdfToImages, setSigniphiMetadata };
|
|
2648
2656
|
//# sourceMappingURL=index.mjs.map
|
|
2649
2657
|
//# sourceMappingURL=index.mjs.map
|