@unvired/turboforms-embed-sdk 2.0.54 → 2.0.56
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.ts +22 -2
- package/dist/turboforms.esm.js +23 -14
- package/dist/turboforms.html +151 -3
- package/dist/turboforms.js +23 -14
- package/package.json +1 -1
package/dist/turboforms.html
CHANGED
|
@@ -2444,7 +2444,6 @@
|
|
|
2444
2444
|
width: 200px;
|
|
2445
2445
|
z-index: 1050;
|
|
2446
2446
|
padding: 8px 0;
|
|
2447
|
-
overflow: hidden;
|
|
2448
2447
|
animation: sdkFadeInUp 0.2s ease-out;
|
|
2449
2448
|
display: none;
|
|
2450
2449
|
flex-direction: column;
|
|
@@ -41867,6 +41866,93 @@ async function loadTRform(
|
|
|
41867
41866
|
document.dispatchEvent(new CustomEvent("LessRenderingComplete"));
|
|
41868
41867
|
|
|
41869
41868
|
window.formObj = formObj;
|
|
41869
|
+
|
|
41870
|
+
// Setup language dropdown if translations are provided
|
|
41871
|
+
if (window.FORMIO_I18N && Object.keys(window.FORMIO_I18N).length > 0) {
|
|
41872
|
+
const languageSubMenu = document.getElementById('languageSubMenu');
|
|
41873
|
+
const langMainOption = document.getElementById('languageMainOption');
|
|
41874
|
+
const langDivider = document.getElementById('languageDivider');
|
|
41875
|
+
|
|
41876
|
+
if (languageSubMenu && langMainOption) {
|
|
41877
|
+
languageSubMenu.innerHTML = '';
|
|
41878
|
+
|
|
41879
|
+
let languages = Object.keys(window.FORMIO_I18N).filter(lang =>
|
|
41880
|
+
typeof window.FORMIO_I18N[lang] === 'object' && window.FORMIO_I18N[lang] !== null
|
|
41881
|
+
);
|
|
41882
|
+
const currentLang = window.FORMIO_LANGUAGE || 'en';
|
|
41883
|
+
if (!languages.includes(currentLang) && typeof window.FORMIO_I18N[currentLang] === 'object') {
|
|
41884
|
+
languages.unshift(currentLang);
|
|
41885
|
+
}
|
|
41886
|
+
|
|
41887
|
+
const displayNames = new Intl.DisplayNames(['en'], { type: 'language' });
|
|
41888
|
+
|
|
41889
|
+
languages.forEach(lang => {
|
|
41890
|
+
const optionDiv = document.createElement('div');
|
|
41891
|
+
optionDiv.className = langMainOption.className;
|
|
41892
|
+
optionDiv.style.cursor = 'pointer';
|
|
41893
|
+
optionDiv.style.padding = '0.5rem 1rem';
|
|
41894
|
+
optionDiv.style.borderTop = 'none';
|
|
41895
|
+
|
|
41896
|
+
let displayName = lang.toUpperCase();
|
|
41897
|
+
try {
|
|
41898
|
+
displayName = displayNames.of(lang) || displayName;
|
|
41899
|
+
} catch (e) {
|
|
41900
|
+
// Fallback if the language code is invalid
|
|
41901
|
+
}
|
|
41902
|
+
|
|
41903
|
+
let iconHTML = lang === currentLang ? '<i class="bi bi-check2 text-primary" style="margin-right: 8px;"></i>' : '<i class="bi bi-check2" style="margin-right: 8px; visibility: hidden;"></i>';
|
|
41904
|
+
if (langMainOption.innerHTML.includes('icon chevron')) {
|
|
41905
|
+
iconHTML = lang === currentLang ? '<i class="icon check" style="margin-right: 8px;"></i>' : '<i class="icon check" style="margin-right: 8px; visibility: hidden;"></i>';
|
|
41906
|
+
}
|
|
41907
|
+
|
|
41908
|
+
optionDiv.innerHTML = `${iconHTML}${displayName}`;
|
|
41909
|
+
|
|
41910
|
+
optionDiv.onclick = function(e) {
|
|
41911
|
+
e.stopPropagation();
|
|
41912
|
+
if (window.changeFormLanguage) {
|
|
41913
|
+
window.changeFormLanguage(lang);
|
|
41914
|
+
window.FORMIO_LANGUAGE = lang;
|
|
41915
|
+
}
|
|
41916
|
+
|
|
41917
|
+
const children = languageSubMenu.children;
|
|
41918
|
+
for (let i = 0; i < children.length; i++) {
|
|
41919
|
+
const child = children[i];
|
|
41920
|
+
const icon = child.querySelector('i');
|
|
41921
|
+
if (icon) {
|
|
41922
|
+
if (languages[i] === lang) {
|
|
41923
|
+
icon.style.visibility = 'visible';
|
|
41924
|
+
if (icon.className.includes('bi')) icon.classList.add('text-primary');
|
|
41925
|
+
} else {
|
|
41926
|
+
icon.style.visibility = 'hidden';
|
|
41927
|
+
if (icon.className.includes('bi')) icon.classList.remove('text-primary');
|
|
41928
|
+
}
|
|
41929
|
+
}
|
|
41930
|
+
}
|
|
41931
|
+
|
|
41932
|
+
if (window.toggleLanguageSubMenu) window.toggleLanguageSubMenu();
|
|
41933
|
+
|
|
41934
|
+
if (window.showToast) {
|
|
41935
|
+
window.showToast(`Language set to ${displayName}`, 'success');
|
|
41936
|
+
}
|
|
41937
|
+
};
|
|
41938
|
+
|
|
41939
|
+
languageSubMenu.appendChild(optionDiv);
|
|
41940
|
+
});
|
|
41941
|
+
|
|
41942
|
+
if (languages.length > 1) {
|
|
41943
|
+
langMainOption.style.display = langMainOption.className.includes('d-flex') ? 'flex' : 'block';
|
|
41944
|
+
if (langDivider) langDivider.style.display = 'block';
|
|
41945
|
+
} else {
|
|
41946
|
+
langMainOption.style.display = 'none';
|
|
41947
|
+
if (langDivider) langDivider.style.display = 'none';
|
|
41948
|
+
}
|
|
41949
|
+
}
|
|
41950
|
+
} else {
|
|
41951
|
+
const langMainOption = document.getElementById('languageMainOption');
|
|
41952
|
+
const langDivider = document.getElementById('languageDivider');
|
|
41953
|
+
if (langMainOption) langMainOption.style.display = 'none';
|
|
41954
|
+
if (langDivider) langDivider.style.display = 'none';
|
|
41955
|
+
}
|
|
41870
41956
|
if (!formObj) {
|
|
41871
41957
|
logger.error("[TF_SDK:299] ❌ Form not initialized.");
|
|
41872
41958
|
return;
|
|
@@ -43110,7 +43196,7 @@ window.CommentOnBack = CommentOnBack;
|
|
|
43110
43196
|
|
|
43111
43197
|
|
|
43112
43198
|
<div id="sticky-footer">
|
|
43113
|
-
<div class="build-version">SDK v2.0.
|
|
43199
|
+
<div class="build-version">SDK v2.0.56</div>
|
|
43114
43200
|
<div class="relative-position">
|
|
43115
43201
|
<button id="unvired-more-btn" class="ui button primary dataGrid-addRow" onclick="toggleTooltip()">
|
|
43116
43202
|
<i class="icon options"></i>
|
|
@@ -43122,7 +43208,9 @@ window.CommentOnBack = CommentOnBack;
|
|
|
43122
43208
|
<div class="divider"></div>
|
|
43123
43209
|
<div class="item" onclick="setTimeout(() => loadComments(), 200)">Comments</div>
|
|
43124
43210
|
<div class="divider"></div>
|
|
43125
|
-
<div class="item" onclick="openHelpLink()">Help</div>
|
|
43211
|
+
<div class="item" id="help-item" onclick="openHelpLink()">Help</div>
|
|
43212
|
+
<div class="divider" id="languageDivider" style="display: none;"></div>
|
|
43213
|
+
<div class="item" id="languageMainOption" style="display: none; cursor: pointer;" onclick="openLanguageModal()">Language</div>
|
|
43126
43214
|
</div>
|
|
43127
43215
|
</div>
|
|
43128
43216
|
|
|
@@ -43138,7 +43226,61 @@ window.CommentOnBack = CommentOnBack;
|
|
|
43138
43226
|
</button>
|
|
43139
43227
|
</div>
|
|
43140
43228
|
|
|
43229
|
+
<div id="languageModalOverlay" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1040; backdrop-filter: blur(2px);" onclick="closeLanguageModal()"></div>
|
|
43230
|
+
<div id="languageModal" style="display: none; position: fixed; top: 15%; left: 50%; transform: translate(-50%, 0); z-index: 1050; background: var(--tf-app-card-bg, #ffffff); color: var(--tf-app-label-color, #333); padding: 24px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); width: 90%; max-width: 400px; pointer-events: auto; font-family: var(--tf-app-font-family, inherit);">
|
|
43231
|
+
<style>
|
|
43232
|
+
#languageModal .choices { margin-bottom: 0; }
|
|
43233
|
+
#languageModal .choices__inner {
|
|
43234
|
+
display: flex;
|
|
43235
|
+
align-items: center;
|
|
43236
|
+
padding: 0 16px;
|
|
43237
|
+
min-height: 44px;
|
|
43238
|
+
border-radius: 8px;
|
|
43239
|
+
background-color: var(--tf-app-bg-color, #fff);
|
|
43240
|
+
border: 1px solid var(--tf-border-color, #ced4da);
|
|
43241
|
+
}
|
|
43242
|
+
#languageModal .choices__list--single { padding: 0; }
|
|
43243
|
+
#languageModal .choices[data-type*=select-one]::after { margin-top: -6px; }
|
|
43244
|
+
</style>
|
|
43245
|
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
|
|
43246
|
+
<h3 style="margin: 0; font-weight: 600; font-size: calc(var(--tf-app-font-size-base, 14px) + 2px);">Select Language</h3>
|
|
43247
|
+
<span style="cursor:pointer; font-weight: bold; font-size: 1.2rem; color: var(--tf-app-label-color, #333);" onclick="closeLanguageModal()">X</span>
|
|
43248
|
+
</div>
|
|
43249
|
+
<div style="margin-bottom: 20px; margin-top: 10px;">
|
|
43250
|
+
<select id="modalLanguageSelector" style="width: 100%; border: 1px solid var(--tf-border-color, #ced4da); border-radius: 8px; padding: 0.6rem 1rem; font-size: var(--tf-app-font-size-base, 14px); background-color: var(--tf-app-bg-color, #fff); color: var(--tf-app-label-color, #333); cursor: pointer; box-shadow: none;">
|
|
43251
|
+
</select>
|
|
43252
|
+
</div>
|
|
43253
|
+
<div style="text-align: right;">
|
|
43254
|
+
<button style="padding: 0.5rem 1rem; margin-right: 10px; border: 1px solid #6c757d; background: transparent; color: #6c757d; cursor: pointer; border-radius: 8px; font-size: var(--tf-app-font-size-base, 14px);" onclick="closeLanguageModal()">Cancel</button>
|
|
43255
|
+
<button style="padding: 0.5rem 1rem; background-color: var(--tf-primary-color, #2185d0); color: var(--tf-secondary-color, #fff); border: 1px solid var(--tf-primary-color, #2185d0); cursor: pointer; border-radius: 8px; font-size: var(--tf-app-font-size-base, 14px);" onclick="applyLanguage()">Apply</button>
|
|
43256
|
+
</div>
|
|
43257
|
+
</div>
|
|
43258
|
+
|
|
43141
43259
|
<script>
|
|
43260
|
+
window.openLanguageModal = function () {
|
|
43261
|
+
const tooltip = document.getElementById("moreTooltip");
|
|
43262
|
+
if (tooltip) tooltip.style.display = "none";
|
|
43263
|
+
const overlay = document.getElementById("languageModalOverlay");
|
|
43264
|
+
if (overlay) overlay.style.display = "block";
|
|
43265
|
+
const modal = document.getElementById("languageModal");
|
|
43266
|
+
if (modal) modal.style.display = "block";
|
|
43267
|
+
};
|
|
43268
|
+
|
|
43269
|
+
window.closeLanguageModal = function () {
|
|
43270
|
+
const overlay = document.getElementById("languageModalOverlay");
|
|
43271
|
+
if (overlay) overlay.style.display = "none";
|
|
43272
|
+
const modal = document.getElementById("languageModal");
|
|
43273
|
+
if (modal) modal.style.display = "none";
|
|
43274
|
+
};
|
|
43275
|
+
|
|
43276
|
+
window.applyLanguage = function () {
|
|
43277
|
+
const select = document.getElementById("modalLanguageSelector");
|
|
43278
|
+
if (select && window.changeFormLanguage) {
|
|
43279
|
+
window.changeFormLanguage(select.value);
|
|
43280
|
+
}
|
|
43281
|
+
window.closeLanguageModal();
|
|
43282
|
+
};
|
|
43283
|
+
|
|
43142
43284
|
function toggleTooltip() {
|
|
43143
43285
|
try {
|
|
43144
43286
|
const tooltip = document.getElementById('moreTooltip');
|
|
@@ -43150,6 +43292,12 @@ window.CommentOnBack = CommentOnBack;
|
|
|
43150
43292
|
}
|
|
43151
43293
|
}
|
|
43152
43294
|
|
|
43295
|
+
function changeFormLanguage(lang) {
|
|
43296
|
+
if (window.formObj) {
|
|
43297
|
+
window.formObj.language = lang;
|
|
43298
|
+
}
|
|
43299
|
+
}
|
|
43300
|
+
|
|
43153
43301
|
function openHelpLink() {
|
|
43154
43302
|
try {
|
|
43155
43303
|
const helpUrl = 'https://docs.unvired.com/formsapp/formfill/';
|