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