aw-wizard-forms 3.1.0 → 3.1.1
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/wizard-form.esm.js +25 -17
- package/dist/wizard-form.esm.js.map +1 -1
- package/dist/wizard-form.min.js +72 -72
- package/dist/wizard-form.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wizard-form.esm.js
CHANGED
|
@@ -1292,14 +1292,14 @@ let WizardForm = class extends i {
|
|
|
1292
1292
|
});
|
|
1293
1293
|
this._totalSteps = this._steps.length;
|
|
1294
1294
|
this._stateController.setTotalSteps(this._totalSteps);
|
|
1295
|
-
|
|
1295
|
+
document.dispatchEvent(
|
|
1296
1296
|
new CustomEvent("wf:steps-discovered", {
|
|
1297
1297
|
detail: {
|
|
1298
|
+
wizard: this,
|
|
1299
|
+
wizardId: this.id,
|
|
1298
1300
|
totalSteps: this._totalSteps,
|
|
1299
1301
|
currentStep: this._currentStep
|
|
1300
|
-
}
|
|
1301
|
-
bubbles: true,
|
|
1302
|
-
composed: true
|
|
1302
|
+
}
|
|
1303
1303
|
})
|
|
1304
1304
|
);
|
|
1305
1305
|
}
|
|
@@ -3895,6 +3895,7 @@ let WfProgress = class extends i {
|
|
|
3895
3895
|
this._wizard = null;
|
|
3896
3896
|
this._boundHandleStepChange = this._handleStepChange.bind(this);
|
|
3897
3897
|
this._boundHandleSuccess = this._handleSuccess.bind(this);
|
|
3898
|
+
this._boundHandleStepsDiscovered = this._handleStepsDiscovered.bind(this);
|
|
3898
3899
|
}
|
|
3899
3900
|
/**
|
|
3900
3901
|
* Disable Shadow DOM - render to Light DOM for external styling
|
|
@@ -3904,20 +3905,14 @@ let WfProgress = class extends i {
|
|
|
3904
3905
|
}
|
|
3905
3906
|
connectedCallback() {
|
|
3906
3907
|
super.connectedCallback();
|
|
3908
|
+
document.addEventListener("wf:steps-discovered", this._boundHandleStepsDiscovered);
|
|
3907
3909
|
requestAnimationFrame(() => {
|
|
3908
3910
|
this._connectToWizard();
|
|
3909
|
-
if (this._wizard && this._totalSteps <= 1) {
|
|
3910
|
-
requestAnimationFrame(() => {
|
|
3911
|
-
if (this._wizard) {
|
|
3912
|
-
this._totalSteps = this._wizard.totalSteps || this._totalSteps;
|
|
3913
|
-
this._currentStep = this._wizard.currentStep || this._currentStep;
|
|
3914
|
-
}
|
|
3915
|
-
});
|
|
3916
|
-
}
|
|
3917
3911
|
});
|
|
3918
3912
|
}
|
|
3919
3913
|
disconnectedCallback() {
|
|
3920
3914
|
super.disconnectedCallback();
|
|
3915
|
+
document.removeEventListener("wf:steps-discovered", this._boundHandleStepsDiscovered);
|
|
3921
3916
|
this._disconnectFromWizard();
|
|
3922
3917
|
}
|
|
3923
3918
|
_connectToWizard() {
|
|
@@ -3932,7 +3927,6 @@ let WfProgress = class extends i {
|
|
|
3932
3927
|
this._isComplete = this._wizard.isSubmitted || false;
|
|
3933
3928
|
this._wizard.addEventListener("wf:step-change", this._boundHandleStepChange);
|
|
3934
3929
|
this._wizard.addEventListener("wf:success", this._boundHandleSuccess);
|
|
3935
|
-
this._wizard.addEventListener("wf:steps-discovered", this._handleStepsDiscovered.bind(this));
|
|
3936
3930
|
}
|
|
3937
3931
|
}
|
|
3938
3932
|
_disconnectFromWizard() {
|
|
@@ -3948,11 +3942,25 @@ let WfProgress = class extends i {
|
|
|
3948
3942
|
this._totalSteps = this._wizard.totalSteps;
|
|
3949
3943
|
}
|
|
3950
3944
|
}
|
|
3951
|
-
_handleStepsDiscovered() {
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3945
|
+
_handleStepsDiscovered(e2) {
|
|
3946
|
+
const { wizard, wizardId, totalSteps, currentStep } = e2.detail;
|
|
3947
|
+
if (this.for) {
|
|
3948
|
+
if (wizardId !== this.for) {
|
|
3949
|
+
return;
|
|
3950
|
+
}
|
|
3951
|
+
} else {
|
|
3952
|
+
const parentWizard = this.closest("wizard-form");
|
|
3953
|
+
if (!parentWizard || parentWizard !== wizard) {
|
|
3954
|
+
return;
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
if (!this._wizard && wizard) {
|
|
3958
|
+
this._wizard = wizard;
|
|
3959
|
+
wizard.addEventListener("wf:step-change", this._boundHandleStepChange);
|
|
3960
|
+
wizard.addEventListener("wf:success", this._boundHandleSuccess);
|
|
3955
3961
|
}
|
|
3962
|
+
this._totalSteps = totalSteps;
|
|
3963
|
+
this._currentStep = currentStep;
|
|
3956
3964
|
}
|
|
3957
3965
|
_handleSuccess() {
|
|
3958
3966
|
this._isComplete = true;
|