UNPKG

bootstrap-vue-wrapper

Version:

Bootstrap 5 components in Vue3 wrapper.

105 lines (104 loc) 1.81 kB
import { useValidator as a } from "@zemkogabor/vue-form-validator"; import { defineComponent as i, ref as l } from "vue"; const n = i({ name: "BsRadio", props: { /** * Radio value */ value: { type: [String, Number], default: null }, /** * Value for v-model */ modelValue: { type: [String, Number, 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 }, /** * Input container div class. */ classContainer: { 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(e) { const t = l(null); return { inputRef: t, validator: a(t, e.customValidatorMessages) }; }, computed: { /** * Radio is checked or not. */ isChecked() { return this.modelValue === this.value; } }, methods: { /** * Hint id is generated */ getHintId() { return this.id + "Hint"; }, /** * On input event */ onInput() { this.$emit("update:modelValue", this.value); }, /** * On invalid event * * @param event */ onInvalid(e) { this.validatorEnabled && this.validator.onInvalid(e); } } }); export { n as default };