@dmitryvim/form-builder 0.1.39 → 0.1.40
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/form-builder.js +41 -12
- package/package.json +1 -1
package/dist/form-builder.js
CHANGED
|
@@ -2658,7 +2658,7 @@ function addPrefillFilesToIndex(initialFiles) {
|
|
|
2658
2658
|
if (!state.resourceIndex.has(resourceId)) {
|
|
2659
2659
|
// Extract filename from URL/path
|
|
2660
2660
|
const filename = resourceId.split("/").pop() || "file";
|
|
2661
|
-
// Determine file type from extension
|
|
2661
|
+
// Determine file type from extension (excluding PSD from image types)
|
|
2662
2662
|
const extension = filename.split(".").pop()?.toLowerCase();
|
|
2663
2663
|
const fileType =
|
|
2664
2664
|
extension && ["jpg", "jpeg", "png", "gif", "webp"].includes(extension)
|
|
@@ -3079,19 +3079,31 @@ function renderFilePreviewReadonly(resourceId, fileName) {
|
|
|
3079
3079
|
const actualFileName =
|
|
3080
3080
|
fileName || meta?.name || resourceId.split("/").pop() || "file";
|
|
3081
3081
|
|
|
3082
|
+
// Determine if this looks like a PSD file (should be treated as download, not preview)
|
|
3083
|
+
const isPSD = actualFileName.toLowerCase().match(/\.psd$/);
|
|
3084
|
+
|
|
3082
3085
|
// Individual file result container
|
|
3083
3086
|
const fileResult = document.createElement("div");
|
|
3084
|
-
fileResult.className = "space-y-3";
|
|
3087
|
+
fileResult.className = isPSD ? "space-y-2" : "space-y-3";
|
|
3085
3088
|
|
|
3086
|
-
//
|
|
3089
|
+
// Preview container - compact for PSD files, large for others
|
|
3087
3090
|
const previewContainer = document.createElement("div");
|
|
3088
|
-
|
|
3089
|
-
|
|
3091
|
+
if (isPSD) {
|
|
3092
|
+
// Compact container for PSD files
|
|
3093
|
+
previewContainer.className =
|
|
3094
|
+
"bg-gray-100 rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity flex items-center p-3 max-w-sm";
|
|
3095
|
+
} else {
|
|
3096
|
+
// Large container for images/videos
|
|
3097
|
+
previewContainer.className =
|
|
3098
|
+
"bg-gray-100 rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity";
|
|
3099
|
+
}
|
|
3090
3100
|
|
|
3091
|
-
// Determine if this looks like an image file
|
|
3101
|
+
// Determine if this looks like an image file (excluding PSD files)
|
|
3092
3102
|
const isImage =
|
|
3093
|
-
|
|
3094
|
-
|
|
3103
|
+
!isPSD && (
|
|
3104
|
+
meta?.type?.startsWith("image/") ||
|
|
3105
|
+
actualFileName.toLowerCase().match(/\.(jpg|jpeg|png|gif|webp)$/)
|
|
3106
|
+
);
|
|
3095
3107
|
|
|
3096
3108
|
// Determine if this looks like a video file
|
|
3097
3109
|
const isVideo =
|
|
@@ -3148,13 +3160,30 @@ function renderFilePreviewReadonly(resourceId, fileName) {
|
|
|
3148
3160
|
previewContainer.innerHTML = `<div class="aspect-video flex items-center justify-center text-gray-400"><div class="text-center"><div class="text-4xl mb-2">🎥</div><div class="text-sm">${actualFileName}</div></div></div>`;
|
|
3149
3161
|
}
|
|
3150
3162
|
} else {
|
|
3151
|
-
// Other file types
|
|
3152
|
-
|
|
3163
|
+
// Other file types - special handling for PSD files
|
|
3164
|
+
const fileIcon = isPSD ? "🎨" : "📁";
|
|
3165
|
+
const fileDescription = isPSD ? "PSD File" : "Document";
|
|
3166
|
+
|
|
3167
|
+
if (isPSD) {
|
|
3168
|
+
// Compact horizontal layout for PSD files
|
|
3169
|
+
previewContainer.innerHTML = `
|
|
3170
|
+
<div class="flex items-center space-x-3">
|
|
3171
|
+
<div class="text-3xl text-gray-400">${fileIcon}</div>
|
|
3172
|
+
<div class="flex-1 min-w-0">
|
|
3173
|
+
<div class="text-sm font-medium text-gray-900 truncate">${actualFileName}</div>
|
|
3174
|
+
<div class="text-xs text-gray-500">${fileDescription}</div>
|
|
3175
|
+
</div>
|
|
3176
|
+
</div>
|
|
3177
|
+
`;
|
|
3178
|
+
} else {
|
|
3179
|
+
// Large centered layout for other documents
|
|
3180
|
+
previewContainer.innerHTML = `<div class="aspect-video flex items-center justify-center text-gray-400"><div class="text-center"><div class="text-4xl mb-2">${fileIcon}</div><div class="text-sm">${actualFileName}</div><div class="text-xs text-gray-500 mt-1">${fileDescription}</div></div></div>`;
|
|
3181
|
+
}
|
|
3153
3182
|
}
|
|
3154
3183
|
|
|
3155
|
-
// File name
|
|
3184
|
+
// File name (only show for non-PSD files since PSD files show name inline)
|
|
3156
3185
|
const fileNameElement = document.createElement("p");
|
|
3157
|
-
fileNameElement.className = "text-sm font-medium text-gray-900 text-center";
|
|
3186
|
+
fileNameElement.className = isPSD ? "hidden" : "text-sm font-medium text-gray-900 text-center";
|
|
3158
3187
|
fileNameElement.textContent = actualFileName;
|
|
3159
3188
|
|
|
3160
3189
|
// Download button
|