WIP
This commit is contained in:
parent
c5d88c7983
commit
53530095dc
3 changed files with 105 additions and 10 deletions
|
|
@ -45,7 +45,8 @@
|
||||||
@blur="handleChange"
|
@blur="handleChange"
|
||||||
:maxlength="maxLength ? maxLength : '999'"
|
:maxlength="maxLength ? maxLength : '999'"
|
||||||
@focus="$emit('focus', $event.target.value)"
|
@focus="$emit('focus', $event.target.value)"
|
||||||
@keydown="keyDownHandler" />
|
@keydown="keyDownHandler"
|
||||||
|
@animationstart="checkAnimation" />
|
||||||
<button
|
<button
|
||||||
v-if="includeSearchIcon"
|
v-if="includeSearchIcon"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|
@ -130,6 +131,7 @@ export default {
|
||||||
default: false,
|
default: false,
|
||||||
isRequired: false,
|
isRequired: false,
|
||||||
},
|
},
|
||||||
|
autofilled: Boolean
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const uuid = uuidv4();
|
const uuid = uuidv4();
|
||||||
|
|
@ -178,6 +180,26 @@ export default {
|
||||||
const field = document.querySelector("input");
|
const field = document.querySelector("input");
|
||||||
field.focus();
|
field.focus();
|
||||||
},
|
},
|
||||||
|
checkAnimation(e) {
|
||||||
|
// if(e.animationName == "onAutoFillStart")
|
||||||
|
// {
|
||||||
|
// console.log("onAutoFillStart")
|
||||||
|
// //this.autofilled = true;
|
||||||
|
// }
|
||||||
|
if(e.animationName == "onAutoFillSelected")
|
||||||
|
{
|
||||||
|
//console.log("onAutoFillSelected")
|
||||||
|
this.$emit("autofilled", { inputId: this.inputId, autofilled: true});
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(e.animationName == "onAutoFillCancel")
|
||||||
|
{
|
||||||
|
//console.log("onAutoFillCancel")
|
||||||
|
this.$emit("autofilled", { inputId: this.inputId, autofilled: false});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
async imageChanged(e) {
|
async imageChanged(e) {
|
||||||
let file = e.target.files[0];
|
let file = e.target.files[0];
|
||||||
|
|
||||||
|
|
@ -222,6 +244,13 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$emit("textboxQuestionEvent.inputIdAssigned", this.inputId);
|
this.$emit("textboxQuestionEvent.inputIdAssigned", this.inputId);
|
||||||
|
// const element = document.querySelector(`#${this.inputId}`, null);
|
||||||
|
|
||||||
|
// element.addEventListener("change", () => {
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// console.log(window.getComputedStyle(element, ":-internal-autofill"));
|
||||||
|
// });
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
async value(newValue) {
|
async value(newValue) {
|
||||||
|
|
@ -347,5 +376,33 @@ export default {
|
||||||
p {
|
p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:-webkit-autofill {
|
||||||
|
animation-name: onAutoFillStart;
|
||||||
|
}
|
||||||
|
:-webkit-autofill:focus {
|
||||||
|
animation-name: onAutoFillSelected;
|
||||||
|
}
|
||||||
|
:not(:-webkit-autofill) {
|
||||||
|
animation-name: onAutoFillCancel;
|
||||||
|
}
|
||||||
|
@keyframes onAutoFillStart {
|
||||||
|
from {
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes onAutoFillSelected {
|
||||||
|
from {
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes onAutoFillCancel {
|
||||||
|
from {
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
aria-haspopup=""
|
aria-haspopup=""
|
||||||
hasIcon
|
hasIcon
|
||||||
validationRules="street-address-required"
|
validationRules="street-address-required"
|
||||||
@keydown.enter.prevent />
|
@keydown.enter.prevent
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<transition name="fade" mode="out-in">
|
<transition name="fade" mode="out-in">
|
||||||
|
|
@ -25,7 +26,8 @@
|
||||||
customInputId="apartmentNumberOrBusinessName"
|
customInputId="apartmentNumberOrBusinessName"
|
||||||
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
|
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
|
||||||
v-model="addressModel.apartmentNumberOrBusinessName"
|
v-model="addressModel.apartmentNumberOrBusinessName"
|
||||||
ref="apartmentNumberOrBusinessName" />
|
ref="apartmentNumberOrBusinessName"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
@ -37,7 +39,8 @@
|
||||||
cmsWidgetName="CityQuestionWidget"
|
cmsWidgetName="CityQuestionWidget"
|
||||||
v-model="addressModel.city"
|
v-model="addressModel.city"
|
||||||
ref="city"
|
ref="city"
|
||||||
validationRules="city-required" />
|
validationRules="city-required"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
@ -50,7 +53,8 @@
|
||||||
v-model="addressModel.state"
|
v-model="addressModel.state"
|
||||||
ref="state"
|
ref="state"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
validationRules="state-required" />
|
validationRules="state-required"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
|
|
@ -59,7 +63,8 @@
|
||||||
v-model="addressModel.zipCode"
|
v-model="addressModel.zipCode"
|
||||||
ref="zipCode"
|
ref="zipCode"
|
||||||
mask="#####"
|
mask="#####"
|
||||||
validationRules="zip-code-required|zip-code-format" />
|
validationRules="zip-code-required|zip-code-format"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
@ -119,6 +124,7 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
//autofilled: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -222,6 +228,13 @@ export default {
|
||||||
this.initializeAutocomplete();
|
this.initializeAutocomplete();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
setAutofilled(value) {
|
||||||
|
console.log(value)
|
||||||
|
if (value.autofilled) {
|
||||||
|
this.showAddressFields = true;
|
||||||
|
}
|
||||||
|
this.$emit("autofilled", value);
|
||||||
|
},
|
||||||
initializeAutocomplete() {
|
initializeAutocomplete() {
|
||||||
// Initialize the Google Places Autocomplete
|
// Initialize the Google Places Autocomplete
|
||||||
this.autocomplete = new window.google.maps.places.Autocomplete(this.addressField1, {
|
this.autocomplete = new window.google.maps.places.Autocomplete(this.addressField1, {
|
||||||
|
|
@ -436,6 +449,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
autofilled(value) {
|
||||||
|
console.log(value)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
v-model="customerModel.firstName"
|
v-model="customerModel.firstName"
|
||||||
ref="firstName"
|
ref="firstName"
|
||||||
customInputId="firstName"
|
customInputId="firstName"
|
||||||
validationRules="first-name-required" />
|
validationRules="first-name-required"
|
||||||
|
@autofilled="setAutofilled"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
|
|
@ -17,7 +18,8 @@
|
||||||
v-model="customerModel.lastName"
|
v-model="customerModel.lastName"
|
||||||
ref="lastName"
|
ref="lastName"
|
||||||
customInputId="lastName"
|
customInputId="lastName"
|
||||||
validationRules="last-name-required" />
|
validationRules="last-name-required"
|
||||||
|
@autofilled="setAutofilled"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
|
|
@ -29,7 +31,8 @@
|
||||||
customInputId="emailAddress"
|
customInputId="emailAddress"
|
||||||
:isRequired="!isEmailOptional"
|
:isRequired="!isEmailOptional"
|
||||||
:validationRules="validationRules"
|
:validationRules="validationRules"
|
||||||
:addOptionalText="isEmailOptional" />
|
:addOptionalText="isEmailOptional"
|
||||||
|
:autofilled="autofilled" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-0">
|
<div class="row mb-0">
|
||||||
|
|
@ -83,6 +86,25 @@ export default {
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
isEmailOptional: Boolean,
|
isEmailOptional: Boolean,
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
autofilled: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setAutofilled(value) {
|
||||||
|
console.log(value)
|
||||||
|
if (value.autofilled === true) {
|
||||||
|
this.autofilled = true;
|
||||||
|
console.log("autofilled")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.autofilled = false;
|
||||||
|
console.log("not autofilled")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
customerModel: {
|
customerModel: {
|
||||||
get: function () {
|
get: function () {
|
||||||
|
|
@ -92,7 +114,7 @@ export default {
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
autofilled(value) {} },
|
||||||
components: {
|
components: {
|
||||||
addressQuestions,
|
addressQuestions,
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue