Line data Source code
1 : <template>
2 25 : <AppDialogPanel
3 : body-class="flex flex-1 flex-col gap-4"
4 : class="w-xl max-w-full min-w-116"
5 : @close="emit('close')"
6 : >
7 : <template #title>
8 : {{ $t('builderToolbar.saveAs') }}
9 : </template>
10 :
11 : <div class="flex flex-col gap-2">
12 : <DialogDescription as-child>
13 : <label :for="inputId">
14 : {{ $t('builderToolbar.filename') }}
15 : </label>
16 : </DialogDescription>
17 : <input
18 : :id="inputId"
19 : v-model="filename"
20 : autofocus
21 : type="text"
22 : class="flex h-10 min-h-8 items-center self-stretch rounded-lg border-none bg-secondary pl-4 text-sm focus-visible:ring-ring"
23 : @keydown.enter="
24 : filename.trim() && emit('save', filename.trim(), openAsApp)
25 : "
26 : />
27 : </div>
28 :
29 : <div class="flex flex-col gap-2">
30 : <label :id="radioGroupLabelId" class="text-sm text-muted-foreground">
31 : {{ $t('builderToolbar.defaultViewLabel') }}
32 : </label>
33 : <ViewTypeRadioGroup
34 : v-model="openAsApp"
35 : :aria-labelledby="radioGroupLabelId"
36 : />
37 : </div>
38 :
39 : <template #footer>
40 : <Button variant="muted-textonly" size="lg" @click="emit('close')">
41 : {{ $t('g.cancel') }}
42 : </Button>
43 : <Button
44 : variant="secondary"
45 : size="lg"
46 : :disabled="!filename.trim()"
47 : @click="emit('save', filename.trim(), openAsApp)"
48 : >
49 : {{ $t('g.save') }}
50 : </Button>
51 : </template>
52 : </AppDialogPanel>
53 : </template>
54 :
55 : <script setup lang="ts">
56 : import { ref, useId } from 'vue'
57 :
58 : import Button from '@comfyorg/design-system/button/Button'
59 : import DialogDescription from '@comfyorg/design-system/dialog/DialogDescription'
60 : import AppDialogPanel from '@/components/dialog/AppDialogPanel.vue'
61 :
62 : import ViewTypeRadioGroup from './ViewTypeRadioGroup.vue'
63 :
64 : const { defaultFilename, defaultOpenAsApp = true } = defineProps<{
65 : defaultFilename: string
66 : defaultOpenAsApp?: boolean
67 : }>()
68 :
69 25 : const emit = defineEmits<{
70 : save: [filename: string, openAsApp: boolean]
71 : close: []
72 : }>()
73 :
74 25 : const inputId = useId()
75 25 : const radioGroupLabelId = useId()
76 25 : const filename = ref(defaultFilename)
77 25 : const openAsApp = ref(defaultOpenAsApp)
78 : </script>
|