@@ -21,8 +21,9 @@ SPDX-License-Identifier: AGPL-3.0-only
21
21
22
22
<MkSpacer :marginMin="20" :marginMax="32">
23
23
<div v-if="Object.keys(form).filter(item => !form[item].hidden).length > 0" class="_gaps_m">
24
- <template v-for="(v, k) in Object.fromEntries(Object.entries(form).filter(([_, v]) => !('hidden' in v) || 'hidden' in v && !v.hidden))">
25
- <MkInput v-if="v.type === 'number'" v-model="values[k]" type="number" :step="v.step || 1">
24
+ <template v-for="(v, k) in Object.fromEntries(Object.entries(form))">
25
+ <template v-if="typeof v.hidden == 'function' ? v.hidden(values) : v.hidden"></template>
26
+ <MkInput v-else-if="v.type === 'number'" v-model="values[k]" type="number" :step="v.step || 1">
26
27
<template #label><span v-text="v.label || k"></span><span v-if="v.required === false"> ({{ i18n.ts.optional }})</span></template>
27
28
<template v-if="v.description" #caption>{{ v.description }}</template>
28
29
</MkInput>
@@ -53,6 +54,12 @@ SPDX-License-Identifier: AGPL-3.0-only
53
54
<MkButton v-else-if="v.type === 'button'" @click="v.action($event, values)">
54
55
<span v-text="v.content || k"></span>
55
56
</MkButton>
57
+ <XFile
58
+ v-else-if="v.type === 'drive-file'"
59
+ :fileId="v.defaultFileId"
60
+ :validate="async f => !v.validate || await v.validate(f)"
61
+ @update="f => values[k] = f"
62
+ />
56
63
</template>
57
64
</div>
58
65
<div v-else class="_fullinfo">
@@ -72,6 +79,7 @@ import MkSelect from './MkSelect.vue';
72
79
import MkRange from './MkRange.vue';
73
80
import MkButton from './MkButton.vue';
74
81
import MkRadios from './MkRadios.vue';
82
+ import XFile from './MkFormDialog.file.vue';
75
83
import type { Form } from '@/scripts/form.js';
76
84
import MkModalWindow from '@/components/MkModalWindow.vue';
77
85
import { i18n } from '@/i18n.js';
0 commit comments