mirror of
https://github.com/rustfs/console.git
synced 2026-11-03 23:05:19 +08:00
- Auto-format all files to comply with Prettier rules - Fix code style issues in 545 files
40 lines
969 B
Vue
40 lines
969 B
Vue
<script setup lang="ts">
|
|
import type { HTMLAttributes } from 'vue'
|
|
import type { InputGroupVariants } from '.'
|
|
import { cn } from '@/lib/utils'
|
|
import { inputGroupAddonVariants } from '.'
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
align?: InputGroupVariants['align']
|
|
class?: HTMLAttributes['class']
|
|
}>(),
|
|
{
|
|
align: 'inline-start',
|
|
}
|
|
)
|
|
|
|
function handleInputGroupAddonClick(e: MouseEvent) {
|
|
const currentTarget = e.currentTarget as HTMLElement | null
|
|
const target = e.target as HTMLElement | null
|
|
if (target && target.closest('button')) {
|
|
return
|
|
}
|
|
if (currentTarget && currentTarget?.parentElement) {
|
|
currentTarget.parentElement?.querySelector('input')?.focus()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
role="group"
|
|
data-slot="input-group-addon"
|
|
:data-align="props.align"
|
|
:class="cn(inputGroupAddonVariants({ align: props.align }), props.class)"
|
|
@click="handleInputGroupAddonClick"
|
|
>
|
|
<slot />
|
|
</div>
|
|
</template>
|