8000 fix(BForm): expose the form so you can programatically submit fixes b… by VividLemon · Pull Request #1467 · bootstrap-vue-next/bootstrap-vue-next · GitHub
[go: up one dir, main page]

Skip to content

fix(BForm): expose the form so you can programatically submit fixes b… #1467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/bootstrap-vue-next/src/components/BAlert/BAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ watch(isHovering, (newValue) => {

onBeforeUnmount(stop)

defineExpose({pause, resume, restart, stop})
defineExpose({
pause,
resume,
restart,
stop,
})
</script>

<style lang="scss" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ watch(isHovering, (newValue) => {
onMouseLeave()
})

defineExpose({pause, resume, prev, next})
defineExpose({
pause,
resume,
prev,
next,
})

provide(carouselInjectionKey, {
background: toRef(() => props.background),
Expand Down
9 changes: 8 additions & 1 deletion packages/bootstrap-vue-next/src/components/BForm/BForm.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<form
:id="id"
ref="element"
:novalidate="novalidateBoolean"
:class="computedClasses"
@submit.prevent="submitted"
Expand All @@ -12,7 +13,7 @@
<script setup lang="ts">
import type {BFormProps} from '../../types'
import {useBooleanish} from '../../composables'
import {computed} from 'vue'
import {computed, ref} from 'vue'

const props = withDefaults(defineProps<BFormProps>(), {
floating: false,
Expand All @@ -25,6 +26,8 @@ const emit = defineEmits<{
submit: [value: Event]
}>()

const element = ref<HTMLFormElement | null>(null)

const floatingBoolean = useBooleanish(() => props.floating)
const novalidateBoolean = useBooleanish(() => props.novalidate)
const validatedBoolean = useBooleanish(() => props.validated)
Expand All @@ -42,4 +45,8 @@ const computedClasses = computed(() => ({
const submitted = (e: Event) => {
emit('submit', e)
}

defineExpose({
element,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ const inputClasses = getInputClasses(classesObject)
const labelClasses = getLabelClasses(classesObject)

defineExpose({
element: input,
focus: () => {
focused.value = true
},
blur: () => {
focused.value = false
},
input,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ watch(modelValue, (newValue) => {
})

defineExpose({
element: input,
focus: () => {
focused.value = true
},
blur: () => {
focused.value = false
},
reset,
input,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ const computedClasses = computed(() => {
})

defineExpose({
element: input,
focus,
blur,
input,
})

// const highlight = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ const inputClasses = getInputClasses(classesObject)
const labelClasses = getLabelClasses(classesObject)

defineExpose({
element: input,
focus: () => {
focused.value = true
},
blur: () => {
focused.value = false
},
input,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ const localValue = computed({
})

defineExpose({
element: input,
focus: () => {
focused.value = true
},
blur: () => {
focused.value = false
},
input,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ const removeTag = (tag?: string): void => {

// TODO these focus/blur events aren't quite in line with use useFormInput implementation. Perhaps we should bring them together?
defineExpose({
element: input,
focus: () => {
focused.value = true
},
blur: () => {
focused.value = false
},
input,
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ const computedStyles = computed<CSSProperties>(() => ({
}))

defineExpose({
element: input,
focus,
blur,
input,
})
</script>
7 changes: 6 additions & 1 deletion packages/bootstrap-vue-next/src/components/BToast/BToast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,10 @@ watch(isHovering, (newValue) => {

onBeforeUnmount(stop)

defineExpose({pause, resume, restart, stop})
defineExpose({
pause,
resume,
restart,
stop,
})
</script>
0