fix ts errors in various files
This commit is contained in:
parent
98b41a22c6
commit
de3c47dc69
11 changed files with 58 additions and 20 deletions
|
@ -44,7 +44,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {watch, computed, shallowRef, watchEffect, h} from 'vue'
|
||||
import {watch, computed, shallowRef, watchEffect, VNode, h} from 'vue'
|
||||
import {useStore} from 'vuex'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
import {useEventListener} from '@vueuse/core'
|
||||
|
@ -66,12 +66,12 @@ function useRouteWithModal() {
|
|||
}
|
||||
})
|
||||
|
||||
const currentModal = shallowRef(null)
|
||||
const currentModal = shallowRef<VNode>()
|
||||
watchEffect(() => {
|
||||
const hasBackdropView = historyState.value.backdropView
|
||||
|
||||
if (!hasBackdropView) {
|
||||
currentModal.value = null
|
||||
currentModal.value = undefined
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { computed, watchEffect } from 'vue'
|
||||
import { setTitle } from '@/helpers/setTitle'
|
||||
|
||||
import { ComputedGetter, ComputedRef } from '@vue/reactivity'
|
||||
import { ComputedGetter } from '@vue/reactivity'
|
||||
|
||||
export function useTitle<T>(titleGetter: ComputedGetter<T>) : ComputedRef<T> {
|
||||
export function useTitle(titleGetter: ComputedGetter<string>) {
|
||||
const titleRef = computed(titleGetter)
|
||||
|
||||
watchEffect(() => setTitle(titleRef.value))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export function setTitle(title) {
|
||||
export function setTitle(title : undefined | string) {
|
||||
document.title = (typeof title === 'undefined' || title === '')
|
||||
? 'Vikunja'
|
||||
: `${title} | Vikunja`
|
|
@ -3,6 +3,12 @@ import UserModel from './user'
|
|||
import FileModel from './file'
|
||||
|
||||
export default class AttachmentModel extends AbstractModel {
|
||||
id = 0
|
||||
taskId = 0
|
||||
file = FileModel
|
||||
createdBy = UserModel
|
||||
created = null
|
||||
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.createdBy = new UserModel(this.createdBy)
|
||||
|
|
|
@ -2,6 +2,12 @@ import AbstractModel from '@/models/abstractModel'
|
|||
import UserModel from '@/models/user'
|
||||
|
||||
export default class SubscriptionModel extends AbstractModel {
|
||||
id = 0
|
||||
entity = ''
|
||||
entityId = 0
|
||||
created = null
|
||||
user = UserModel
|
||||
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.user = new UserModel(this.user)
|
||||
|
|
|
@ -10,6 +10,10 @@ import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
|||
const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype
|
||||
|
||||
export default class TaskModel extends AbstractModel {
|
||||
index = 0
|
||||
done = false
|
||||
priority = 0
|
||||
percentDone = 0
|
||||
|
||||
defaultColor = '198CFF'
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ const router = createRouter({
|
|||
path: '/tasks/:id',
|
||||
name: 'task.detail',
|
||||
component: TaskDetailViewModal,
|
||||
props: route => ({ taskId: parseInt(route.params.id) }),
|
||||
props: route => ({ taskId: parseInt(route.params.id as string) }),
|
||||
},
|
||||
{
|
||||
path: '/tasks/by/upcoming',
|
||||
|
@ -344,28 +344,28 @@ const router = createRouter({
|
|||
name: 'list.list',
|
||||
component: ListList,
|
||||
beforeEnter: (to) => saveListView(to.params.listId, to.name),
|
||||
props: route => ({ listId: parseInt(route.params.listId) }),
|
||||
props: route => ({ listId: parseInt(route.params.listId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/lists/:listId/gantt',
|
||||
name: 'list.gantt',
|
||||
component: ListGantt,
|
||||
beforeEnter: (to) => saveListView(to.params.listId, to.name),
|
||||
props: route => ({ listId: parseInt(route.params.listId) }),
|
||||
props: route => ({ listId: parseInt(route.params.listId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/lists/:listId/table',
|
||||
name: 'list.table',
|
||||
component: ListTable,
|
||||
beforeEnter: (to) => saveListView(to.params.listId, to.name),
|
||||
props: route => ({ listId: parseInt(route.params.listId) }),
|
||||
props: route => ({ listId: parseInt(route.params.listId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/lists/:listId/kanban',
|
||||
name: 'list.kanban',
|
||||
component: ListKanban,
|
||||
beforeEnter: (to) => saveListView(to.params.listId, to.name),
|
||||
props: route => ({ listId: parseInt(route.params.listId) }),
|
||||
props: route => ({ listId: parseInt(route.params.listId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/teams',
|
||||
|
|
|
@ -18,6 +18,8 @@ import lists from './modules/lists'
|
|||
import attachments from './modules/attachments'
|
||||
import labels from './modules/labels'
|
||||
|
||||
import ListModel from '@/models/list'
|
||||
|
||||
import ListService from '../services/list'
|
||||
import {checkAndSetApiUrl} from '@/helpers/checkAndSetApiUrl'
|
||||
|
||||
|
@ -37,10 +39,10 @@ export const store = createStore({
|
|||
loading: false,
|
||||
loadingModule: null,
|
||||
// This is used to highlight the current list in menu for all list related views
|
||||
currentList: {
|
||||
currentList: new ListModel({
|
||||
id: 0,
|
||||
isArchived: false,
|
||||
},
|
||||
}),
|
||||
background: '',
|
||||
hasTasks: false,
|
||||
menuActive: true,
|
||||
|
|
1
src/types/vue-flatpickr-component.d.ts
vendored
Normal file
1
src/types/vue-flatpickr-component.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
declare module 'vue-flatpickr-component';
|
|
@ -180,7 +180,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { toRef, computed } from 'vue'
|
||||
import { toRef, computed, Ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import { useStorage } from '@vueuse/core'
|
||||
|
@ -198,6 +198,7 @@ import Pagination from '@/components/misc/pagination.vue'
|
|||
import Popup from '@/components/misc/popup.vue'
|
||||
|
||||
import { useTaskList } from '@/composables/taskList'
|
||||
import TaskModel from '@/models/task'
|
||||
|
||||
const ACTIVE_COLUMNS_DEFAULT = {
|
||||
id: true,
|
||||
|
@ -222,20 +223,37 @@ const props = defineProps({
|
|||
},
|
||||
})
|
||||
|
||||
const SORT_BY_DEFAULT = {
|
||||
type Order = 'asc' | 'desc' | 'none'
|
||||
|
||||
interface SortBy {
|
||||
id : Order
|
||||
done? : Order
|
||||
title? : Order
|
||||
priority? : Order
|
||||
due_date? : Order
|
||||
start_date? : Order
|
||||
end_date? : Order
|
||||
percent_done? : Order
|
||||
created? : Order
|
||||
updated? : Order
|
||||
}
|
||||
|
||||
const SORT_BY_DEFAULT : SortBy = {
|
||||
id: 'desc',
|
||||
}
|
||||
|
||||
const activeColumns = useStorage('tableViewColumns', { ...ACTIVE_COLUMNS_DEFAULT })
|
||||
const sortBy = useStorage('tableViewSortBy', { ...SORT_BY_DEFAULT })
|
||||
const sortBy = useStorage<SortBy>('tableViewSortBy', { ...SORT_BY_DEFAULT })
|
||||
|
||||
const taskList = useTaskList(toRef(props, 'listId'))
|
||||
|
||||
const {
|
||||
tasks,
|
||||
loading,
|
||||
params,
|
||||
totalPages,
|
||||
currentPage,
|
||||
} = useTaskList(toRef(props, 'listId'))
|
||||
} = taskList
|
||||
const tasks : Ref<TaskModel[]> = taskList.tasks
|
||||
|
||||
Object.assign(params.value, {
|
||||
filter_by: [],
|
||||
|
@ -244,7 +262,7 @@ Object.assign(params.value, {
|
|||
})
|
||||
|
||||
// FIXME: by doing this we can have multiple sort orders
|
||||
function sort(property) {
|
||||
function sort(property : keyof SortBy) {
|
||||
const order = sortBy.value[property]
|
||||
if (typeof order === 'undefined' || order === 'none') {
|
||||
sortBy.value[property] = 'desc'
|
||||
|
|
|
@ -83,6 +83,7 @@ const currentList = computed(() => {
|
|||
id: 0,
|
||||
title: '',
|
||||
isArchived: false,
|
||||
maxRight: null,
|
||||
} : store.state.currentList
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue