CSR-762 WIP

This commit is contained in:
Katie 2022-10-03 15:51:57 -04:00
commit a669556c80
6 changed files with 21 additions and 13 deletions

View file

@ -2,7 +2,7 @@
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<transition :duration="{ enter: 200, leave: 200 }" name="route-fade" mode="out-in"> <transition :duration="{ enter: 200, leave: 200 }" name="route-fade" mode="out-in">
<!-- The above durations should be kept in sync with the global css class "fade-on-route-transition" --> <!-- The above durations should be kept in sync with the global css class "fade-on-route-transition" -->
<component :is="Component" @input-focus="handleFocus" @input-blur="handleBlur"/> <component :is="Component" @inputFocus="handleFocus" @input-blur="handleBlur"/>
</transition> </transition>
</router-view> </router-view>
</template> </template>
@ -10,13 +10,19 @@
<script> <script>
export default { export default {
name: "app", name: "app",
data() {
return {
lastFocusedInputGroupName: "",
onFocusCallback: null
}
},
methods: { methods: {
handleFocus(e) { handleFocus(e) {
console.log("app focus: ", e) console.log("app focus: ", e)
}, },
handleBlur(e) { handleBlur(e) {
console.log("app blur: ", e) console.log("app blur: ", e)
} },
} }
} }
</script> </script>

View file

@ -12,6 +12,7 @@
:aria-required="isRequired" :aria-required="isRequired"
:value="value" :value="value"
:checked="isChecked" :checked="isChecked"
@keypress.space="handleEventAction('space', $event)"
@keypress.enter="handleEventAction('keypressSubmit', $event)" @keypress.enter="handleEventAction('keypressSubmit', $event)"
@change="handleEventAction('change', $event)" /> @change="handleEventAction('change', $event)" />

View file

@ -236,13 +236,13 @@ export default {
); );
}, },
handleFocus() { handleFocus() {
this.$emit("inputFocus", { this.$root.handleFocus({
groupName: this.groupName, groupName: this.groupName,
value: this.primaryValue value: this.primaryValue
}) })
}, },
handleBlur() { handleBlur() {
this.$emit("inputBlur", { this.$root.handleBlur({
groupName: this.groupName, groupName: this.groupName,
value: this.primaryValue value: this.primaryValue
}) })

View file

@ -5,7 +5,7 @@
groupName="ChooseAddressVehicle" groupName="ChooseAddressVehicle"
:questionText="questionText" :questionText="questionText"
:answers="vehicles" :answers="vehicles"
v-model="selectedVehicleVinAsArray" v-model="selectedVehicleVin"
isRequired isRequired
:validation-rules="validationRules" :validation-rules="validationRules"
:valueToLogType="ValueToLogTypes.LAST_5" :valueToLogType="ValueToLogTypes.LAST_5"
@ -63,18 +63,16 @@ export default {
questionText() { questionText() {
return this.getCmsContent("VehicleConfirmationQuestion", "QuestionText"); return this.getCmsContent("VehicleConfirmationQuestion", "QuestionText");
}, },
selectedVehicleVinAsArray: { selectedVehicleVin: {
get: function() { get: function() {
const modelValueAsArray = this.modelValue ? [this.modelValue] : []; return this.modelValue;
return modelValueAsArray;
}, },
set: function(newValue) { set: function(newValue) {
const newValueAsScalar = newValue && newValue.length > 0 ? newValue[newValue.length-1] : null; this.$emit("update:modelValue", newValue);
this.$emit("update:modelValue", newValueAsScalar);
} }
}, },
selectedVehicle() { // this computed is only needed for the computed differentVehicleAlertBody text above selectedVehicle() { // this computed is only needed for the computed differentVehicleAlertBody text above
return this.vehicles.find( ({ vin }) => vin === this.selectedVehicleVinAsArray[this.selectedVehicleVinAsArray.length-1] ); return this.vehicles.find( ({ vin }) => vin === this.selectedVehicleVin[this.selectedVehicleVin.length-1] );
}, },
}, },
components: { components: {

View file

@ -195,7 +195,7 @@ export default {
selectedVehicleVin: { selectedVehicleVin: {
handler() { handler() {
// does this vehicle match the previously selected carId? // does this vehicle match the previously selected carId?
this.isCarIdDifferent = this.selectedVehicle.vehicle.carId !== store.getters.vehicle.carId; this.isCarIdDifferent = this.selectedVehicle?.vehicle.carId !== store.getters.vehicle.carId;
if (this.isCarIdDifferent) { if (this.isCarIdDifferent) {
this.$refs.funnelFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model}`); this.$refs.funnelFooter.updateButtonText(`Continue with ${this.selectedVehicle.vehicle.year} ${this.selectedVehicle.vehicle.make} ${this.selectedVehicle.vehicle.model}`);
} else { } else {

View file

@ -16,7 +16,10 @@ export default {
valueToLogType: String, valueToLogType: String,
validationRules: String, validationRules: String,
isWide: Boolean, isWide: Boolean,
isRequired: Boolean isRequired: {
type: Boolean,
default: true
}
}, },
data() { data() {
return { return {