@unvired/turboforms-embed-sdk 1.0.22 → 1.0.23
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/README.md +15 -1
- package/dist/unvired-form-sdk.html +30 -2
- package/dist/unvired-forms-sdk.js +265 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -251,7 +251,9 @@ document.addEventListener('deviceready', function() {
|
|
|
251
251
|
| `GET_ATTACHMENT` | Attachment request |
|
|
252
252
|
| `ERROR` | Error occurred |
|
|
253
253
|
|
|
254
|
-
## ✅ Button Visibility & Enablement
|
|
254
|
+
## ✅ Button Visibility & Enablement (Normal Forms)
|
|
255
|
+
|
|
256
|
+
The following rules apply to standard (non-wizard) forms:
|
|
255
257
|
|
|
256
258
|
| privateExternal | Permission | Main Toolbar Button | More Options (Dropdown) | Enable / Disable Rule |
|
|
257
259
|
| ------------------ | --------------- | -------------------------- | ------------------------------- | -------------------------------------------------- |
|
|
@@ -261,6 +263,18 @@ document.addEventListener('deviceready', function() {
|
|
|
261
263
|
| **true (Private)** | `writesingle` | **Complete** (`submitBtn`) | **Save** (`saveOption`) | Complete enabled **ONLY when form is 100% filled** |
|
|
262
264
|
| **Any** | `read` | None | None | N/A (Read-only mode) |
|
|
263
265
|
|
|
266
|
+
## 🧙 Wizard Form Navigation & Visibility
|
|
267
|
+
|
|
268
|
+
For Wizard forms, the standard action buttons are managed per-page to prioritize navigation:
|
|
269
|
+
|
|
270
|
+
| Page Status | Action Buttons (Save/Complete) | Navigation Buttons | Action Menu (More Options) |
|
|
271
|
+
| :--- | :--- | :--- | :--- |
|
|
272
|
+
| **Intermediate Steps** | **Hidden** | **Previous**, **Next** | **Help** / **Comments** (if enabled) |
|
|
273
|
+
| **Final Step** | **Visible** (Follows standard rules above) | **Previous** | **All Actions** (Follows standard rules above) |
|
|
274
|
+
|
|
275
|
+
* **Intermediate Steps**: To ensure a clean experience, the SDK automatically hides all final submission actions (buttons, icons, and "More" dropdown items) until the user reaches the end of the wizard.
|
|
276
|
+
* **Final Step**: Once the user reaches the last page, the standard logic defined in the table above is applied. The **Next** button is replaced by the appropriate **Save** or **Complete** action based on permissions and form state.
|
|
277
|
+
|
|
264
278
|
## 🧭 “More Options” Dropdown Logic
|
|
265
279
|
|
|
266
280
|
### ▶ **Complete appears in More Options**
|
|
@@ -56365,6 +56365,11 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
56365
56365
|
}
|
|
56366
56366
|
if (this.refs.clicktoSign) {
|
|
56367
56367
|
this.refs.clicktoSign.disabled = true;
|
|
56368
|
+
this.refs.clicktoSign.style.pointerEvents = 'none';
|
|
56369
|
+
this.refs.clicktoSign.style.display = 'none';
|
|
56370
|
+
|
|
56371
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
56372
|
+
if(clickBox) clickBox.style.display = 'none';
|
|
56368
56373
|
}
|
|
56369
56374
|
if (this.refs.signatureImage && this.dataValue) {
|
|
56370
56375
|
this.refs.signatureImage.setAttribute('src', this.dataValue);
|
|
@@ -56376,6 +56381,12 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
56376
56381
|
}
|
|
56377
56382
|
if (this.refs.clicktoSign) {
|
|
56378
56383
|
this.refs.clicktoSign.disabled = false;
|
|
56384
|
+
this.refs.clicktoSign.style.pointerEvents = 'auto';
|
|
56385
|
+
if (this.component.isEnableClicktoSign) {
|
|
56386
|
+
this.refs.clicktoSign.style.display = 'inline-flex';
|
|
56387
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
56388
|
+
if(clickBox) clickBox.style.display = '';
|
|
56389
|
+
}
|
|
56379
56390
|
}
|
|
56380
56391
|
}
|
|
56381
56392
|
}
|
|
@@ -56447,6 +56458,11 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
56447
56458
|
this.refs.refresh.classList.add('disabled');
|
|
56448
56459
|
if (this.refs.clicktoSign) {
|
|
56449
56460
|
this.refs.clicktoSign.disabled = true;
|
|
56461
|
+
this.refs.clicktoSign.style.pointerEvents = 'none';
|
|
56462
|
+
this.refs.clicktoSign.style.display = 'none';
|
|
56463
|
+
|
|
56464
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
56465
|
+
if(clickBox) clickBox.style.display = 'none';
|
|
56450
56466
|
}
|
|
56451
56467
|
}
|
|
56452
56468
|
|
|
@@ -59996,7 +60012,7 @@ async function renderRNform(
|
|
|
59996
60012
|
}
|
|
59997
60013
|
|
|
59998
60014
|
// Hide FormIO submit button component and wizard buttons in readOnly mode
|
|
59999
|
-
if (mode == "readOnly") {
|
|
60015
|
+
if (mode == "readOnly" || permission == "read") {
|
|
60000
60016
|
const submitComponents = document.querySelectorAll(
|
|
60001
60017
|
".formio-component-submit"
|
|
60002
60018
|
);
|
|
@@ -60004,6 +60020,18 @@ async function renderRNform(
|
|
|
60004
60020
|
component.style.display = "none";
|
|
60005
60021
|
});
|
|
60006
60022
|
|
|
60023
|
+
// Disable signature pads robustly via CSS
|
|
60024
|
+
if (!document.getElementById("readonly-signature-style")) {
|
|
60025
|
+
const style = document.createElement("style");
|
|
60026
|
+
style.id = "readonly-signature-style";
|
|
60027
|
+
style.innerHTML = `
|
|
60028
|
+
.formio-component-signature { pointer-events: none !important; }
|
|
60029
|
+
.formio-component-signature [ref="clicktoSign"],
|
|
60030
|
+
.formio-component-signature .click-to-sign-box { display: none !important; }
|
|
60031
|
+
`;
|
|
60032
|
+
document.head.appendChild(style);
|
|
60033
|
+
}
|
|
60034
|
+
|
|
60007
60035
|
// Hide wizard navigation buttons
|
|
60008
60036
|
const wizardNextBtns = document.querySelectorAll(
|
|
60009
60037
|
".btn-wizard-nav-next"
|
|
@@ -60687,7 +60715,7 @@ window.CommentOnBack = CommentOnBack;
|
|
|
60687
60715
|
|
|
60688
60716
|
|
|
60689
60717
|
<div id="sticky-footer">
|
|
60690
|
-
<div class="build-version">SDK v1.0.
|
|
60718
|
+
<div class="build-version">SDK v1.0.23</div>
|
|
60691
60719
|
<div class="relative-position">
|
|
60692
60720
|
<button id="unvired-more-btn" class="ui button primary dataGrid-addRow" onclick="toggleTooltip()">
|
|
60693
60721
|
<i class="icon options"></i>
|
|
@@ -27922,14 +27922,20 @@ select.ui.dropdown {
|
|
|
27922
27922
|
<div id="formio-cmt" style="margin-bottom: 20px;"></div>
|
|
27923
27923
|
</div>
|
|
27924
27924
|
<div id="sticky-footer">
|
|
27925
|
-
<div class="build-version">SDK v1.0.
|
|
27925
|
+
<div class="build-version">SDK v1.0.23</div>
|
|
27926
27926
|
<button class="ui button primary dataGrid-addRow" id="saveBtn" disabled="true" onclick="FormOnSave()">
|
|
27927
27927
|
<i class="icon save large"></i>Save
|
|
27928
27928
|
</button>
|
|
27929
|
+
<button class="ui button secondary dataGrid-addRow" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
|
|
27930
|
+
<i class="icon arrow left"></i>Previous
|
|
27931
|
+
</button>
|
|
27932
|
+
<button class="ui button primary dataGrid-addRow" id="nextBtn" style="display:none" onclick="FormOnNext()">
|
|
27933
|
+
Next<i class="icon arrow right"></i>
|
|
27934
|
+
</button>
|
|
27929
27935
|
<button class="ui button primary dataGrid-addRow" id="submitBtn" style="display:none" onclick="FormOnSubmit()">
|
|
27930
27936
|
<i class="icon save large"></i>Submit
|
|
27931
27937
|
</button>
|
|
27932
|
-
|
|
27938
|
+
|
|
27933
27939
|
<!-- Quick Action Buttons -->
|
|
27934
27940
|
<div id="quick-actions" style="display: flex; align-items: center;">
|
|
27935
27941
|
<i id="quickCompleteBtn" class="icon clipboard check large" style="display:none; cursor: pointer; margin: 0 10px;" onclick="FormOnSubmit()" title="Complete"></i>
|
|
@@ -28078,6 +28084,16 @@ select.ui.dropdown {
|
|
|
28078
28084
|
window.formOnSubmitFunction();
|
|
28079
28085
|
}
|
|
28080
28086
|
};
|
|
28087
|
+
window.FormOnNext = window.FormOnNext || function() {
|
|
28088
|
+
if (typeof window.formOnNextFunction === "function") {
|
|
28089
|
+
window.formOnNextFunction();
|
|
28090
|
+
}
|
|
28091
|
+
};
|
|
28092
|
+
window.FormOnPrevious = window.FormOnPrevious || function() {
|
|
28093
|
+
if (typeof window.formOnPreviousFunction === "function") {
|
|
28094
|
+
window.formOnPreviousFunction();
|
|
28095
|
+
}
|
|
28096
|
+
};
|
|
28081
28097
|
const scriptContents = `
|
|
28082
28098
|
// Global variable initialization
|
|
28083
28099
|
window.form = window.form || {};
|
|
@@ -63598,6 +63614,11 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
63598
63614
|
}
|
|
63599
63615
|
if (this.refs.clicktoSign) {
|
|
63600
63616
|
this.refs.clicktoSign.disabled = true;
|
|
63617
|
+
this.refs.clicktoSign.style.pointerEvents = 'none';
|
|
63618
|
+
this.refs.clicktoSign.style.display = 'none';
|
|
63619
|
+
|
|
63620
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
63621
|
+
if(clickBox) clickBox.style.display = 'none';
|
|
63601
63622
|
}
|
|
63602
63623
|
if (this.refs.signatureImage && this.dataValue) {
|
|
63603
63624
|
this.refs.signatureImage.setAttribute('src', this.dataValue);
|
|
@@ -63609,6 +63630,12 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
63609
63630
|
}
|
|
63610
63631
|
if (this.refs.clicktoSign) {
|
|
63611
63632
|
this.refs.clicktoSign.disabled = false;
|
|
63633
|
+
this.refs.clicktoSign.style.pointerEvents = 'auto';
|
|
63634
|
+
if (this.component.isEnableClicktoSign) {
|
|
63635
|
+
this.refs.clicktoSign.style.display = 'inline-flex';
|
|
63636
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
63637
|
+
if(clickBox) clickBox.style.display = '';
|
|
63638
|
+
}
|
|
63612
63639
|
}
|
|
63613
63640
|
}
|
|
63614
63641
|
}
|
|
@@ -63680,6 +63707,11 @@ class SignatureComponent extends InputComponentForSignature {
|
|
|
63680
63707
|
this.refs.refresh.classList.add('disabled');
|
|
63681
63708
|
if (this.refs.clicktoSign) {
|
|
63682
63709
|
this.refs.clicktoSign.disabled = true;
|
|
63710
|
+
this.refs.clicktoSign.style.pointerEvents = 'none';
|
|
63711
|
+
this.refs.clicktoSign.style.display = 'none';
|
|
63712
|
+
|
|
63713
|
+
const clickBox = this.refs.clicktoSign.closest('.click-to-sign-box');
|
|
63714
|
+
if(clickBox) clickBox.style.display = 'none';
|
|
63683
63715
|
}
|
|
63684
63716
|
}
|
|
63685
63717
|
|
|
@@ -66567,6 +66599,8 @@ function FormOnBackNavigation() {
|
|
|
66567
66599
|
function initialButtonSetup(privateExternal, permission) {
|
|
66568
66600
|
const saveBtn = document.getElementById("saveBtn");
|
|
66569
66601
|
const submitBtn = document.getElementById("submitBtn");
|
|
66602
|
+
const prevBtn = document.getElementById("prevBtn");
|
|
66603
|
+
const nextBtn = document.getElementById("nextBtn");
|
|
66570
66604
|
const completeOption = document.getElementById("completeOption");
|
|
66571
66605
|
const saveOption = document.getElementById("saveOption");
|
|
66572
66606
|
const completeDivider = document.getElementById("completeDivider");
|
|
@@ -66672,6 +66706,7 @@ function initialButtonSetup(privateExternal, permission) {
|
|
|
66672
66706
|
}
|
|
66673
66707
|
}
|
|
66674
66708
|
|
|
66709
|
+
|
|
66675
66710
|
function onChangeButtonSetup(
|
|
66676
66711
|
completionPercentage,
|
|
66677
66712
|
formData,
|
|
@@ -66680,6 +66715,8 @@ function onChangeButtonSetup(
|
|
|
66680
66715
|
) {
|
|
66681
66716
|
const saveBtn = document.getElementById("saveBtn");
|
|
66682
66717
|
const submitBtn = document.getElementById("submitBtn");
|
|
66718
|
+
const prevBtn = document.getElementById("prevBtn");
|
|
66719
|
+
const nextBtn = document.getElementById("nextBtn");
|
|
66683
66720
|
if (!saveBtn || !submitBtn) return;
|
|
66684
66721
|
|
|
66685
66722
|
const isPrivate = privateExternal === true || privateExternal === "true";
|
|
@@ -67042,6 +67079,11 @@ async function loadRNform(
|
|
|
67042
67079
|
.then(() => {
|
|
67043
67080
|
console.log("[FormIO] \u{1F680} formReady.then() triggered");
|
|
67044
67081
|
|
|
67082
|
+
// Handle Navigation and Button Hiding (Wizard-specific logic separated)
|
|
67083
|
+
if (typeof window.initializeWizardLogic === "function") {
|
|
67084
|
+
window.initializeWizardLogic(formObj, privateExternal, permission);
|
|
67085
|
+
}
|
|
67086
|
+
|
|
67045
67087
|
if (formPreviousData) {
|
|
67046
67088
|
console.log("[FormIO] \u{1F4E6} Previous form data found:", formPreviousData);
|
|
67047
67089
|
|
|
@@ -67063,7 +67105,7 @@ async function loadRNform(
|
|
|
67063
67105
|
console.log("[FormIO] \u2705 Progress calculation completed");
|
|
67064
67106
|
|
|
67065
67107
|
// Hide FormIO submit button component and wizard buttons in readOnly mode
|
|
67066
|
-
if (mode == "readOnly") {
|
|
67108
|
+
if (mode == "readOnly" || permission == "read") {
|
|
67067
67109
|
console.log("[FormIO] \u{1F512} ReadOnly mode detected");
|
|
67068
67110
|
|
|
67069
67111
|
const submitComponents = document.querySelectorAll(
|
|
@@ -67078,41 +67120,17 @@ async function loadRNform(
|
|
|
67078
67120
|
console.log(\`[FormIO] Hidden submit component \${index + 1}\`);
|
|
67079
67121
|
});
|
|
67080
67122
|
|
|
67081
|
-
|
|
67082
|
-
|
|
67083
|
-
|
|
67084
|
-
|
|
67085
|
-
|
|
67086
|
-
|
|
67087
|
-
|
|
67088
|
-
|
|
67089
|
-
|
|
67090
|
-
|
|
67091
|
-
}
|
|
67092
|
-
|
|
67093
|
-
const wizardSubmitBtns = document.querySelectorAll(
|
|
67094
|
-
".btn-wizard-nav-submit"
|
|
67095
|
-
);
|
|
67096
|
-
console.log(
|
|
67097
|
-
\`[FormIO] Found \${wizardSubmitBtns.length} wizard submit buttons\`
|
|
67098
|
-
);
|
|
67099
|
-
|
|
67100
|
-
wizardSubmitBtns.forEach((btn, index) => {
|
|
67101
|
-
btn.style.display = "none";
|
|
67102
|
-
console.log(\`[FormIO] Hidden wizard submit button \${index + 1}\`);
|
|
67103
|
-
});
|
|
67104
|
-
|
|
67105
|
-
const wizardPrevBtns = document.querySelectorAll(
|
|
67106
|
-
".btn-wizard-nav-previous"
|
|
67107
|
-
);
|
|
67108
|
-
console.log(
|
|
67109
|
-
\`[FormIO] Found \${wizardPrevBtns.length} wizard previous buttons\`
|
|
67110
|
-
);
|
|
67111
|
-
|
|
67112
|
-
wizardPrevBtns.forEach((btn, index) => {
|
|
67113
|
-
btn.style.display = "none";
|
|
67114
|
-
console.log(\`[FormIO] Hidden wizard previous button \${index + 1}\`);
|
|
67115
|
-
});
|
|
67123
|
+
// Disable signature components robustly via CSS
|
|
67124
|
+
if (!document.getElementById("readonly-signature-style")) {
|
|
67125
|
+
const style = document.createElement("style");
|
|
67126
|
+
style.id = "readonly-signature-style";
|
|
67127
|
+
style.innerHTML = \`
|
|
67128
|
+
.formio-component-signature { pointer-events: none !important; }
|
|
67129
|
+
.formio-component-signature [ref="clicktoSign"],
|
|
67130
|
+
.formio-component-signature .click-to-sign-box { display: none !important; }
|
|
67131
|
+
\`;
|
|
67132
|
+
document.head.appendChild(style);
|
|
67133
|
+
}
|
|
67116
67134
|
} else {
|
|
67117
67135
|
console.log("[FormIO] \u{1F513} Editable mode detected");
|
|
67118
67136
|
}
|
|
@@ -67290,13 +67308,16 @@ function buildMandatoryFieldsCache() {
|
|
|
67290
67308
|
return cache;
|
|
67291
67309
|
}
|
|
67292
67310
|
|
|
67293
|
-
function
|
|
67311
|
+
window.executeProgressCalculation = function(privateExternal, permission) {
|
|
67294
67312
|
if (!formObj) return;
|
|
67295
67313
|
|
|
67296
67314
|
const data = formObj.data || {};
|
|
67297
67315
|
const dataHash = JSON.stringify(data);
|
|
67316
|
+
const isWizard = formObj && !!formObj.wizard;
|
|
67298
67317
|
|
|
67299
|
-
if
|
|
67318
|
+
// For wizards, we must always proceed even if data is same,
|
|
67319
|
+
// because button visibility depends on the current page.
|
|
67320
|
+
if (!isWizard && dataHash === lastDataHash) return;
|
|
67300
67321
|
lastDataHash = dataHash;
|
|
67301
67322
|
|
|
67302
67323
|
const mandatoryFields = buildMandatoryFieldsCache();
|
|
@@ -67398,6 +67419,11 @@ function executeProgressCalculation(privateExternal, permission) {
|
|
|
67398
67419
|
permission
|
|
67399
67420
|
);
|
|
67400
67421
|
|
|
67422
|
+
// After setting up standard button visibility, override with wizard rules if applicable
|
|
67423
|
+
if (typeof window.updateWizardNav === "function") {
|
|
67424
|
+
window.updateWizardNav(formObj);
|
|
67425
|
+
}
|
|
67426
|
+
|
|
67401
67427
|
// Update progress bar
|
|
67402
67428
|
const progressBar = document.getElementById("progress-bar");
|
|
67403
67429
|
if (progressBar) {
|
|
@@ -67740,18 +67766,19 @@ window.checkMoreButtonVisibility = function () {
|
|
|
67740
67766
|
// For documentsOption, its display is managed by logic.
|
|
67741
67767
|
// For comments/help, they are often just static items toggled.
|
|
67742
67768
|
|
|
67743
|
-
const isVisible = (el) =>
|
|
67744
|
-
|
|
67745
|
-
|
|
67746
|
-
|
|
67747
|
-
|
|
67769
|
+
const isVisible = (el, optionKey) => {
|
|
67770
|
+
if (!el) return false;
|
|
67771
|
+
// If it's a static item like Help or Comments, check the options as well
|
|
67772
|
+
if (optionKey && options[optionKey] === true) return true;
|
|
67773
|
+
return el.style.display !== "none";
|
|
67774
|
+
};
|
|
67748
67775
|
|
|
67749
67776
|
const hasVisibleItems =
|
|
67750
67777
|
isVisible(completeOption) ||
|
|
67751
67778
|
isVisible(saveOption) ||
|
|
67752
67779
|
isVisible(documentsOption) ||
|
|
67753
|
-
isVisible(commentsItem) ||
|
|
67754
|
-
isVisible(helpItem); // Simplified: check actual DOM state
|
|
67780
|
+
isVisible(commentsItem, "showComments") ||
|
|
67781
|
+
isVisible(helpItem, "showHelp"); // Simplified: check actual DOM state + options
|
|
67755
67782
|
|
|
67756
67783
|
// If ANY item is visible, show the button. Otherwise hide.
|
|
67757
67784
|
if (hasVisibleItems) {
|
|
@@ -67769,6 +67796,28 @@ window.FormOnSave = FormOnSave;
|
|
|
67769
67796
|
window.FormOnBack = FormOnBack;
|
|
67770
67797
|
window.setImageData = setImageData;
|
|
67771
67798
|
window.FormOnSubmit = FormOnSubmit;
|
|
67799
|
+
window.FormOnNext = function () {
|
|
67800
|
+
if (formObj && typeof formObj.nextPage === "function") {
|
|
67801
|
+
formObj.nextPage().then(() => {
|
|
67802
|
+
if (typeof window.updateWizardNav === "function") {
|
|
67803
|
+
window.updateWizardNav(formObj);
|
|
67804
|
+
}
|
|
67805
|
+
});
|
|
67806
|
+
}
|
|
67807
|
+
};
|
|
67808
|
+
|
|
67809
|
+
window.FormOnPrevious = function () {
|
|
67810
|
+
if (formObj && typeof formObj.prevPage === "function") {
|
|
67811
|
+
formObj.prevPage().then(() => {
|
|
67812
|
+
if (typeof window.updateWizardNav === "function") {
|
|
67813
|
+
window.updateWizardNav(formObj);
|
|
67814
|
+
}
|
|
67815
|
+
});
|
|
67816
|
+
}
|
|
67817
|
+
};
|
|
67818
|
+
|
|
67819
|
+
window.formOnSubmitFunction = FormOnSubmit;
|
|
67820
|
+
|
|
67772
67821
|
window.resetFormCache = resetFormCache;
|
|
67773
67822
|
|
|
67774
67823
|
// Notify that loadRNform is ready (for event-based coordination)
|
|
@@ -67778,6 +67827,174 @@ document.dispatchEvent(new CustomEvent('LoadRNformReady'));
|
|
|
67778
67827
|
|
|
67779
67828
|
// === SCRIPT_SEPARATOR ===
|
|
67780
67829
|
|
|
67830
|
+
(function(){
|
|
67831
|
+
/**
|
|
67832
|
+
* Wizard Navigation Logic for Unvired Forms
|
|
67833
|
+
* This file handles all logic specific to Form.io wizard forms,
|
|
67834
|
+
* including navigation button visibility and event handling.
|
|
67835
|
+
*/
|
|
67836
|
+
|
|
67837
|
+
/**
|
|
67838
|
+
* Updates the visibility of navigation buttons (Next, Previous, Submit)
|
|
67839
|
+
* based on the current wizard page and form type.
|
|
67840
|
+
*
|
|
67841
|
+
* @param {Object} formObj - The Form.io form instance
|
|
67842
|
+
*/
|
|
67843
|
+
function updateWizardNav(formObj) {
|
|
67844
|
+
if (!formObj) return;
|
|
67845
|
+
|
|
67846
|
+
// 1. Hide default navigation and buttons (Next, Previous, Cancel, Submit)
|
|
67847
|
+
// This ensures that we only use our own footer buttons
|
|
67848
|
+
const selectorsToHide = [
|
|
67849
|
+
'.formio-component-wizard_nav',
|
|
67850
|
+
'.btn-wizard-nav-next',
|
|
67851
|
+
'.btn-wizard-nav-previous',
|
|
67852
|
+
'.btn-wizard-nav-cancel',
|
|
67853
|
+
'.btn-wizard-nav-submit'
|
|
67854
|
+
];
|
|
67855
|
+
|
|
67856
|
+
selectorsToHide.forEach(selector => {
|
|
67857
|
+
const elements = formObj.element.querySelectorAll(selector);
|
|
67858
|
+
elements.forEach(el => {
|
|
67859
|
+
el.style.display = "none";
|
|
67860
|
+
});
|
|
67861
|
+
});
|
|
67862
|
+
|
|
67863
|
+
// 2. Hide components from JSON that match navigation actions
|
|
67864
|
+
if (typeof formObj.eachComponent === 'function') {
|
|
67865
|
+
formObj.eachComponent((component) => {
|
|
67866
|
+
if (component.type === 'button') {
|
|
67867
|
+
const action = (component.component.action || '').toLowerCase();
|
|
67868
|
+
const label = (component.component.label || '').toLowerCase();
|
|
67869
|
+
|
|
67870
|
+
if (action === 'next' || action === 'previous' || action === 'cancel' ||
|
|
67871
|
+
label === 'next' || label === 'previous' || label === 'cancel') {
|
|
67872
|
+
// Hide both the component instance and its DOM element
|
|
67873
|
+
component.visible = false;
|
|
67874
|
+
if (component.element) {
|
|
67875
|
+
component.element.style.display = 'none';
|
|
67876
|
+
}
|
|
67877
|
+
}
|
|
67878
|
+
}
|
|
67879
|
+
});
|
|
67880
|
+
}
|
|
67881
|
+
|
|
67882
|
+
// 3. Handle Footer Navigation Toggling (Only for Wizards)
|
|
67883
|
+
if (!formObj.wizard) return;
|
|
67884
|
+
|
|
67885
|
+
const prevBtn = document.getElementById("prevBtn");
|
|
67886
|
+
const nextBtn = document.getElementById("nextBtn");
|
|
67887
|
+
const submitBtn = document.getElementById("submitBtn");
|
|
67888
|
+
const saveBtn = document.getElementById("saveBtn");
|
|
67889
|
+
|
|
67890
|
+
const currentPage = formObj.page || 0;
|
|
67891
|
+
const numPages = (formObj.pages && formObj.pages.length) || 0;
|
|
67892
|
+
const isLastPage = (currentPage >= numPages - 1);
|
|
67893
|
+
|
|
67894
|
+
console.log(\`[WizardLogic] \u{1F9ED} Page: \${currentPage + 1}/\${numPages}, isLastPage: \${isLastPage}\`);
|
|
67895
|
+
|
|
67896
|
+
if (prevBtn) {
|
|
67897
|
+
prevBtn.style.display = currentPage > 0 ? "inline-block" : "none";
|
|
67898
|
+
}
|
|
67899
|
+
|
|
67900
|
+
if (nextBtn) {
|
|
67901
|
+
nextBtn.style.display = currentPage < numPages - 1 ? "inline-block" : "none";
|
|
67902
|
+
}
|
|
67903
|
+
|
|
67904
|
+
// If it's a wizard, we only want the save and submit buttons on the last page.
|
|
67905
|
+
// If it's NOT the last page, we force hide them.
|
|
67906
|
+
// If it IS the last page, we let the normal logic (onChangeButtonSetup) decide.
|
|
67907
|
+
if (!isLastPage) {
|
|
67908
|
+
console.log("[WizardLogic] \u{1F512} Intermediate page: Hiding save/complete actions");
|
|
67909
|
+
if (submitBtn) submitBtn.style.display = "none";
|
|
67910
|
+
if (saveBtn) saveBtn.style.display = "none";
|
|
67911
|
+
|
|
67912
|
+
// Hide dropdown options as well
|
|
67913
|
+
const completeOption = document.getElementById("completeOption");
|
|
67914
|
+
const saveOption = document.getElementById("saveOption");
|
|
67915
|
+
const completeDivider = document.getElementById("completeDivider");
|
|
67916
|
+
const saveDivider = document.getElementById("saveDivider");
|
|
67917
|
+
|
|
67918
|
+
if (completeOption) completeOption.style.display = "none";
|
|
67919
|
+
if (saveOption) saveOption.style.display = "none";
|
|
67920
|
+
if (completeDivider) completeDivider.style.display = "none";
|
|
67921
|
+
if (saveDivider) saveDivider.style.display = "none";
|
|
67922
|
+
|
|
67923
|
+
// Also hide quick action buttons if they exist
|
|
67924
|
+
const quickCompleteBtn = document.getElementById("quickCompleteBtn");
|
|
67925
|
+
const quickSaveBtn = document.getElementById("quickSaveBtn");
|
|
67926
|
+
if (quickCompleteBtn) quickCompleteBtn.style.display = "none";
|
|
67927
|
+
if (quickSaveBtn) quickSaveBtn.style.display = "none";
|
|
67928
|
+
|
|
67929
|
+
// Re-check More button visibility after hiding items
|
|
67930
|
+
if (typeof window.checkMoreButtonVisibility === "function") {
|
|
67931
|
+
window.checkMoreButtonVisibility();
|
|
67932
|
+
}
|
|
67933
|
+
} else {
|
|
67934
|
+
console.log("[WizardLogic] \u{1F513} Last page: Allowing normal button logic to take over");
|
|
67935
|
+
// On the last page, we MUST ensure the More button visibility is re-evaluated
|
|
67936
|
+
// because it might have been hidden on the previous page.
|
|
67937
|
+
if (typeof window.checkMoreButtonVisibility === "function") {
|
|
67938
|
+
window.checkMoreButtonVisibility();
|
|
67939
|
+
}
|
|
67940
|
+
}
|
|
67941
|
+
}
|
|
67942
|
+
|
|
67943
|
+
/**
|
|
67944
|
+
* Sets up event listeners for wizard-specific events like page changes.
|
|
67945
|
+
*
|
|
67946
|
+
* @param {Object} formObj - The Form.io form instance
|
|
67947
|
+
* @param {Boolean} privateExternal - Private/External flag
|
|
67948
|
+
* @param {String} permission - User permission level
|
|
67949
|
+
*/
|
|
67950
|
+
function setupWizardEvents(formObj, privateExternal, permission) {
|
|
67951
|
+
if (!formObj) return;
|
|
67952
|
+
|
|
67953
|
+
if (formObj.wizard) {
|
|
67954
|
+
formObj.on('nextPage', () => {
|
|
67955
|
+
updateWizardNav(formObj);
|
|
67956
|
+
// Trigger progress calculation on page change
|
|
67957
|
+
if (typeof window.executeProgressCalculation === 'function') {
|
|
67958
|
+
window.executeProgressCalculation(privateExternal, permission);
|
|
67959
|
+
}
|
|
67960
|
+
});
|
|
67961
|
+
formObj.on('prevPage', () => {
|
|
67962
|
+
updateWizardNav(formObj);
|
|
67963
|
+
// Trigger progress calculation on page change
|
|
67964
|
+
if (typeof window.executeProgressCalculation === 'function') {
|
|
67965
|
+
window.executeProgressCalculation(privateExternal, permission);
|
|
67966
|
+
}
|
|
67967
|
+
});
|
|
67968
|
+
}
|
|
67969
|
+
|
|
67970
|
+
// Always handle render event to ensure buttons stay hidden
|
|
67971
|
+
formObj.on('render', () => {
|
|
67972
|
+
updateWizardNav(formObj);
|
|
67973
|
+
});
|
|
67974
|
+
}
|
|
67975
|
+
|
|
67976
|
+
window.updateWizardNav = updateWizardNav;
|
|
67977
|
+
|
|
67978
|
+
/**
|
|
67979
|
+
* Main initialization function for wizard logic.
|
|
67980
|
+
* Should be called after the Form.io form is created.
|
|
67981
|
+
*/
|
|
67982
|
+
window.initializeWizardLogic = function(formObj, privateExternal, permission) {
|
|
67983
|
+
console.log("[WizardLogic] \u{1F9D9} Initializing wizard-specific logic...");
|
|
67984
|
+
setupWizardEvents(formObj, privateExternal, permission);
|
|
67985
|
+
|
|
67986
|
+
// Also listen for change events to update nav (e.g. if pages are conditionally hidden)
|
|
67987
|
+
formObj.on('change', () => {
|
|
67988
|
+
updateWizardNav(formObj);
|
|
67989
|
+
});
|
|
67990
|
+
|
|
67991
|
+
updateWizardNav(formObj);
|
|
67992
|
+
};
|
|
67993
|
+
|
|
67994
|
+
})();
|
|
67995
|
+
|
|
67996
|
+
// === SCRIPT_SEPARATOR ===
|
|
67997
|
+
|
|
67781
67998
|
(function(){
|
|
67782
67999
|
async function loadCommentsform(
|
|
67783
68000
|
template,
|
|
@@ -68300,7 +68517,7 @@ window.deleteAppDocument = async function(id) {
|
|
|
68300
68517
|
window.getAllDocuments = getAllDocuments;
|
|
68301
68518
|
window.hasDocuments = hasDocuments;
|
|
68302
68519
|
function getBuildVersion() {
|
|
68303
|
-
return "1.0.
|
|
68520
|
+
return "1.0.23";
|
|
68304
68521
|
}
|
|
68305
68522
|
export {
|
|
68306
68523
|
getBuildVersion,
|
package/package.json
CHANGED