Line data Source code
1 16 : <template>
2 221 : <div class="prompt-dialog-content flex flex-col gap-2 pt-8">
3 : <label class="flex flex-col gap-1 text-sm text-muted-foreground">
4 : {{ message }}
5 : <Input
6 : ref="inputRef"
7 : v-model="inputValue"
8 : type="text"
9 : :placeholder
10 : autofocus
11 : @keyup.enter="handleConfirm"
12 : @focus="inputRef?.selectAll()"
13 : />
14 : </label>
15 : <Button @click="handleConfirm">
16 : {{ $t('g.confirm') }}
17 : </Button>
18 : </div>
19 : </template>
20 :
21 : <script setup lang="ts">
22 : import { ref } from 'vue'
23 :
24 : import Button from '@comfyorg/design-system/button/Button'
25 : import Input from '@comfyorg/design-system/input/Input'
26 : import { useDialogStore } from '@/stores/dialogStore'
27 :
28 : const { message, defaultValue, onConfirm, placeholder } = defineProps<{
29 : message: string
30 : defaultValue: string
31 : onConfirm: (value: string) => void
32 : placeholder?: string
33 : }>()
34 :
35 116 : const inputValue = ref<string>(defaultValue)
36 :
37 108 : function handleConfirm() {
38 108 : onConfirm(inputValue.value)
39 108 : useDialogStore().closeDialog()
40 : }
41 :
42 116 : const inputRef = ref<InstanceType<typeof Input>>()
43 : </script>
|