Skip to content

Commit eec4ba3

Browse files
authored
refactor(ui5-wizard): selection-change renamed to step-change
We have decided to rename the selection-change event in order for its name to better represent its origins. In relation to #3107. BREAKING_CHANGE: The “selection-change” event has been renamed to "step-change". In addition, the event param "selectedStep" has been renamed to "step" and the event param "previouslySelectedStep" has been renamed to "previousStep".
1 parent 29d1de0 commit eec4ba3

File tree

5 files changed

+78
-78
lines changed

5 files changed

+78
-78
lines changed

packages/fiori/src/Wizard.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ const metadata = {
127127
},
128128
events: /** @lends sap.ui.webcomponents.fiori.Wizard.prototype */ {
129129
/**
130-
* Fired when the step selection is changed by user interaction - either with scrolling,
130+
* Fired when the step is changed by user interaction - either with scrolling,
131131
* or by clicking on the steps within the component header.
132132
*
133-
* @event sap.ui.webcomponents.fiori.Wizard#selection-change
134-
* @param {HTMLElement} selectedStep the newly selected step
135-
* @param {HTMLElement} previouslySelectedStep the previously selected step
136-
* @param {Boolean} changeWithClick the selection changed due to user's click on step within the navigation
133+
* @event sap.ui.webcomponents.fiori.Wizard#step-change
134+
* @param {HTMLElement} step the new step
135+
* @param {HTMLElement} previousStep the previous step
136+
* @param {Boolean} changeWithClick the step change occurs due to user's click on step within the navigation
137137
* @public
138138
*/
139-
"selection-change": {
139+
"step-change": {
140140
detail: {
141-
selectedStep: { type: HTMLElement },
142-
previouslySelectedStep: { type: HTMLElement },
141+
step: { type: HTMLElement },
142+
previousStep: { type: HTMLElement },
143143
changeWithClick: { Boolean },
144144
},
145145
},
@@ -637,7 +637,7 @@ class Wizard extends UI5Element {
637637
}
638638

639639
// If the calculated index is in range,
640-
// change selection and fire "selection-change".
640+
// change selection and fire "step-change".
641641
if (newlySelectedIndex >= 0 && newlySelectedIndex <= this.stepsCount - 1) {
642642
const stepToSelect = this.slottedSteps[newlySelectedIndex];
643643

@@ -668,7 +668,7 @@ class Wizard extends UI5Element {
668668
}
669669

670670
if (bExpanded || (!bExpanded && (newlySelectedIndex === 0 || newlySelectedIndex === this.steps.length - 1))) {
671-
// Change selection and fire "selection-change".
671+
// Change selection and fire "step-change".
672672
this.switchSelectionFromOldToNewStep(selectedStep, stepToSelect, newlySelectedIndex, true);
673673
}
674674
}
@@ -965,9 +965,9 @@ class Wizard extends UI5Element {
965965
selectedStep.selected = false;
966966
stepToSelect.selected = true;
967967

968-
this.fireEvent("selection-change", {
969-
selectedStep: stepToSelect,
970-
previouslySelectedStep: selectedStep,
968+
this.fireEvent("step-change", {
969+
step: stepToSelect,
970+
previousStep: selectedStep,
971971
changeWithClick,
972972
});
973973

packages/fiori/test/pages/Wizard.html

+26-26
Original file line numberDiff line numberDiff line change
@@ -566,36 +566,36 @@ <h2>Wizard non-standard 3</h2>
566566
<ui5-wizard-step icon="sap-icon://home" heading="Product type">
567567
<div style="display: flex; min-height: 200px; flex-direction: column;">
568568
<ui5-title>1. Product Type</ui5-title><br>
569-
569+
570570
<ui5-messagestrip>
571571
The Wizard control is supposed to break down large tasks, into smaller steps, easier for the user to work with.
572572
</ui5-messagestrip><br>
573-
573+
574574
<ui5-label wrap>Sed fermentum, mi et tristique ullamcorper, sapien sapien faucibus sem, quis pretium nibh lorem malesuada diam. Nulla quis arcu aliquet, feugiat massa semper, volutpat diam. Nam vitae ante posuere, molestie neque sit amet, dapibus velit. Maecenas eleifend tempor lorem. Mauris vitae elementum mi, sed eleifend ligula. Nulla tempor vulputate dolor, nec dignissim quam convallis ut. Praesent vitae commodo felis, ut iaculis felis. Fusce quis eleifend sapien, eget facilisis nibh. Suspendisse est velit, scelerisque ut commodo eget, dignissim quis metus. Cras faucibus consequat gravida. Curabitur vitae quam felis. Phasellus ac leo eleifend, commodo tortor et, varius quam. Aliquam erat volutpat.
575575
</ui5-label>
576576
</div>
577-
577+
578578
<ui5-button id="toStep22" design="Emphasized">Step 2</ui5-button>
579579
</ui5-wizard-step>
580-
580+
581581
<ui5-wizard-step heading="Product Information" selected>
582582
<div style="display: flex;flex-direction: column">
583583
<ui5-title>2. Product Information</ui5-title><br>
584584
<ui5-label wrap>
585585
Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec ppellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien corper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien
586586
</ui5-label>
587-
587+
588588
<div style="display: flex; flex-direction: column;">
589589
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
590590
<ui5-label>Name</ui5-label>
591591
<ui5-input placeholder="product name..."></ui5-input>
592592
</div>
593-
593+
594594
<div style="display: flex; flex-direction: row; margin-top: 1rem; justify-content: flex-end; align-items: center;">
595595
<ui5-label>Weight</ui5-label>
596596
<ui5-input value="3.65"></ui5-input>
597597
</div>
598-
598+
599599
<div style="display: flex; flex-direction: row; margin-top: 1rem; justify-content: flex-end; align-items: center;">
600600
<ui5-label>Manifacturer</ui5-label>
601601
<ui5-select>
@@ -604,34 +604,34 @@ <h2>Wizard non-standard 3</h2>
604604
<ui5-option>Huawei</ui5-option>
605605
</ui5-select>
606606
</div>
607-
607+
608608
<div style="display: flex; flex-direction: row; margin-top: 1rem; justify-content: flex-end; align-items: center;">
609609
<ui5-label>5 years guarantee included</ui5-label>
610610
<ui5-switch id="sw2"></ui5-switch>
611611
</div>
612612
</div>
613613
</div>
614-
614+
615615
<ui5-button id="toStep32" design="Emphasized" hidden>Step 3</ui5-button>
616616
</ui5-wizard-step>
617-
617+
618618
<ui5-wizard-step heading="Options" disabled>
619619
<div style="display: flex; flex-direction: column;">
620620
<ui5-title>3. Options</ui5-title><br>
621-
621+
622622
<ui5-label wrap>
623623
Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec ppellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien corper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien
624624
</ui5-label>
625625
<ui5-messagestrip>
626626
The Wizard control is supposed to break down large tasks, into smaller steps, easier for the user to work with.
627627
</ui5-messagestrip><br>
628-
628+
629629
<div style="display: flex; flex-direction: column;">
630630
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
631631
<ui5-label>Manifacture date</ui5-label>
632632
<ui5-date-picker></ui5-date-picker>
633633
</div>
634-
634+
635635
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
636636
<ui5-label>Availability</ui5-label>
637637
<ui5-segmentedbutton>
@@ -641,7 +641,7 @@ <h2>Wizard non-standard 3</h2>
641641
<ui5-togglebutton>Out of stock</ui5-togglebutton>
642642
</ui5-segmentedbutton>
643643
</div>
644-
644+
645645
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
646646
<ui5-label>Size</ui5-label>
647647
<ui5-segmentedbutton id="sb2">
@@ -652,10 +652,10 @@ <h2>Wizard non-standard 3</h2>
652652
</div>
653653
</div>
654654
</div>
655-
655+
656656
<ui5-button id="toStep42" design="Emphasized" hidden>Step 4</ui5-button>
657657
</ui5-wizard-step>
658-
658+
659659
<ui5-wizard-step heading="Pricing" disabled>
660660
<div style="display: flex; flex-direction: column;">
661661
<ui5-title>4. Pricing</ui5-title><br>
@@ -665,25 +665,25 @@ <h2>Wizard non-standard 3</h2>
665665
<ui5-messagestrip>
666666
The Wizard control is supposed to break down large tasks, into smaller steps, easier for the user to work with.
667667
</ui5-messagestrip><br>
668-
668+
669669
<div style="display: flex; flex-direction: column;">
670670
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
671671
<ui5-label>Price</ui5-label>
672672
<ui5-input placeholder="product price..."></ui5-input>
673673
</div>
674-
674+
675675
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
676676
<ui5-label>Quantity</ui5-label>
677677
<ui5-input placeholder="product quantity..."></ui5-input>
678678
</div>
679-
679+
680680
<div style="display: flex; flex-direction: row; margin-top: 1rem; justify-content: flex-end; align-items: center;">
681681
<ui5-label>Vat included</ui5-label>
682682
<ui5-switch checked></ui5-switch>
683683
</div>
684684
</div>
685685
</div>
686-
686+
687687
<ui5-button id="finalize2" design="Emphasized">Finalize</ui5-button>
688688
</ui5-wizard-step>
689689
</ui5-wizard>
@@ -692,15 +692,15 @@ <h2>Wizard non-standard 3</h2>
692692
<script>
693693
var wiz = document.getElementById("wiz");
694694

695-
wiz.addEventListener("selection-change", function () {
696-
console.log(event.detail.selectedStep);
695+
wiz.addEventListener("step-change", function () {
696+
console.log(event.detail.step);
697697
});
698698

699699
sw.addEventListener("change", function () {
700700
toStep3.removeAttribute("hidden");
701701
});
702702

703-
sb.addEventListener("selection-change", function () {
703+
sb.addEventListener("step-change", function () {
704704
toStep4.removeAttribute("hidden");
705705
});
706706

@@ -733,15 +733,15 @@ <h2>Wizard non-standard 3</h2>
733733
dialog.open();
734734
});
735735

736-
wiz2.addEventListener("selection-change", function () {
737-
console.log(event.detail.selectedStep);
736+
wiz2.addEventListener("step-change", function () {
737+
console.log(event.detail.step);
738738
});
739739

740740
sw2.addEventListener("change", function () {
741741
toStep32.removeAttribute("hidden");
742742
});
743743

744-
sb2.addEventListener("selection-change", function () {
744+
sb2.addEventListener("step-change", function () {
745745
toStep42.removeAttribute("hidden");
746746
});
747747

packages/fiori/test/pages/Wizard_test.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<ui5-label wrap>Sed fermentum, mi et tristique ullamcorper, sapien sapien faucibus sem, quis pretium nibh lorem malesuada diam. Nulla quis arcu aliquet, feugiat massa semper, volutpat diam. Nam vitae ante posuere, molestie neque sit amet, dapibus velit. Maecenas eleifend tempor lorem. Mauris vitae elementum mi, sed eleifend ligula. Nulla tempor vulputate dolor, nec dignissim quam convallis ut. Praesent vitae commodo felis, ut iaculis felis. Fusce quis eleifend sapien, eget facilisis nibh. Suspendisse est velit, scelerisque ut commodo eget, dignissim quis metus. Cras faucibus consequat gravida. Curabitur vitae quam felis. Phasellus ac leo eleifend, commodo tortor et, varius quam. Aliquam erat volutpat.
4242
</ui5-label>
4343

44-
<ui5-input id="inpSelectionChangeCounter"></ui5-input>
44+
<ui5-input id="inpStepChangeCounter"></ui5-input>
4545
<ui5-button id="btnOpenDialog" style="width: 150px; align-self: flex-end;">Open Wizard Dialog</ui5-button>
4646

4747
<div style="display: flex; flex-direction: row; margin-top: 1rem; justify-content: flex-end; align-items: center;">
@@ -52,7 +52,7 @@
5252
<ui5-togglebutton threshold="1">1</ui5-togglebutton>
5353
</ui5-segmentedbutton>
5454
</div>
55-
55+
5656
</div>
5757

5858
<ui5-button id="toStep2" design="Emphasized">Step 2</ui5-button>
@@ -65,7 +65,7 @@
6565
Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec ppellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien corper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien
6666
</ui5-label>
6767

68-
<ui5-input id="inpSelectionChangeCause" placeholder="step changed via click"></ui5-input>
68+
<ui5-input id="inpStepChangeCause" placeholder="step changed via click"></ui5-input>
6969

7070
<div style="display: flex; flex-direction: column;">
7171
<div style="display: flex; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 1rem">
@@ -140,7 +140,7 @@
140140
</div>
141141

142142
<span id="scrollMarkerSt3"></span>
143-
143+
144144
<ui5-button id="toStep22" design="Emphasized">Step 2</ui5-button>
145145
<ui5-button id="toStep4" design="Emphasized">Step 4</ui5-button>
146146
</ui5-wizard-step>
@@ -316,10 +316,10 @@
316316
var wiz = document.getElementById("wizTest");
317317
var wizInDialog = document.getElementById("wizInDialog");
318318
var counter = 0;
319-
wiz.addEventListener("ui5-selection-change", function (event) {
320-
console.log(event.detail.selectedStep);
321-
inpSelectionChangeCounter.value = ++counter;
322-
inpSelectionChangeCause.value = event.detail.changeWithClick;
319+
wiz.addEventListener("ui5-step-change", function (event) {
320+
console.log(event.detail.step);
321+
inpStepChangeCounter.value = ++counter;
322+
inpStepChangeCause.value = event.detail.changeWithClick;
323323
});
324324

325325
toStep2.addEventListener("click", function () {
@@ -385,7 +385,7 @@
385385
dialog.open();
386386
});
387387

388-
setting.addEventListener("selection-change", function (event) {
388+
setting.addEventListener("step-change", function (event) {
389389
wiz.setAttribute("step-switch-threshold", event.detail.selectedButton.getAttribute("threshold"));
390390
});
391391
</script>

packages/fiori/test/samples/Wizard.sample.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ <h3>Wizard</h3>
156156
<script>
157157
var wiz = document.getElementById("wiz");
158158

159-
wiz.addEventListener("selection-change", function () {
160-
console.log(event.detail.selectedStep);
159+
wiz.addEventListener("step-change", function () {
160+
console.log(event.detail.step);
161161
});
162162

163163
sw.addEventListener("change", function () {
164164
toStep3.removeAttribute("hidden");
165165
});
166166

167-
sb.addEventListener("selection-change", function () {
167+
sb.addEventListener("step-change", function () {
168168
toStep4.removeAttribute("hidden");
169169
});
170170

0 commit comments

Comments
 (0)