@unvired/turboforms-embed-sdk 2.0.63 → 2.0.64
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/turboforms.esm.js +3 -3
- package/dist/turboforms.html +29 -9
- package/dist/turboforms.js +3 -3
- package/package.json +1 -1
package/dist/turboforms.html
CHANGED
|
@@ -30786,8 +30786,16 @@ class SmartFileComponent extends FieldComponent {
|
|
|
30786
30786
|
: this.t('Preparing file to remove'),
|
|
30787
30787
|
});
|
|
30788
30788
|
|
|
30789
|
-
const index = this.dataValue.findIndex((file) =>
|
|
30790
|
-
|
|
30789
|
+
const index = this.dataValue.findIndex((file) =>
|
|
30790
|
+
file === fileInfo ||
|
|
30791
|
+
(file.id && file.id === fileInfo.id) ||
|
|
30792
|
+
(file.name && file.name === fileInfo.name)
|
|
30793
|
+
);
|
|
30794
|
+
if (index !== -1) {
|
|
30795
|
+
this.splice(index);
|
|
30796
|
+
} else {
|
|
30797
|
+
logger.warn(`[TF_SDK:102b] ⚠️ Could not find file to delete in dataValue:`, fileInfo);
|
|
30798
|
+
}
|
|
30791
30799
|
this.redraw();
|
|
30792
30800
|
}
|
|
30793
30801
|
|
|
@@ -40556,17 +40564,30 @@ function processFilePreviewsAndErrors(comp) {
|
|
|
40556
40564
|
e.preventDefault();
|
|
40557
40565
|
e.stopPropagation();
|
|
40558
40566
|
|
|
40567
|
+
// Resolve current image src dynamically at click time
|
|
40568
|
+
let currentImgSrc = "";
|
|
40569
|
+
const previewImg = row.querySelector('.file-preview-img, [ref="fileImage"]');
|
|
40570
|
+
if (previewImg && previewImg.src) {
|
|
40571
|
+
currentImgSrc = previewImg.src;
|
|
40572
|
+
} else {
|
|
40573
|
+
const link = row.querySelector('a');
|
|
40574
|
+
const imageExtensionPattern = /\.(jpg|jpeg|png|gif|webp|svg)$/i;
|
|
40575
|
+
if (link && link.href && (imageExtensionPattern.test(link.href) || link.href.startsWith('data:image'))) {
|
|
40576
|
+
currentImgSrc = link.href;
|
|
40577
|
+
}
|
|
40578
|
+
}
|
|
40579
|
+
|
|
40559
40580
|
// 🖼️ Custom Preview Integration
|
|
40560
|
-
if (iconCfg.title === 'Preview' &&
|
|
40581
|
+
if (iconCfg.title === 'Preview' && currentImgSrc && typeof window.openImagePreviewModal === 'function') {
|
|
40561
40582
|
const fileName = row.querySelector('a')?.textContent?.trim() || 'File Preview';
|
|
40562
|
-
window.openImagePreviewModal(
|
|
40583
|
+
window.openImagePreviewModal(currentImgSrc, fileName);
|
|
40563
40584
|
return;
|
|
40564
40585
|
}
|
|
40565
40586
|
|
|
40566
40587
|
// ✂️ Custom Crop Integration
|
|
40567
|
-
if (iconCfg.title === 'Edit' &&
|
|
40588
|
+
if (iconCfg.title === 'Edit' && currentImgSrc && typeof cropro !== 'undefined') {
|
|
40568
40589
|
const tempImg = new Image();
|
|
40569
|
-
tempImg.src =
|
|
40590
|
+
tempImg.src = currentImgSrc;
|
|
40570
40591
|
tempImg.style.position = 'fixed';
|
|
40571
40592
|
tempImg.style.visibility = 'hidden';
|
|
40572
40593
|
tempImg.style.pointerEvents = 'none';
|
|
@@ -40578,7 +40599,6 @@ function processFilePreviewsAndErrors(comp) {
|
|
|
40578
40599
|
cropArea.renderAtNaturalSize = true;
|
|
40579
40600
|
cropArea.popupMargin = 60; // Increase margin to reduce modal size
|
|
40580
40601
|
|
|
40581
|
-
// Apply Custom Theme Colors to Crop Area
|
|
40582
40602
|
// Apply Custom Theme Colors to Crop Area
|
|
40583
40603
|
if (cropArea.styles && cropArea.styles.settings && comp.closest('.tf-embed-sdk')) {
|
|
40584
40604
|
const computedStyle = getComputedStyle(comp);
|
|
@@ -40636,7 +40656,7 @@ function processFilePreviewsAndErrors(comp) {
|
|
|
40636
40656
|
// Default: Dispatch custom event for app-level integration
|
|
40637
40657
|
|
|
40638
40658
|
const customEvent = new CustomEvent(`formio-file-action`, {
|
|
40639
|
-
detail: { element: comp, icon: iconCfg, row: row, imgSrc:
|
|
40659
|
+
detail: { element: comp, icon: iconCfg, row: row, imgSrc: currentImgSrc },
|
|
40640
40660
|
bubbles: true
|
|
40641
40661
|
});
|
|
40642
40662
|
actionBtn.dispatchEvent(customEvent);
|
|
@@ -41642,7 +41662,7 @@ initThemeHook();
|
|
|
41642
41662
|
</div>
|
|
41643
41663
|
|
|
41644
41664
|
<div id="sticky-footer">
|
|
41645
|
-
<div class="build-version">SDK v2.0.
|
|
41665
|
+
<div class="build-version">SDK v2.0.64</div>
|
|
41646
41666
|
|
|
41647
41667
|
<button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
|
|
41648
41668
|
<i class="bi bi-chevron-left"></i> Previous
|