f7cloud_client/apps/tasks/js/tasks-dashboard.mjs.map
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

1 line
16 KiB
Plaintext

{"version":3,"file":"tasks-dashboard.mjs","sources":["../src/components/TaskIcon.vue","../src/views/Dashboard.vue","../src/dashboard.js"],"sourcesContent":["<!--\nNextcloud - Tasks\n\n@author Raimund Schlüßler\n@copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE\nLicense as published by the Free Software Foundation; either\nversion 3 of the License, or any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU AFFERO GENERAL PUBLIC LICENSE for more details.\n\nYou should have received a copy of the GNU Affero General Public\nLicense along with this library. If not, see <http://www.gnu.org/licenses/>.\n\n-->\n\n<template>\n\t<span role=\"img\"\n\t\tclass=\"task-icon\">\n\t\t<svg :width=\"size\"\n\t\t\t:height=\"size\"\n\t\t\tviewBox=\"0 0 32 32\">\n\t\t\t<path :fill=\"color\"\n\t\t\t\t:stroke=\"color\"\n\t\t\t\tstroke-miterlimit=\"10\"\n\t\t\t\tstroke-width=\".75\"\n\t\t\t\td=\"m14.383 26.764s0.259-0.716 0.563-1.367c4.908-10.57 11.212-17.53 14.008-20.69 2.264-2.559 1.378-2.156 0.375-1.503-4.09 2.659-11.742 11.206-14.668 14.169-0.542 0.545-1.769 1.833-2.045 1.833-0.313 0-1.358-0.481-1.955-0.833-2.282-1.338-4.464-2.643-5.834-3.136-2.917-1.049-2.092-0.052-1.926 0.281 0.521 1.042 7.566 6.689 9.899 9.356 0.722 0.824 1.583 1.89 1.583 1.89z\" />\n\t\t</svg>\n\t</span>\n</template>\n\n<script>\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\tcolor: 'currentColor',\n\t\t}\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.task-icon {\n\tdisplay: flex;\n\talign-self: center;\n\tjustify-self: center;\n\talign-items: center;\n\tjustify-content: center;\n}\n</style>\n","<!--\nNextcloud - Tasks\n\n@author Jakob Röhrl\n@copyright 2021 Jakob Röhrl <jakob.roehrl@web.de>\n\n@author Raimund Schlüßler\n@copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE\nLicense as published by the Free Software Foundation; either\nversion 3 of the License, or any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU AFFERO GENERAL PUBLIC LICENSE for more details.\n\nYou should have received a copy of the GNU Affero General Public\nLicense along with this library. If not, see <http://www.gnu.org/licenses/>.\n\n-->\n<template>\n\t<div>\n\t\t<NcDashboardWidget id=\"tasks_panel\"\n\t\t\t:items=\"filteredTasks.slice(0, hasTaskToday ? 6 : 4)\"\n\t\t\t:empty-content-message=\"t('tasks', 'No upcoming tasks')\"\n\t\t\t:show-more-text=\"t('tasks', 'upcoming tasks')\"\n\t\t\t:loading=\"loading\"\n\t\t\t:show-items-and-empty-content=\"!hasTaskToday\"\n\t\t\t:half-empty-content-message=\"t('tasks', 'No tasks today')\">\n\t\t\t<template #default=\"{ item }\">\n\t\t\t\t<NcDashboardWidgetItem :main-text=\"item.summary\"\n\t\t\t\t\t:sub-text=\"formatSubtext(item)\"\n\t\t\t\t\t:target-url=\"getTasksAppUrl(item)\">\n\t\t\t\t\t<template #avatar>\n\t\t\t\t\t\t<div class=\"calendar-dot\"\n\t\t\t\t\t\t\t:style=\"{'background-color': item.calendar.color}\"\n\t\t\t\t\t\t\t:title=\"item.calendar.displayName\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t<template #actions>\n\t\t\t\t\t\t<NcActionButton v-if=\"!item.calendar.readOnly && !(item.calendar.isSharedWithMe && item.class !== 'PUBLIC')\"\n\t\t\t\t\t\t\t:close-after-click=\"true\"\n\t\t\t\t\t\t\t@click=\"onMarkAsDone(item)\">\n\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t<Check :size=\"20\" decorative />\n\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t{{ t('tasks', 'Mark as done') }}\n\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t</template>\n\t\t\t\t</NcDashboardWidgetItem>\n\t\t\t</template>\n\t\t\t<template #emptyContentIcon>\n\t\t\t\t<TaskIcon />\n\t\t\t</template>\n\t\t</NcDashboardWidget>\n\t\t<div v-if=\"!loading\" class=\"center-button\">\n\t\t\t<NcButton @click=\"toggleAddTaskModel\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<Plus :size=\"20\" decorative />\n\t\t\t\t</template>\n\t\t\t\t{{ t('tasks', 'Create a new task') }}\n\t\t\t</NcButton>\n\t\t\t<TaskCreateDialog v-if=\"showAddTaskModal\" @close=\"toggleAddTaskModel\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport TaskCreateDialog from '../components/TaskCreateDialog.vue'\nimport TaskIcon from '../components/TaskIcon.vue'\nimport client from '../services/cdav.js'\nimport { sort, isTaskInList } from '../store/storeHelper.js'\n\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport NcActionButton from '@nextcloud/vue/components/NcActionButton'\nimport NcButton from '@nextcloud/vue/components/NcButton'\nimport NcDashboardWidget from '@nextcloud/vue/components/NcDashboardWidget'\nimport NcDashboardWidgetItem from '@nextcloud/vue/components/NcDashboardWidgetItem'\n\nimport Check from 'vue-material-design-icons/Check.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\n\nimport { mapGetters, mapActions } from 'vuex'\n\nexport default {\n\tname: 'Dashboard',\n\tcomponents: {\n\t\tNcActionButton,\n\t\tNcButton,\n\t\tCheck,\n\t\tNcDashboardWidget,\n\t\tNcDashboardWidgetItem,\n\t\tTaskCreateDialog,\n\t\tPlus,\n\t\tTaskIcon,\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tloading: true,\n\t\t\ttasks: [],\n\t\t\tshowAddTaskModal: false,\n\t\t\titemMenu: {\n\t\t\t\tmarkAsDone: {\n\t\t\t\t\ttext: t('tasks', 'Mark as done'),\n\t\t\t\t\ticon: 'icon-checkmark',\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t},\n\tcomputed: {\n\t\t...mapGetters({\n\t\t\tcalendars: 'getTaskCalendars',\n\t\t}),\n\t\thasTaskToday() {\n\t\t\treturn this.filteredTasks.some(task => isTaskInList(task, 'today'))\n\t\t},\n\t\tfilteredTasks() {\n\t\t\treturn sort(this.tasks.filter(task => !task.closed))\n\t\t},\n\t},\n\tmounted() {\n\t\tthis.initializeEnvironment()\n\t},\n\tmethods: {\n\t\tt,\n\n\t\t...mapActions([\n\t\t\t'toggleCompleted',\n\t\t]),\n\n\t\tasync initializeEnvironment() {\n\t\t\tawait client.connect({ enableCalDAV: true })\n\t\t\tawait this.$store.dispatch('fetchCurrentUserPrincipal')\n\t\t\tlet { calendars } = await this.$store.dispatch('getCalendarsAndTrashBin')\n\t\t\tcalendars = calendars.filter(calendar => calendar.supportsTasks)\n\t\t\tconst owners = []\n\t\t\tcalendars.forEach((calendar) => {\n\t\t\t\tif (owners.indexOf(calendar.owner) === -1) {\n\t\t\t\t\towners.push(calendar.owner)\n\t\t\t\t}\n\t\t\t})\n\t\t\towners.forEach((owner) => {\n\t\t\t\tthis.$store.dispatch('fetchPrincipalByUrl', {\n\t\t\t\t\turl: owner,\n\t\t\t\t})\n\t\t\t})\n\t\t\t// No calendars? Create a new one!\n\t\t\tif (calendars.length === 0) {\n\t\t\t\tconst color = this.$OCA.Theming?.color || '#0082C9'\n\t\t\t\tawait this.$store.dispatch('appendCalendar', { displayName: t('tasks', 'Tasks'), color })\n\t\t\t}\n\t\t\tawait this.fetchTasks()\n\t\t},\n\t\tasync fetchTasks() {\n\t\t\tthis.loading = true\n\t\t\tconst results = await Promise.all(this.calendars.map(calendar =>\n\t\t\t\tthis.$store.dispatch('getTasksFromCalendar', { calendar, completed: false, related: null }),\n\t\t\t))\n\t\t\tthis.tasks = [...results.flat()]\n\t\t\tthis.loading = false\n\t\t},\n\t\t/**\n\t\t * @param {object} task The task to format\n\t\t * @return {string}\n\t\t */\n\t\tformatSubtext(task) {\n\t\t\tif (!task.dueMoment.isValid()) {\n\t\t\t\treturn t('tasks', 'No due date assigned')\n\t\t\t}\n\t\t\tif (task.allDay) {\n\t\t\t\treturn task.dueMoment.calendar(null, {\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tlastDay: t('tasks', '[Due yesterday]'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tsameDay: t('tasks', '[Due today]'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tnextDay: t('tasks', '[Due tomorrow]'),\n\t\t\t\t\tlastWeek: t('tasks', '[Due] L'),\n\t\t\t\t\tnextWeek: t('tasks', '[Due] L'),\n\t\t\t\t\tsameElse: t('tasks', '[Due] L'),\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\treturn task.dueMoment.calendar(null, {\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tlastDay: t('tasks', '[Due yesterday at] LT'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tsameDay: t('tasks', '[Due today at] LT'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tnextDay: t('tasks', '[Due tomorrow at] LT'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tlastWeek: t('tasks', '[Due] L [at] LT'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tnextWeek: t('tasks', '[Due] L [at] LT'),\n\t\t\t\t\t// TRANSLATORS This is a string for moment.js. The square brackets escape the string from moment.js. Please translate the string and keep the brackets.\n\t\t\t\t\tsameElse: t('tasks', '[Due] L [at] LT'),\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * @param {object} task The task to generate the URL for\n\t\t * @return {string}\n\t\t */\n\t\tgetTasksAppUrl(task) {\n\t\t\treturn generateUrl('apps/tasks') + `/calendars/${task.calendar.id}/tasks/${task.uri}`\n\t\t},\n\n\t\ttoggleAddTaskModel() {\n\t\t\tthis.showAddTaskModal = !this.showAddTaskModal\n\t\t},\n\n\t\tasync onMarkAsDone(item) {\n\t\t\tawait this.toggleCompleted(item)\n\t\t\tawait this.fetchTasks()\n\t\t},\n\t},\n\n}\n</script>\n\n<style lang=\"scss\">\n#tasks_panel {\n\t.calendar-dot {\n\t\theight: 1rem;\n\t\twidth: 1rem;\n\t\tmargin-top: .2rem;\n\t\tborder-radius: 50%;\n\t\tmin-width: 1rem;\n\t\tmin-height: 1rem;\n\t}\n}\n\n.center-button {\n\tdisplay: flex;\n\tjustify-content: center;\n\tmargin-top: 10px;\n}\n</style>\n","/**\n * Nextcloud - Tasks\n *\n * @copyright Copyright (c) 2021 Jakob Röhrl\n *\n * @author Jakob Röhrl <jakob.roehrl@web.de>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport Dashboard from './views/Dashboard.vue'\nimport store from './store/store.js'\n\nimport { createApp } from 'vue'\n\ndocument.addEventListener('DOMContentLoaded', () => {\n\tOCA.Dashboard.register('tasks', (el) => {\n\t\tconst item = createApp(Dashboard)\n\t\t\t.use(store)\n\t\t\t.mount(el)\n\t\treturn item\n\t})\n})\n"],"names":["_sfc_main","_openBlock","_createElementBlock","_hoisted_1","_ctx","_createElementVNode","$data","NcActionButton","NcButton","Check","NcDashboardWidget","NcDashboardWidgetItem","TaskCreateDialog","Plus","TaskIcon","t","mapGetters","task","isTaskInList","sort","mapActions","client","calendars","calendar","owners","owner","color","results","generateUrl","item","_createVNode","_component_NcDashboardWidget","$options","_withCtx","_component_NcDashboardWidgetItem","_normalizeStyle","_createBlock","_component_NcActionButton","$event","_component_Check","_createTextVNode","_component_TaskIcon","_hoisted_2","_component_NcButton","_component_Plus","_component_TaskCreateDialog","el","createApp","Dashboard","store"],"mappings":"sUAqCA,MAAKA,EAAU,CACd,MAAO,CACN,MAAO,CACN,MAAO,cACR,CACD,CACD,KArBO,KAAK,MACV,MAAM,8EADP,OAAAC,EAAA,EAAAC,EAWO,OAXPC,EAWO,MATND,EAQM,MAAA,CARA,MAAOE,EAAA,KACX,OAAQA,EAAA,KACT,QAAQ,cACRC,EAIkX,OAAA,CAJ3W,KAAMC,EAAA,MACX,OAAQA,EAAA,MACT,oBAAkB,KAClB,eAAa,MACb,EAAE,6bCwDDN,EAAU,CACd,KAAM,YACN,WAAY,CACX,eAAAO,EACA,SAAAC,EACA,MAAAC,EACA,kBAAAC,EACA,sBAAAC,EACA,iBAAAC,EACA,KAAAC,EACA,SAAAC,GAED,MAAO,CACN,MA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