feat: function attribute typing
This commit is contained in:
@ -27,7 +27,7 @@ const route = useRoute()
|
||||
|
||||
async function deleteSavedFilter() {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
||||
const savedFilterId = getSavedFilterIdFromListId(Number((route.params.listId as string)))
|
||||
|
||||
const filterService = new SavedFilterService()
|
||||
const filter = new SavedFilterModel({id: savedFilterId})
|
||||
|
@ -52,11 +52,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, shallowRef, computed, watch} from 'vue'
|
||||
import {ref, shallowRef, computed, watch, unref } from 'vue'
|
||||
import {useRouter, useRoute} from 'vue-router'
|
||||
import {store} from '@/store'
|
||||
import {success} from '@/message'
|
||||
import {success} from '@/message'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
import type {MaybeRef} from '@vueuse/core'
|
||||
|
||||
import {default as Editor} from '@/components/input/AsyncEditor'
|
||||
import CreateEdit from '@/components/misc/create-edit.vue'
|
||||
@ -67,10 +68,11 @@ import SavedFilterService from '@/services/savedFilter'
|
||||
|
||||
import {objectToSnakeCase} from '@/helpers/case'
|
||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||
import type ListModel from '@/models/list'
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
function useSavedFilter(listId) {
|
||||
function useSavedFilter(listId: MaybeRef<ListModel['id']>) {
|
||||
const filterService = shallowRef(new SavedFilterService())
|
||||
|
||||
const filter = ref(new SavedFilterModel())
|
||||
@ -82,9 +84,9 @@ function useSavedFilter(listId) {
|
||||
})
|
||||
|
||||
// loadSavedFilter
|
||||
watch(listId, async () => {
|
||||
watch(() => unref(listId), async () => {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
||||
const savedFilterId = getSavedFilterIdFromListId(Number(route.params.listId as string))
|
||||
|
||||
filter.value = new SavedFilterModel({id: savedFilterId})
|
||||
const response = await filterService.value.get(filter.value)
|
||||
@ -110,7 +112,7 @@ function useSavedFilter(listId) {
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
const listId = computed(() => route.params.listId)
|
||||
const listId = computed(() => Number(route.params.listId as string))
|
||||
|
||||
const {
|
||||
save,
|
||||
|
@ -149,7 +149,7 @@ export default defineComponent({
|
||||
loading: state => state[LOADING] && state[LOADING_MODULE] === 'labels',
|
||||
}),
|
||||
methods: {
|
||||
deleteLabel(label) {
|
||||
deleteLabel(label: LabelModel) {
|
||||
this.showDeleteModal = false
|
||||
this.isLabelEdit = false
|
||||
return this.$store.dispatch('labels/deleteLabel', label)
|
||||
@ -157,7 +157,7 @@ export default defineComponent({
|
||||
editLabelSubmit() {
|
||||
return this.$store.dispatch('labels/updateLabel', this.labelEditLabel)
|
||||
},
|
||||
editLabel(label) {
|
||||
editLabel(label: LabelModel) {
|
||||
if (label.createdBy.id !== this.userInfo.id) {
|
||||
return
|
||||
}
|
||||
@ -179,7 +179,7 @@ export default defineComponent({
|
||||
this.editorActive = false
|
||||
this.$nextTick(() => this.editorActive = true)
|
||||
},
|
||||
showDeleteDialoge(label) {
|
||||
showDeleteDialoge(label: LabelModel) {
|
||||
this.labelToDelete = label
|
||||
this.showDeleteModal = true
|
||||
},
|
||||
|
@ -153,8 +153,9 @@ import {ALPHABETICAL_SORT} from '@/components/list/partials/filters.vue'
|
||||
|
||||
import draggable from 'zhyswan-vuedraggable'
|
||||
import {calculateItemPosition} from '../../helpers/calculateItemPosition'
|
||||
import type TaskModel from '@/models/task'
|
||||
|
||||
function sortTasks(tasks) {
|
||||
function sortTasks(tasks: TaskModel[]) {
|
||||
if (tasks === null || tasks === []) {
|
||||
return
|
||||
}
|
||||
@ -273,7 +274,7 @@ export default defineComponent({
|
||||
focusNewTaskInput() {
|
||||
this.$refs.addTask.focusTaskInput()
|
||||
},
|
||||
updateTaskList( task ) {
|
||||
updateTaskList(task: TaskModel) {
|
||||
if ( this.isAlphabeticalSorting ) {
|
||||
// reload tasks with current filter and sorting
|
||||
this.loadTasks(1, undefined, undefined, true)
|
||||
@ -287,11 +288,11 @@ export default defineComponent({
|
||||
|
||||
this.$store.commit(HAS_TASKS, true)
|
||||
},
|
||||
editTask(id) {
|
||||
editTask(id: TaskModel['id']) {
|
||||
this.taskEditTask = {...this.tasks.find(t => t.id === parseInt(id))}
|
||||
this.isTaskEdit = true
|
||||
},
|
||||
updateTasks(updatedTask) {
|
||||
updateTasks(updatedTask: TaskModel) {
|
||||
for (const t in this.tasks) {
|
||||
if (this.tasks[t].id === updatedTask.id) {
|
||||
this.tasks[t] = updatedTask
|
||||
|
@ -453,6 +453,7 @@ import {uploadFile} from '@/helpers/attachments'
|
||||
import ChecklistSummary from '../../components/tasks/partials/checklist-summary.vue'
|
||||
import CreatedUpdated from '@/components/tasks/partials/createdUpdated.vue'
|
||||
import { setTitle } from '@/helpers/setTitle'
|
||||
import type ListModel from '@/models/list'
|
||||
|
||||
function scrollIntoView(el) {
|
||||
if (!el) {
|
||||
@ -592,7 +593,7 @@ export default defineComponent({
|
||||
return uploadFile(this.taskId, ...args)
|
||||
},
|
||||
|
||||
async loadTask(taskId) {
|
||||
async loadTask(taskId: TaskModel['id']) {
|
||||
if (taskId === undefined) {
|
||||
return
|
||||
}
|
||||
@ -698,7 +699,7 @@ export default defineComponent({
|
||||
this.saveTask(true, this.toggleTaskDone)
|
||||
},
|
||||
|
||||
async changeList(list) {
|
||||
async changeList(list: ListModel) {
|
||||
this.$store.commit('kanban/removeTaskInBucket', this.task)
|
||||
this.task.listId = list.id
|
||||
await this.saveTask()
|
||||
|
@ -257,7 +257,7 @@ async function addUser() {
|
||||
success({message: t('team.edit.userAddedSuccess')})
|
||||
}
|
||||
|
||||
async function toggleUserType(member) {
|
||||
async function toggleUserType(member: TeamMemberModel) {
|
||||
// FIXME: direct manipulation
|
||||
member.admin = !member.admin
|
||||
member.teamId = teamId.value
|
||||
|
Reference in New Issue
Block a user