refactor: add typing to emits

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/877/head
Varun Patil 2023-10-15 15:09:43 -07:00
parent 080bf1358d
commit 74b6d9c5f2
29 changed files with 126 additions and 34 deletions

View File

@ -61,6 +61,11 @@ export default defineComponent({
}, },
}, },
emits: {
click: (item: ICluster) => true,
plus: () => true,
},
data: () => ({ data: () => ({
recyclerWidth: 300, recyclerWidth: 300,
}), }),

View File

@ -90,6 +90,10 @@ export default defineComponent({
}, },
}, },
emits: {
interactend: () => true,
},
data: () => ({ data: () => ({
/** Last known height at adjustment */ /** Last known height at adjustment */
lastAdjustHeight: 0, lastAdjustHeight: 0,

View File

@ -165,6 +165,10 @@ export default defineComponent({
}, },
}, },
emits: {
updateLoading: (delta: number) => true,
},
data: () => ({ data: () => ({
show: false, show: false,
size: 0, size: 0,

View File

@ -187,6 +187,10 @@ export default defineComponent({
mixins: [UserConfig], mixins: [UserConfig],
emits: {
'update:open': (open: boolean) => true,
},
data: () => ({ data: () => ({
localFolders: [] as nativex.LocalFolderConfig[], localFolders: [] as nativex.LocalFolderConfig[],
}), }),

View File

@ -44,24 +44,25 @@
@click="selectionManager().selectHead(item)" @click="selectionManager().selectHead(item)"
/> />
<Photo <template v-else>
class="photo" <Photo
v-else class="photo"
v-for="photo of item.photos" v-for="photo of item.photos"
:key="photo.key" :key="photo.key"
:style="{ :style="{
height: `${photo.dispH}px`, height: `${photo.dispH}px`,
width: `${photo.dispW}px`, width: `${photo.dispW}px`,
transform: `translate(${photo.dispX}px, ${photo.dispY}px)`, transform: `translate(${photo.dispX}px, ${photo.dispY}px)`,
}" }"
:data="photo" :data="photo"
:day="item.day" :day="item.day"
@select="selectionManager().clickSelectionIcon(photo, $event, index)" @select="selectionManager().clickSelectionIcon(photo, $event, index)"
@pointerdown="selectionManager().clickPhoto(photo, $event, index)" @pointerdown="selectionManager().clickPhoto(photo, $event, index)"
@touchstart="selectionManager().touchstartPhoto(photo, $event, index)" @touchstart="selectionManager().touchstartPhoto(photo, $event, index)"
@touchend="selectionManager().touchendPhoto(photo, $event, index)" @touchend="selectionManager().touchendPhoto(photo, $event, index)"
@touchmove="selectionManager().touchmovePhoto(photo, $event, index)" @touchmove="selectionManager().touchmovePhoto(photo, $event, index)"
/> />
</template>
</template> </template>
</RecycleScroller> </RecycleScroller>
@ -135,6 +136,10 @@ export default defineComponent({
mixins: [UserConfig], mixins: [UserConfig],
emits: {
daysLoaded: (stats: { count: number }) => true,
},
data: () => ({ data: () => ({
/** Loading days response */ /** Loading days response */
loading: 0, loading: 0,

View File

@ -33,6 +33,10 @@ export default defineComponent({
}, },
}, },
emits: {
update: (key: keyof ISystemConfig, value: any) => true,
},
methods: { methods: {
update(key: keyof ISystemConfig, value: any = null) { update(key: keyof ISystemConfig, value: any = null) {
this.$emit('update', key, value); this.$emit('update', key, value);

View File

@ -62,6 +62,10 @@ export default defineComponent({
}, },
}, },
emits: {
click: (item: ICluster) => true,
},
computed: { computed: {
previewUrl() { previewUrl() {
if (this.error) return errorsvg; if (this.error) return errorsvg;

View File

@ -96,6 +96,14 @@ export default defineComponent({
}, },
}, },
emits: {
select: (e: PointerEvent) => true,
pointerdown: (e: PointerEvent) => true,
touchstart: (e: TouchEvent) => true,
touchmove: (e: TouchEvent) => true,
touchend: (e: TouchEvent) => true,
},
data: () => ({ data: () => ({
touchTimer: 0, touchTimer: 0,
faceSrc: null as string | null, faceSrc: null as string | null,

View File

@ -36,6 +36,10 @@ export default defineComponent({
}, },
}, },
emits: {
click: (item: IHeadRow) => true,
},
computed: { computed: {
name() { name() {
// Check cache // Check cache

View File

@ -29,6 +29,11 @@ export default defineComponent({
}, },
}, },
emits: {
load: (src: string) => true,
error: (error: Error) => true,
},
data: () => { data: () => {
return { return {
dataSrc: BLANK_IMG, dataSrc: BLANK_IMG,

View File

@ -37,6 +37,8 @@ export default defineComponent({
AlbumPicker, AlbumPicker,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
photos: [] as IPhoto[], photos: [] as IPhoto[],
@ -66,7 +68,6 @@ export default defineComponent({
this.show = false; this.show = false;
this.photos = []; this.photos = [];
this.opsTotal = 0; this.opsTotal = 0;
this.$emit('close');
}, },
routeIsAlbum(album: IAlbum) { routeIsAlbum(album: IAlbum) {

View File

@ -31,6 +31,8 @@ export default defineComponent({
AlbumForm, AlbumForm,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
album: null as any, album: null as any,
@ -59,7 +61,6 @@ export default defineComponent({
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
done({ album }: { album: { basename: string; filename: string } }) { done({ album }: { album: { basename: string; filename: string } }) {

View File

@ -40,6 +40,8 @@ export default defineComponent({
Modal, Modal,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
user: '', user: '',
@ -65,7 +67,6 @@ export default defineComponent({
methods: { methods: {
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
open() { open() {

View File

@ -124,6 +124,11 @@ export default defineComponent({
}, },
}, },
emits: {
done: (album: any) => true,
back: () => true,
},
data: () => ({ data: () => ({
collaborators: [], collaborators: [],
showCollaboratorView: false, showCollaboratorView: false,

View File

@ -55,7 +55,7 @@
<span class="remove-notice" v-if="deselection.size > 0"> <span class="remove-notice" v-if="deselection.size > 0">
{{ {{
n('memories', 'Removed from {n} album', 'Removed from {n} albums', deselection.size, { n('memories', 'Removed from {n} album', 'Removed from {n} albums', deselection.size, {
n: this.deselection.size, n: deselection.size,
}) })
}} }}
</span> </span>
@ -106,6 +106,11 @@ export default defineComponent({
default: false, default: false,
}, },
}, },
emits: {
select: (selection: IAlbum[], deselection: IAlbum[]) => true,
},
components: { components: {
AlbumForm, AlbumForm,
AlbumsList, AlbumsList,

View File

@ -47,6 +47,8 @@ export default defineComponent({
AlbumCollaborators, AlbumCollaborators,
}, },
emits: [],
data: () => ({ data: () => ({
album: null as any, album: null as any,
show: false, show: false,
@ -58,7 +60,6 @@ export default defineComponent({
close() { close() {
this.show = false; this.show = false;
this.album = null; this.album = null;
this.$emit('close');
}, },
async open() { async open() {

View File

@ -63,6 +63,10 @@ export default defineComponent({
}, },
}, },
emits: {
click: (item: IAlbum) => true,
},
methods: { methods: {
click($event: Event, album: IAlbum) { click($event: Event, album: IAlbum) {
if (!this.link) { if (!this.link) {

View File

@ -50,6 +50,10 @@ export default defineComponent({
}, },
}, },
emits: {
save: () => true,
},
data: () => ({ data: () => ({
exif: null as Record<keyof IExif, string> | null, exif: null as Record<keyof IExif, string> | null,
dirty: {} as Record<keyof IExif, boolean>, dirty: {} as Record<keyof IExif, boolean>,

View File

@ -35,6 +35,8 @@ export default defineComponent({
Modal, Modal,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
user: '', user: '',
@ -54,7 +56,6 @@ export default defineComponent({
methods: { methods: {
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
open() { open() {

View File

@ -45,6 +45,8 @@ export default defineComponent({
Modal, Modal,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
user: '', user: '',
@ -71,7 +73,6 @@ export default defineComponent({
methods: { methods: {
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
open() { open() {

View File

@ -54,6 +54,10 @@ export default defineComponent({
}, },
}, },
emits: {
select: (face: IFace) => true,
},
data: () => ({ data: () => ({
user: String(), user: String(),
name: String(), name: String(),
@ -80,10 +84,6 @@ export default defineComponent({
}, },
methods: { methods: {
close() {
this.$emit('close');
},
async refreshParams() { async refreshParams() {
this.user = <string>this.$route.params.user || ''; this.user = <string>this.$route.params.user || '';
this.name = <string>this.$route.params.name || ''; this.name = <string>this.$route.params.name || '';

View File

@ -48,6 +48,8 @@ export default defineComponent({
FaceList, FaceList,
}, },
emits: [],
data: () => ({ data: () => ({
processing: 0, processing: 0,
processingTotal: 0, processingTotal: 0,
@ -57,7 +59,6 @@ export default defineComponent({
methods: { methods: {
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
open() { open() {

View File

@ -41,6 +41,8 @@ export default defineComponent({
FaceList, FaceList,
}, },
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
photos: [] as IPhoto[], photos: [] as IPhoto[],
@ -76,7 +78,6 @@ export default defineComponent({
close() { close() {
this.photos = []; this.photos = [];
this.show = false; this.show = false;
this.$emit('close');
}, },
moved(photos: IPhoto[]) { moved(photos: IPhoto[]) {

View File

@ -26,6 +26,8 @@ import { defineComponent } from 'vue';
import * as utils from '../../services/utils'; import * as utils from '../../services/utils';
import type { PropType } from 'vue';
const NcModal = () => import('@nextcloud/vue/dist/Components/NcModal'); const NcModal = () => import('@nextcloud/vue/dist/Components/NcModal');
export default defineComponent({ export default defineComponent({
@ -40,7 +42,7 @@ export default defineComponent({
default: 'small', default: 'small',
}, },
sidebar: { sidebar: {
type: String, type: String as PropType<string | null>,
default: null, default: null,
}, },
}, },

View File

@ -58,6 +58,10 @@ export default defineComponent({
}, },
}, },
emits: {
close: (list: string[]) => true,
},
data: () => ({ data: () => ({
show: false, show: false,
paths: [] as string[], paths: [] as string[],

View File

@ -1,5 +1,5 @@
<template> <template>
<Modal @close="close" size="normal" v-if="show" :sidebar="!isRoot && !isMobile ? this.filename : null"> <Modal @close="close" size="normal" v-if="show" :sidebar="!isRoot && !isMobile ? filename : null">
<template #title> <template #title>
{{ t('memories', 'Link Sharing') }} {{ t('memories', 'Link Sharing') }}
</template> </template>
@ -102,6 +102,8 @@ export default defineComponent({
mixins: [UserConfig], mixins: [UserConfig],
emits: [],
data: () => ({ data: () => ({
show: false, show: false,
filename: '', filename: '',
@ -158,7 +160,6 @@ export default defineComponent({
close() { close() {
this.show = false; this.show = false;
this.$emit('close');
}, },
async refreshUrls() { async refreshUrls() {

View File

@ -23,6 +23,10 @@ export default defineComponent({
mixins: [UserMixin], mixins: [UserMixin],
emits: {
load: () => true,
},
computed: { computed: {
currentmatter(): Component | null { currentmatter(): Component | null {
if (this.routeIsFolders) { if (this.routeIsFolders) {

View File

@ -59,6 +59,10 @@ export default defineComponent({
RightMoveIcon, RightMoveIcon,
}, },
emits: {
load: () => true,
},
data: () => ({ data: () => ({
years: [] as IYear[], years: [] as IYear[],
hasRight: false, hasRight: false,

View File

@ -44,6 +44,10 @@ export default defineComponent({
}, },
}, },
emits: {
close: () => true,
},
data: () => ({ data: () => ({
exif: null as Object | null, exif: null as Object | null,
imageEditor: null as FilerobotImageEditor | null, imageEditor: null as FilerobotImageEditor | null,