* components/drive-file-thumbnail.vue * components/drive-select-dialog.vue * components/drive-window.vue * wip * wip drive.file.vue, drive.vue * fix prop * wip( * components/drive.folder.vue * maybe ok * ✌️ * fix variable * FIX FOLDER VARIABLE * components/emoji-picker-dialog.vue * Hate `$emit` * hate global property * components/emoji-picker-window.vue * components/emoji-picker.section.vue * fix * fixx * wip components/emoji-picker.vue * fix * defineExpose * ユニコード絵文字の型をもっといい感じに * components/featured-photos.vue * components/follow-button.vue * forgot-password.vue * forgot-password.vue * 🎨 * fix
58 lines
1.5 KiB
Vue
58 lines
1.5 KiB
Vue
<template>
|
|
<XModalWindow ref="dialog"
|
|
:width="800"
|
|
:height="500"
|
|
:with-ok-button="true"
|
|
:ok-button-disabled="(type === 'file') && (selected.length === 0)"
|
|
@click="cancel()"
|
|
@close="cancel()"
|
|
@ok="ok()"
|
|
@closed="emit('closed')"
|
|
>
|
|
<template #header>
|
|
{{ multiple ? ((type === 'file') ? i18n.locale.selectFiles : i18n.locale.selectFolders) : ((type === 'file') ? i18n.locale.selectFile : i18n.locale.selectFolder) }}
|
|
<span v-if="selected.length > 0" style="margin-left: 8px; opacity: 0.5;">({{ number(selected.length) }})</span>
|
|
</template>
|
|
<XDrive :multiple="multiple" :select="type" @changeSelection="onChangeSelection" @selected="ok()"/>
|
|
</XModalWindow>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
import * as Misskey from 'misskey-js';
|
|
import XDrive from './drive.vue';
|
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
import number from '@/filters/number';
|
|
import { i18n } from '@/i18n';
|
|
|
|
withDefaults(defineProps<{
|
|
type?: 'file' | 'folder';
|
|
multiple: boolean;
|
|
}>(), {
|
|
type: 'file',
|
|
});
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'done', r?: Misskey.entities.DriveFile[]): void;
|
|
(e: 'closed'): void;
|
|
}>();
|
|
|
|
const dialog = ref<InstanceType<typeof XModalWindow>>();
|
|
|
|
const selected = ref<Misskey.entities.DriveFile[]>([]);
|
|
|
|
function ok() {
|
|
emit('done', selected.value);
|
|
dialog.value?.close();
|
|
}
|
|
|
|
function cancel() {
|
|
emit('done');
|
|
dialog.value?.close();
|
|
}
|
|
|
|
function onChangeSelection(files: Misskey.entities.DriveFile[]) {
|
|
selected.value = files;
|
|
}
|
|
</script>
|