bootstrap-vue-wrapper
Version:
Bootstrap 5 components in Vue3 wrapper.
100 lines (99 loc) • 1.7 kB
JavaScript
import { useValidator as a } from "@zemkogabor/vue-form-validator";
import { defineComponent as r, ref as i } from "vue";
const d = r({
name: "BsSelect",
props: {
/**
* Value for v-model
*/
modelValue: {
type: [String, Number, Array, null],
default: null
},
/**
* Html id
*/
id: {
type: String,
required: !0
},
/**
* Label for input
*/
label: {
type: String,
default: void 0
},
/**
* Attribute hint
*/
hint: {
type: String,
default: void 0
},
/**
* Options
*/
options: {
type: Array,
required: !0
},
/**
* Placeholder
*/
placeholder: {
type: String,
default: void 0
},
/**
* Enable or disable validator
*/
validatorEnabled: {
type: Boolean,
default: !0
},
/**
* Custom validator messages, e.g. minlength validation with custom message
*/
customValidatorMessages: {
type: Object,
default: void 0
}
},
emits: ["update:modelValue"],
setup(t) {
const e = i(null);
return {
inputRef: e,
validator: a(e, t.customValidatorMessages)
};
},
methods: {
/**
* Hint id is generated
*/
getHintId() {
return this.id + "Hint";
},
/**
* On input event
*
* @param event
*/
onInput(t) {
const e = t.target;
this.$emit("update:modelValue", e.value);
},
/**
* On invalid event
*
* @param event
*/
onInvalid(t) {
this.validatorEnabled && this.validator.onInvalid(t);
}
}
});
export {
d as default
};