UNPKG

bootstrap-vue-wrapper

Version:

Bootstrap 5 components in Vue3 wrapper.

101 lines (100 loc) 1.83 kB
import { useValidator as l } from "@zemkogabor/vue-form-validator"; import { defineComponent as i, ref as r } from "vue"; const n = i({ name: "BsTextarea", props: { /** * Value for v-model */ modelValue: { type: [String, Number, null], default: null }, /** * Html id */ id: { type: String, required: !0 }, /** * Label for textarea */ label: { type: String, default: void 0 }, /** * Attribute hint */ hint: { type: String, default: void 0 }, /** * Enable or disable validator */ validatorEnabled: { type: Boolean, default: !0 }, /** * Convert empty string to null */ emptyStringToNull: { type: Boolean, default: !0 }, /** * Trim input value */ trim: { 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 = r(null); return { inputRef: e, validator: l(e, t.customValidatorMessages) }; }, methods: { /** * Hint id is generated */ getHintId() { return this.id + "Hint"; }, /** * On input event * * @param event */ onInput(t) { const e = t.target; let a = e.value; this.trim && (a = e.value.trim()), this.emptyStringToNull && a === "" && (a = null), this.$emit("update:modelValue", a); }, /** * On invalid event * * @param event */ onInvalid(t) { this.validatorEnabled && this.validator.onInvalid(t); } } }); export { n as default };