Merged from autogenerate-input-ids
This commit is contained in:
commit
f87368f5e6
4 changed files with 14 additions and 19 deletions
|
|
@ -35,7 +35,7 @@ export default {
|
||||||
name: "dropdown-question",
|
name: "dropdown-question",
|
||||||
props: {
|
props: {
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
inputId: String,
|
//inputId: String,
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -49,6 +49,10 @@ export default {
|
||||||
placeHolderText: String,
|
placeHolderText: String,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const inputId = !props.customInputId
|
||||||
|
? `dropdown-${crypto.randomUUID()}`
|
||||||
|
: props.customInputId;
|
||||||
|
|
||||||
const propsClone = Object.assign({}, props);
|
const propsClone = Object.assign({}, props);
|
||||||
const modelValue = propsClone.modelValue;
|
const modelValue = propsClone.modelValue;
|
||||||
let initialValue;
|
let initialValue;
|
||||||
|
|
@ -69,12 +73,13 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { errorMessage, handleBlur, handleChange, meta, errors } = useField(
|
const { errorMessage, handleBlur, handleChange, meta, errors } = useField(
|
||||||
props.inputId,
|
inputId,
|
||||||
props.validationRules,
|
props.validationRules,
|
||||||
fieldOptions
|
fieldOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
inputId,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
handleBlur,
|
handleBlur,
|
||||||
handleChange,
|
handleChange,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export default {
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
inputId: String,
|
customInputId: String,
|
||||||
isDisabled: Boolean,
|
isDisabled: Boolean,
|
||||||
isRequired: Boolean,
|
isRequired: Boolean,
|
||||||
hasIcon: Boolean, // If input has an icon
|
hasIcon: Boolean, // If input has an icon
|
||||||
|
|
@ -80,6 +80,8 @@ export default {
|
||||||
preventAutoFill: Boolean,
|
preventAutoFill: Boolean,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
|
||||||
|
|
||||||
const propsClone = Object.assign({}, props);
|
const propsClone = Object.assign({}, props);
|
||||||
const modelValue = propsClone.modelValue;
|
const modelValue = propsClone.modelValue;
|
||||||
let initialValue;
|
let initialValue;
|
||||||
|
|
@ -100,12 +102,13 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
|
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
|
||||||
props.inputId,
|
inputId,
|
||||||
props.validationRules,
|
props.validationRules,
|
||||||
fieldOptions
|
fieldOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
inputId,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
handleBlur,
|
handleBlur,
|
||||||
handleChange,
|
handleChange,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
cmsWidgetName="StreetAddressQuestionWidget"
|
cmsWidgetName="StreetAddressQuestionWidget"
|
||||||
v-model="addressModel.streetAddress"
|
v-model="addressModel.streetAddress"
|
||||||
ref="autocomplete"
|
ref="autocomplete"
|
||||||
inputId="autocomplete"
|
customInputId="autocomplete"
|
||||||
placeholderText="Search"
|
placeholderText="Search"
|
||||||
aria-haspopup=""
|
aria-haspopup=""
|
||||||
hasIcon
|
hasIcon
|
||||||
|
|
@ -25,9 +25,7 @@
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
|
cmsWidgetName="ApartmentNumberOrBusinessNameQuestionWidget"
|
||||||
v-model="addressModel.apartmentNumberOrBusinessName"
|
v-model="addressModel.apartmentNumberOrBusinessName"
|
||||||
ref="apartmentNumberOrBusinessName"
|
ref="apartmentNumberOrBusinessName" />
|
||||||
inputId="apartmentNumberOrBusinessName"
|
|
||||||
disableAutoFill />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
@ -38,8 +36,6 @@
|
||||||
cmsWidgetName="CityQuestionWidget"
|
cmsWidgetName="CityQuestionWidget"
|
||||||
v-model="addressModel.city"
|
v-model="addressModel.city"
|
||||||
ref="city"
|
ref="city"
|
||||||
inputId="city"
|
|
||||||
disableAutoFill
|
|
||||||
validationRules="city-required" />
|
validationRules="city-required" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -51,9 +47,7 @@
|
||||||
cmsWidgetName="StateQuestionWidget"
|
cmsWidgetName="StateQuestionWidget"
|
||||||
v-model="addressModel.state"
|
v-model="addressModel.state"
|
||||||
ref="state"
|
ref="state"
|
||||||
inputId="state"
|
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
disableAutoFill
|
|
||||||
validationRules="state-required" />
|
validationRules="state-required" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -61,7 +55,6 @@
|
||||||
cmsWidgetName="ZipQuestionWidget"
|
cmsWidgetName="ZipQuestionWidget"
|
||||||
v-model="addressModel.zipCode"
|
v-model="addressModel.zipCode"
|
||||||
ref="zipCode"
|
ref="zipCode"
|
||||||
inputId="zipCode"
|
|
||||||
mask="#####"
|
mask="#####"
|
||||||
disableAutoFill
|
disableAutoFill
|
||||||
validationRules="zip-code-required|zip-code-format" />
|
validationRules="zip-code-required|zip-code-format" />
|
||||||
|
|
|
||||||
|
|
@ -173,12 +173,6 @@ export default {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
this.internalModel = this.copyModel(newValue);
|
this.internalModel = this.copyModel(newValue);
|
||||||
},
|
},
|
||||||
internalModel: {
|
|
||||||
handler(newValue) {
|
|
||||||
console.log(newValue);
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
textLink,
|
textLink,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue