fix: Adapt to new nextcloud vue version

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2024-02-08 10:12:57 +01:00
parent 2e3b169b69
commit e1de6d317b
26 changed files with 252 additions and 184 deletions

View File

@@ -69,11 +69,13 @@ describe('Card', function() {
.first().click() .first().click()
cy.get('.modal-mask.card-selector .card-title').should('be.visible').click().type(newCardTitle) cy.get('.modal-mask.card-selector .card-title').should('be.visible').click().type(newCardTitle)
cy.get('.modal-mask.card-selector .multiselect-board').should('be.visible').click() cy.get('.modal-mask.card-selector .multiselect-board').should('be.visible').click()
cy.get('.modal-mask.card-selector .multiselect-board li:contains("' + boardData.title + '")').should('be.visible').click() cy.get('.vs__dropdown-menu [data-cy="board-select-title"]:contains("' + boardData.title + '")').should('be.visible').click()
cy.wait('@getBoard', { timeout: 7000 }) cy.wait('@getBoard', { timeout: 7000 })
cy.get('.modal-mask.card-selector .multiselect-list').should('be.visible').click() cy.get('.modal-mask.card-selector .multiselect-list').should('be.visible').click()
cy.get('.modal-mask.card-selector .multiselect-list li').eq(0).should('be.visible').click() cy.get('.vs__dropdown-menu span[title="TestList"]').should('be.visible').click()
cy.get('.modal-mask.card-selector button.button-vue--vue-primary').should('be.visible').click() cy.get('.modal-mask.card-selector button.button-vue--vue-primary').should('be.visible').click()
cy.wait('@save', { timeout: 7000 }) cy.wait('@save', { timeout: 7000 })
@@ -101,13 +103,13 @@ describe('Card', function() {
}) })
cy.get('.modal__card').should('be.visible') cy.get('.modal__card').should('be.visible')
cy.get('.app-sidebar-header__maintitle').contains('Hello world') cy.get('.app-sidebar-header__mainname').contains('Hello world')
}) })
it('Attachment from files app', () => { it('Attachment from files app', () => {
cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('.card:contains("Hello world")').should('be.visible').click()
cy.get('.modal__card').should('be.visible') cy.get('.modal__card').should('be.visible')
cy.get('.app-sidebar-tabs__tab [data-id="attachments"]').click() cy.get('#tab-button-attachments').click()
cy.get('button.icon-upload').should('be.visible') cy.get('button.icon-upload').should('be.visible')
cy.get('button.icon-folder').should('be.visible') cy.get('button.icon-folder').should('be.visible')
.click() .click()
@@ -118,11 +120,11 @@ describe('Card', function() {
cy.get('.attachment-list .basename').contains('welcome.txt') cy.get('.attachment-list .basename').contains('welcome.txt')
}) })
it('Shows the modal with the editor', () => { it.only('Shows the modal with the editor', () => {
cy.get('.card:contains("Hello world")').should('be.visible').click() cy.get('.card:contains("Hello world")').should('be.visible').click()
cy.intercept({ method: 'PUT', url: '**/apps/deck/cards/*' }).as('save') cy.intercept({ method: 'PUT', url: '**/apps/deck/cards/*' }).as('save')
cy.get('.modal__card').should('be.visible') cy.get('.modal__card').should('be.visible')
cy.get('.app-sidebar-header__maintitle').contains('Hello world') cy.get('.app-sidebar-header__mainname').contains('Hello world')
cy.get('.modal__card .ProseMirror h1').contains('Hello world').should('be.visible') cy.get('.modal__card .ProseMirror h1').contains('Hello world').should('be.visible')
cy.get('.modal__card .ProseMirror h1') cy.get('.modal__card .ProseMirror h1')
.click() .click()
@@ -229,20 +231,13 @@ describe('Card', function() {
cy.get(`.card:contains("${newCardTitle}")`).should('be.visible').click() cy.get(`.card:contains("${newCardTitle}")`).should('be.visible').click()
cy.get('#app-sidebar-vue [data-test="tag-selector"]').should('be.visible').click() cy.get('#app-sidebar-vue [data-test="tag-selector"]').should('be.visible').click()
cy.get('.multiselect__option:contains("Action needed")').should('be.visible').click() cy.get('.vs__dropdown-menu .tag:contains("Action needed")').should('be.visible').click()
cy.get('.vs__selected .tag:contains("Action needed")').should('be.visible')
cy.get('.vs__dropdown-menu .tag:contains("Later")').should('be.visible').click()
cy.get('[data-test="tag-selector"] .selector-wrapper--icon').click() cy.get('.vs__selected .tag:contains("Action needed")').should('be.visible')
cy.get('.multiselect__option:contains("Action needed")').should('not.be.visible') cy.get('.vs__selected .tag:contains("Action needed")')
.parent().find('button').click()
cy.get('[data-test="tag-selector"] .multiselect__tags .tag:contains("Action needed")')
.should('be.visible')
cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Action needed")')
.should('be.visible')
cy.get('#app-sidebar-vue [data-test="tag-selector"]').should('be.visible').click()
cy.get('.multiselect__option:contains("Later")').should('be.visible').click()
cy.get('.multiselect__option:contains("Action needed")').should('be.visible').click()
cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Later")') cy.get(`.card:contains("${newCardTitle}")`).find('.labels li:contains("Later")')
.should('be.visible') .should('be.visible')

View File

@@ -38,7 +38,10 @@ describe('Board', function() {
cy.get('.board-title').contains(board.title) cy.get('.board-title').contains(board.title)
cy.shareBoardWithUi(recipient.userId) cy.shareBoardWithUi(recipient.userId)
cy.intercept({ method: 'PUT', url: '**/apps/deck/boards/*/acl/*' }).as('setAcl')
cy.get(`[data-cy="acl-participant:${recipient.userId}"]`).find('[data-cy="action:permission-edit"]').click() cy.get(`[data-cy="acl-participant:${recipient.userId}"]`).find('[data-cy="action:permission-edit"]').click()
cy.wait('@setAcl')
cy.login(recipient) cy.login(recipient)
cy.visit(`/apps/deck/#/board/${boardId}`) cy.visit(`/apps/deck/#/board/${boardId}`)

View File

@@ -107,11 +107,14 @@ Cypress.Commands.add('getNavigationEntry', (boardTitle) => {
}) })
Cypress.Commands.add('shareBoardWithUi', (userId) => { Cypress.Commands.add('shareBoardWithUi', (userId) => {
cy.intercept({ method: 'GET', url: `**/ocs/v2.php/apps/files_sharing/api/v1/sharees?search=${userId}*` }).as('fetchRecipients')
cy.get('[aria-label="Open details"]').click() cy.get('[aria-label="Open details"]').click()
cy.get('.app-sidebar').should('be.visible') cy.get('.app-sidebar').should('be.visible')
cy.get('.multiselect__input').type(`${userId}`) cy.get('.select input').type(`${userId}`)
cy.get('.multiselect__content .multiselect__element').first().contains(userId) cy.wait('@fetchRecipients', { timeout: 7000 })
cy.get('.multiselect__input').type('{enter}')
cy.get('.vs__dropdown-menu .option').first().contains(userId)
cy.get('.select input').type('{enter}')
cy.get('.shareWithList').contains(userId) cy.get('.shareWithList').contains(userId)
}) })

View File

@@ -200,11 +200,13 @@ export default {
background-image: url('../img/color_picker.svg'); background-image: url('../img/color_picker.svg');
} }
.multiselect { .v-select {
width: 100%; width: 100%;
} }
.modal__card { .modal__card {
width: 100%;
min-width: 100%;
height: 100vh; height: 100vh;
max-height: calc(100vh - 120px); max-height: calc(100vh - 120px);
overflow: auto; overflow: auto;

View File

@@ -2,21 +2,20 @@
<NcModal v-if="modalShow" :title="t('deck', 'Move card to another board')" @close="modalShow=false"> <NcModal v-if="modalShow" :title="t('deck', 'Move card to another board')" @close="modalShow=false">
<div class="modal__content"> <div class="modal__content">
<h3>{{ t('deck', 'Move card to another board') }}</h3> <h3>{{ t('deck', 'Move card to another board') }}</h3>
<NcMultiselect v-model="selectedBoard" <NcSelect v-model="selectedBoard"
:input-label="t('deck', 'Select a board')"
:placeholder="t('deck', 'Select a board')" :placeholder="t('deck', 'Select a board')"
:options="activeBoards" :options="activeBoards"
:max-height="100" :max-height="100"
label="title" label="title"
@select="loadStacksFromBoard" /> @option:selected="loadStacksFromBoard" />
<NcMultiselect v-model="selectedStack" <NcSelect v-model="selectedStack"
:placeholder="t('deck', 'Select a list')" :disabled="stacksFromBoard.length === 0"
:placeholder="stacksFromBoard.length === 0 ? t('deck', 'No lists available') : t('deck', 'Select a list')"
:input-label="t('deck', 'Select a list')"
:options="stacksFromBoard" :options="stacksFromBoard"
:max-height="100" :max-height="100"
label="title"> label="title" />
<span slot="noOptions">
{{ t('deck', 'List is empty') }}
</span>
</NcMultiselect>
<button :disabled="!isBoardAndStackChoosen" class="primary" @click="moveCard"> <button :disabled="!isBoardAndStackChoosen" class="primary" @click="moveCard">
{{ t('deck', 'Move card') }} {{ t('deck', 'Move card') }}
@@ -29,14 +28,14 @@
</template> </template>
<script> <script>
import { NcModal, NcMultiselect } from '@nextcloud/vue' import { NcModal, NcSelect } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { subscribe, unsubscribe } from '@nextcloud/event-bus' import { subscribe, unsubscribe } from '@nextcloud/event-bus'
export default { export default {
name: 'CardMoveDialog', name: 'CardMoveDialog',
components: { NcModal, NcMultiselect }, components: { NcModal, NcSelect },
data() { data() {
return { return {
card: null, card: null,
@@ -92,11 +91,15 @@ export default {
width: 25vw; width: 25vw;
min-width: 250px; min-width: 250px;
min-height: 120px; min-height: 120px;
text-align: center;
margin: 20px 20px 100px 20px; margin: 20px 20px 100px 20px;
.multiselect { h3 {
margin-bottom: 10px; font-weight: bold;
text-align: center;
}
.select {
margin-bottom: 12px;
} }
} }

View File

@@ -24,12 +24,12 @@
<NcModal class="card-selector" @close="close"> <NcModal class="card-selector" @close="close">
<div id="modal-inner" :class="{ 'icon-loading': loading }"> <div id="modal-inner" :class="{ 'icon-loading': loading }">
<h3>{{ title }}</h3> <h3>{{ title }}</h3>
<NcMultiselect v-model="selectedBoard" <NcSelect v-model="selectedBoard"
:placeholder="t('deck', 'Select a board')" :placeholder="t('deck', 'Select a board')"
:options="boards" :options="boards"
:disabled="loading" :disabled="loading"
label="title" label="title"
@select="fetchCardsFromBoard"> @option:selected="fetchCardsFromBoard">
<template slot="singleLabel" slot-scope="props"> <template slot="singleLabel" slot-scope="props">
<span> <span>
<span :style="{ 'backgroundColor': '#' + props.option.color }" class="board-bullet" /> <span :style="{ 'backgroundColor': '#' + props.option.color }" class="board-bullet" />
@@ -42,9 +42,9 @@
<span>{{ props.option.title }}</span> <span>{{ props.option.title }}</span>
</span> </span>
</template> </template>
</NcMultiselect> </NcSelect>
<NcMultiselect v-model="selectedCard" <NcSelect v-model="selectedCard"
:placeholder="t('deck', 'Select a card')" :placeholder="t('deck', 'Select a card')"
:options="cardsFromBoard" :options="cardsFromBoard"
:disabled="loading || selectedBoard === ''" :disabled="loading || selectedBoard === ''"
@@ -62,14 +62,14 @@
<script> <script>
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { NcModal, NcMultiselect } from '@nextcloud/vue' import { NcModal, NcSelect } from '@nextcloud/vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
export default { export default {
name: 'CardSelector', name: 'CardSelector',
components: { components: {
NcModal, NcModal,
NcMultiselect, NcSelect,
}, },
props: { props: {
title: { title: {

View File

@@ -25,7 +25,7 @@
<div class="activity--header"> <div class="activity--header">
<img :src="activity.icon" class="activity--icon"> <img :src="activity.icon" class="activity--icon">
<NcRichText class="activity--subject" :text="message.subject" :arguments="message.parameters" /> <NcRichText class="activity--subject" :text="message.subject" :arguments="message.parameters" />
<div class="activity--timestamp" :title="formatReadableDate(activity.datetime)"> <div class="activity--timestamp" :name="formatReadableDate(activity.datetime)">
{{ relativeDate(activity.datetime) }} {{ relativeDate(activity.datetime) }}
</div> </div>
</div> </div>

View File

@@ -41,7 +41,7 @@
</div> </div>
</transition> </transition>
<NcModal v-if="modalShow" :title="t('deck', 'File already exists')" @close="modalShow=false"> <NcModal v-if="modalShow" :name="t('deck', 'File already exists')" @close="modalShow=false">
<div class="modal__content"> <div class="modal__content">
<h2>{{ t('deck', 'File already exists') }}</h2> <h2>{{ t('deck', 'File already exists') }}</h2>
<p> <p>

View File

@@ -89,14 +89,14 @@
<NcPopover container=".board-action-buttons__filter" <NcPopover container=".board-action-buttons__filter"
:placement="'bottom-end'" :placement="'bottom-end'"
:aria-label="t('deck', 'Active filters')" :aria-label="t('deck', 'Active filters')"
:title="t('deck', 'Active filters')" :name="t('deck', 'Active filters')"
:tooltip="t('deck', 'Active filters')" :tooltip="t('deck', 'Active filters')"
@show="filterVisible=true" @show="filterVisible=true"
@hide="filterVisible=false"> @hide="filterVisible=false">
<!-- We cannot use NcActions here are the popover trigger does not update on reactive icons --> <!-- We cannot use NcActions here are the popover trigger does not update on reactive icons -->
<NcButton slot="trigger" <NcButton slot="trigger"
ref="filterPopover" ref="filterPopover"
:title="t('deck', 'Apply filter')" :name="t('deck', 'Apply filter')"
class="filter-button" class="filter-button"
:type="isFilterActive ? 'primary' : 'tertiary'"> :type="isFilterActive ? 'primary' : 'tertiary'">
<template #icon> <template #icon>
@@ -203,7 +203,7 @@
</div> </div>
<NcActions :aria-label="t('deck', 'View Modes')" <NcActions :aria-label="t('deck', 'View Modes')"
:title="t('deck', 'Toggle View Modes')"> :name="t('deck', 'Toggle View Modes')">
<NcActionButton @click="toggleShowArchived"> <NcActionButton @click="toggleShowArchived">
<template #icon> <template #icon>
<ArchiveIcon :size="20" decorative /> <ArchiveIcon :size="20" decorative />
@@ -231,7 +231,7 @@
<NcActions> <NcActions>
<NcActionButton icon="icon-menu-sidebar" <NcActionButton icon="icon-menu-sidebar"
:aria-label="t('deck', 'Open details')" :aria-label="t('deck', 'Open details')"
:title="t('deck', 'Details')" :name="t('deck', 'Details')"
@click="toggleDetailsView" /> @click="toggleDetailsView" />
</NcActions> </NcActions>
</div> </div>

View File

@@ -23,7 +23,7 @@
<template> <template>
<NcAppSidebar v-if="board != null" <NcAppSidebar v-if="board != null"
:actions="[]" :actions="[]"
:title="board.title" :name="board.title"
@close="closeSidebar"> @close="closeSidebar">
<NcAppSidebarTab id="sharing" <NcAppSidebarTab id="sharing"
:order="0" :order="0"

View File

@@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<NcMultiselect v-if="canShare" <NcSelect v-if="canShare"
v-model="addAcl" v-model="addAcl"
:placeholder="t('deck', 'Share board with a user, group or team …')" :input-label="t('deck', 'Share board with a user, group or team ')"
:options="formatedSharees" :options="formatedSharees"
:user-select="true" :user-select="true"
label="displayName" label="displayName"
@@ -11,14 +11,14 @@
track-by="multiselectKey" track-by="multiselectKey"
:internal-search="false" :internal-search="false"
@input="clickAddAcl" @input="clickAddAcl"
@search-change="asyncFind"> @search="(search, loading) => asyncFind(search, loading)">
<template #noOptions> <template #noOptions>
{{ isSearching ? t('deck', 'Searching for users, groups and teams …') : t('deck', 'No participants found') }} {{ isSearching ? t('deck', 'Searching for users, groups and teams …') : t('deck', 'No participants found') }}
</template> </template>
<template #noResult> <template #noResult>
{{ isSearching ? t('deck', 'Searching for users, groups and teams …') : t('deck', 'No participants found') }} {{ isSearching ? t('deck', 'Searching for users, groups and teams …') : t('deck', 'No participants found') }}
</template> </template>
</NcMultiselect> </NcSelect>
<ul id="shareWithList" <ul id="shareWithList"
class="shareWithList"> class="shareWithList">
@@ -88,7 +88,7 @@
</template> </template>
<script> <script>
import { NcAvatar, NcMultiselect, NcActions, NcActionButton, NcActionCheckbox, NcRelatedResourcesPanel } from '@nextcloud/vue' import { NcAvatar, NcSelect, NcActions, NcActionButton, NcActionCheckbox, NcRelatedResourcesPanel } from '@nextcloud/vue'
import { CollectionList } from 'nextcloud-vue-collections' import { CollectionList } from 'nextcloud-vue-collections'
import { mapGetters, mapState } from 'vuex' import { mapGetters, mapState } from 'vuex'
import { getCurrentUser } from '@nextcloud/auth' import { getCurrentUser } from '@nextcloud/auth'
@@ -103,7 +103,7 @@ export default {
NcActions, NcActions,
NcActionButton, NcActionButton,
NcActionCheckbox, NcActionCheckbox,
NcMultiselect, NcSelect,
CollectionList, CollectionList,
NcRelatedResourcesPanel, NcRelatedResourcesPanel,
}, },
@@ -170,7 +170,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.asyncFind('') this.asyncFind('', () => {})
}, },
methods: { methods: {
debouncedFind: debounce(async function(query) { debouncedFind: debounce(async function(query) {
@@ -178,8 +178,10 @@ export default {
await this.$store.dispatch('loadSharees', query) await this.$store.dispatch('loadSharees', query)
this.isSearching = false this.isSearching = false
}, 300), }, 300),
async asyncFind(query) { async asyncFind(query, loading) {
loading(true)
await this.debouncedFind(query) await this.debouncedFind(query)
loading(false)
}, },
async clickAddAcl() { async clickAddAcl() {
this.addAclForAPI = { this.addAclForAPI = {

View File

@@ -3,19 +3,19 @@
<div class="selector-wrapper--icon"> <div class="selector-wrapper--icon">
<AccountMultiple :size="20" /> <AccountMultiple :size="20" />
</div> </div>
<NcMultiselect v-if="canEdit" <NcSelect v-if="canEdit"
v-model="assignedUsers" v-model="assignedUsers"
class="selector-wrapper--selector" class="selector-wrapper--selector"
:disabled="assignables.length === 0" :disabled="assignables.length === 0"
:multiple="true" :multiple="true"
:options="formatedAssignables" :options="formatedAssignables"
:user-select="true" :user-select="true"
:auto-limit="false" :aria-label-combobox="t('deck', 'Assign a user to this card')"
:placeholder="t('deck', 'Assign a user to this card…')" :placeholder="t('deck', 'Select a user to assign to this card…')"
label="displayname" label="displayname"
track-by="multiselectKey" track-by="multiselectKey"
@select="onSelect" @option:selected="onSelect"
@remove="onRemove"> @option:deselected="onRemove">
<template #tag="scope"> <template #tag="scope">
<div class="avatarlist--inline"> <div class="avatarlist--inline">
<NcAvatar :user="scope.option.uid" <NcAvatar :user="scope.option.uid"
@@ -25,7 +25,7 @@
:disable-menu="true" /> :disable-menu="true" />
</div> </div>
</template> </template>
</NcMultiselect> </NcSelect>
<div v-else class="avatar-list--readonly"> <div v-else class="avatar-list--readonly">
<NcAvatar v-for="option in assignedUsers" <NcAvatar v-for="option in assignedUsers"
:key="option.primaryKey" :key="option.primaryKey"
@@ -39,14 +39,14 @@
<script> <script>
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { NcAvatar, NcMultiselect } from '@nextcloud/vue' import { NcAvatar, NcSelect } from '@nextcloud/vue'
import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue' import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
export default defineComponent({ export default defineComponent({
name: 'AssignmentSelector', name: 'AssignmentSelector',
components: { components: {
AccountMultiple, AccountMultiple,
NcMultiselect, NcSelect,
NcAvatar, NcAvatar,
}, },
props: { props: {
@@ -117,11 +117,12 @@ export default defineComponent({
this.assignedUsers = [] this.assignedUsers = []
} }
}, },
onSelect(user) { onSelect(options) {
this.$emit('select', user) const addition = options.filter((item) => !this.card.assignedUsers.find((user) => user.participant.primaryKey === item.primaryKey))
this.$emit('select', addition[0])
}, },
onRemove(user) { onRemove(removed) {
this.$emit('remove', user) this.$emit('remove', removed)
}, },
}, },
}) })

View File

@@ -23,7 +23,7 @@
<template> <template>
<NcAppSidebar v-if="currentBoard && currentCard" <NcAppSidebar v-if="currentBoard && currentCard"
:active="tabId" :active="tabId"
:title="title" :name="title"
:subtitle="subtitle" :subtitle="subtitle"
:subtitle-tooltip="subtitleTooltip" :subtitle-tooltip="subtitleTooltip"
:title-editable="titleEditable" :title-editable="titleEditable"

View File

@@ -178,14 +178,13 @@ export default {
}, },
async addLabelToBoardAndCard(name) { async addLabelToBoardAndCard(name) {
const newLabel = await this.$store.dispatch('addLabelToCurrentBoardAndCard', { await this.$store.dispatch('addLabelToCurrentBoardAndCard', {
card: this.copiedCard, card: this.copiedCard,
newLabel: { newLabel: {
title: name, title: name,
color: this.randomColor(), color: this.randomColor(),
}, },
}) })
this.copiedCard.labels.push(newLabel)
}, },
removeLabelFromCard(removedLabel) { removeLabelFromCard(removedLabel) {

View File

@@ -66,7 +66,7 @@
<div class="due-actions"> <div class="due-actions">
<NcButton v-if="!card.archived" <NcButton v-if="!card.archived"
type="tertiary" type="tertiary"
:title="t('deck', 'Not completed')" :name="t('deck', 'Not completed')"
@click="changeCardDoneStatus()"> @click="changeCardDoneStatus()">
<template #icon> <template #icon>
<ClearIcon :size="20" /> <ClearIcon :size="20" />

View File

@@ -3,46 +3,48 @@
<div class="selector-wrapper--icon"> <div class="selector-wrapper--icon">
<TagMultiple :size="20" /> <TagMultiple :size="20" />
</div> </div>
<NcMultiselect :value="assignedLabels" <NcSelect :value="assignedLabels"
class="selector-wrapper--selector" class="selector-wrapper--selector"
:multiple="true" :multiple="true"
:disabled="disabled" :disabled="disabled"
:options="labelsSorted" :options="labelsSorted"
:placeholder="t('deck', 'Assign a tag to this card…')" :aria-label-combobox="t('deck', 'Assign a tag to this card')"
:placeholder="t('deck', 'Select or create a tag…')"
:taggable="true" :taggable="true"
:close-on-select="false"
label="title" label="title"
track-by="id" track-by="id"
tag-position="bottom" tag-position="bottom"
@select="onSelect" @option:selected="onSelect"
@remove="onRemove" @option:deselected="onRemove"
@tag="onNewTag"> @option:created="onNewTag">
<template #option="scope"> <template #option="scope">
<div v-if="!scope.option?.isTag" :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag"> <div v-if="!scope?.isTag" :style="{ backgroundColor: '#' + scope.color, color: textColor(scope.color)}" class="tag">
{{ scope.option.title }} {{ scope.title }}
</div> </div>
<div v-else> <div v-else>
{{ t('deck', 'Create a new tag:') }} <div class="tag"> {{ t('deck', 'Create a new tag:') }} <div class="tag">
{{ scope.option.label }} {{ scope.label }}
</div> </div>
</div> </div>
</template> </template>
<template #tag="scope"> <template #selected-option="scope">
<div :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag"> <div :style="{ backgroundColor: '#' + scope.color, color: textColor(scope.color)}" class="tag">
{{ scope.option.title }} {{ scope.title }}
</div> </div>
</template> </template>
</NcMultiselect> </NcSelect>
</div> </div>
</template> </template>
<script> <script>
import { NcMultiselect } from '@nextcloud/vue' import { NcSelect } from '@nextcloud/vue'
import Color from '../../mixins/color.js' import Color from '../../mixins/color.js'
import TagMultiple from 'vue-material-design-icons/TagMultiple.vue' import TagMultiple from 'vue-material-design-icons/TagMultiple.vue'
export default { export default {
name: 'TagSelector', name: 'TagSelector',
components: { TagMultiple, NcMultiselect }, components: { TagMultiple, NcSelect },
mixins: [Color], mixins: [Color],
props: { props: {
card: { card: {
@@ -61,20 +63,22 @@ export default {
computed: { computed: {
labelsSorted() { labelsSorted() {
return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
.filter(label => this.card.labels.findIndex((l) => l.id === label.id) === -1)
}, },
assignedLabels() { assignedLabels() {
return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
}, },
}, },
methods: { methods: {
onSelect(newLabel) { onSelect(options) {
this.$emit('select', newLabel) const addedLabel = options.filter(option => !this.card.labels.includes(option))
this.$emit('select', addedLabel[0])
}, },
onRemove(removedLabel) { onRemove(removedLabel) {
this.$emit('remove', removedLabel) this.$emit('remove', removedLabel)
}, },
async onNewTag(name) { async onNewTag(option) {
this.$emit('newtag', name) this.$emit('newtag', option.title)
}, },
}, },
} }
@@ -83,17 +87,17 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../css/selector'; @import '../../css/selector';
.multiselect--active { .v-select:deep(.vs__selected) {
z-index: 10022; padding-left: 0 !important;
} }
.tag { .tag {
flex-grow: 0; flex-grow: 0;
flex-shrink: 1; flex-shrink: 1;
overflow: hidden; overflow: hidden;
padding: 0px 5px; padding: 3px 12px;
border-radius: 15px; display: inline-block;
font-size: 85%; border-radius: var(--border-radius-pill);
margin-right: 3px; margin-right: 3px;
} }
</style> </style>

View File

@@ -22,7 +22,10 @@
<template> <template>
<div class="avatars"> <div class="avatars">
<div class="avatar-list" @click.stop="togglePopover"> <div>
<NcPopover>
<template #trigger="{ attrs }">
<button class="avatar-list" v-bind="attrs" @click.stop>
<div v-if="popover.length > 0"> <div v-if="popover.length > 0">
<AccountMultiple class="avatardiv more-avatars" :size="24" /> <AccountMultiple class="avatardiv more-avatars" :size="24" />
</div> </div>
@@ -48,11 +51,23 @@
:disable-="true" :disable-="true"
:size="32" /> :size="32" />
</div> </div>
</button>
</template>
<div>
<div v-for="user in users"
:key="user.id"
class="avatar-list-entry">
<NcAvatar :user="user.participant.uid"
:display-name="user.participant.displayname"
:disable-menu="true"
:is-no-user="user.type !== 0"
:size="32" />
<div class="avatar-list-entry__label">
{{ user.participant.displayname }}
</div> </div>
</div>
<div v-show="popoverVisible" class="popovermenu menu-right"> </div>
<NcPopoverMenu :menu="popover" /> </NcPopover>
<slot />
</div> </div>
<div class="avatar-print-list"> <div class="avatar-print-list">
@@ -70,7 +85,7 @@
</template> </template>
<script> <script>
import { NcAvatar, NcPopoverMenu, Tooltip } from '@nextcloud/vue' import { NcAvatar, NcPopover, Tooltip } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue' import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
@@ -78,7 +93,7 @@ export default {
name: 'AvatarList', name: 'AvatarList',
components: { components: {
NcAvatar, NcAvatar,
NcPopoverMenu, NcPopover,
AccountMultiple, AccountMultiple,
}, },
directives: { directives: {
@@ -172,8 +187,12 @@ export default {
.avatar-list { .avatar-list {
float: right; float: right;
display: inline-flex; display: inline-flex;
padding-right: $avatar-offset;
flex-direction: row-reverse; flex-direction: row-reverse;
padding: 0;
padding-right: $avatar-offset;
margin: 0;
border: 0;
background: transparent;
& > div { & > div {
height: 32px; height: 32px;
@@ -199,6 +218,15 @@ export default {
} }
.avatar-list-entry {
display: flex;
padding: 6px 12px;
&__label {
padding: 4px 12px;
}
}
.popovermenu { .popovermenu {
display: block; display: block;
margin: 40px -6px; margin: 40px -6px;

View File

@@ -68,7 +68,7 @@
tag="ul" tag="ul"
class="labels" class="labels"
@click.stop="openCard"> @click.stop="openCard">
<li v-for="label in labelsSorted" :key="label.id" :style="labelStyle(label)"> <li v-for="label in labelsSorted" :key="label?.id ?? label?.title" :style="labelStyle(label)">
<span @click.stop="applyLabelFilter(label)">{{ label.title }}</span> <span @click.stop="applyLabelFilter(label)">{{ label.title }}</span>
</li> </li>
</transition-group> </transition-group>

View File

@@ -23,7 +23,7 @@
<template> <template>
<div v-if="card" class="duedate" :data-due-state="dueState"> <div v-if="card" class="duedate" :data-due-state="dueState">
<transition name="zoom"> <transition name="zoom">
<div v-if="card.duedate || card.done" class="due" :title="absoluteDate"> <div v-if="card.duedate || card.done" class="due" :name="absoluteDate">
<CheckCircle v-if="card.done" :size="16" /> <CheckCircle v-if="card.done" :size="16" />
<Clock v-else-if="overdue" :size="16" /> <Clock v-else-if="overdue" :size="16" />
<ClockOutline v-else :size="16" /> <ClockOutline v-else :size="16" />

View File

@@ -23,7 +23,7 @@
<template> <template>
<NcAppNavigation :class="{'icon-loading': loading}"> <NcAppNavigation :class="{'icon-loading': loading}">
<template #list> <template #list>
<NcAppNavigationItem :title="t('deck', 'Upcoming cards')" <NcAppNavigationItem :name="t('deck', 'Upcoming cards')"
:exact="true" :exact="true"
to="/"> to="/">
<template #icon> <template #icon>
@@ -61,7 +61,7 @@
<AppNavigationAddBoard v-if="canCreate" /> <AppNavigationAddBoard v-if="canCreate" />
</template> </template>
<template #footer> <template #footer>
<NcAppNavigationSettings :title="t('deck', 'Deck settings')"> <NcAppNavigationSettings :name="t('deck', 'Deck settings')">
<NcButton @click="showHelp = true"> <NcButton @click="showHelp = true">
{{ t('deck', 'Keyboard shortcuts') }} {{ t('deck', 'Keyboard shortcuts') }}
</NcButton> </NcButton>
@@ -97,14 +97,14 @@
</label> </label>
</div> </div>
<NcMultiselect v-if="isAdmin" <NcSelect v-if="isAdmin"
v-model="groupLimit" v-model="groupLimit"
:class="{'icon-loading-small': groupLimitDisabled}" :class="{'icon-loading-small': groupLimitDisabled}"
open-direction="bottom" open-direction="bottom"
:options="groups" :options="groups"
:multiple="true" :multiple="true"
:disabled="groupLimitDisabled" :disabled="groupLimitDisabled"
:placeholder="t('deck', 'Limit board creation to some groups')" :input-label="t('deck', 'Limit board creation to some groups')"
label="displayname" label="displayname"
track-by="id" track-by="id"
@input="updateConfig" /> @input="updateConfig" />
@@ -121,7 +121,7 @@
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import ClickOutside from 'vue-click-outside' import ClickOutside from 'vue-click-outside'
import { NcAppNavigation, NcAppNavigationItem, NcAppNavigationSettings, NcMultiselect, NcButton } from '@nextcloud/vue' import { NcAppNavigation, NcAppNavigationItem, NcAppNavigationSettings, NcSelect, NcButton } from '@nextcloud/vue'
import AppNavigationAddBoard from './AppNavigationAddBoard.vue' import AppNavigationAddBoard from './AppNavigationAddBoard.vue'
import AppNavigationBoardCategory from './AppNavigationBoardCategory.vue' import AppNavigationBoardCategory from './AppNavigationBoardCategory.vue'
import { loadState } from '@nextcloud/initial-state' import { loadState } from '@nextcloud/initial-state'
@@ -144,7 +144,7 @@ export default {
NcButton, NcButton,
AppNavigationAddBoard, AppNavigationAddBoard,
AppNavigationBoardCategory, AppNavigationBoardCategory,
NcMultiselect, NcSelect,
NcAppNavigationItem, NcAppNavigationItem,
ArchiveIcon, ArchiveIcon,
CalendarIcon, CalendarIcon,

View File

@@ -21,7 +21,7 @@
--> -->
<template> <template>
<NcAppNavigationItem v-if="!editing" <NcAppNavigationItem v-if="!editing"
:title="t('deck', 'Add board')" :name="t('deck', 'Add board')"
icon="icon-add" icon="icon-add"
@click.prevent.stop="startCreateBoard" /> @click.prevent.stop="startCreateBoard" />
<div v-else class="board-create"> <div v-else class="board-create">

View File

@@ -21,7 +21,7 @@
--> -->
<template> <template>
<NcAppNavigationItem v-if="!editing" <NcAppNavigationItem v-if="!editing"
:title="!deleted ? board.title : undoText" :name="!deleted ? board.title : undoText"
:loading="loading" :loading="loading"
:to="routeTo" :to="routeTo"
:undo="deleted" :undo="deleted"
@@ -29,10 +29,9 @@
@undo="unDelete"> @undo="unDelete">
<NcAppNavigationIconBullet slot="icon" :color="board.color" /> <NcAppNavigationIconBullet slot="icon" :color="board.color" />
<NcAppNavigationCounter v-if="board.acl.length" <template #counter>
slot="counter" <AccountIcon v-if="board.acl.length > 0" />
class="icon-shared" </template>
style="opacity: 0.5" />
<template v-if="!deleted" slot="actions"> <template v-if="!deleted" slot="actions">
<template v-if="!isDueSubmenuActive"> <template v-if="!isDueSubmenuActive">
@@ -113,7 +112,7 @@
</NcActionButton> </NcActionButton>
</template> </template>
<NcActionButton v-else-if="!board.archived && board.acl.length > 0" <NcActionButton v-else-if="!board.archived && board.acl.length > 0"
:title="t('deck', 'Due date reminders')" :name="t('deck', 'Due date reminders')"
:icon="dueDateReminderIcon" :icon="dueDateReminderIcon"
@click="isDueSubmenuActive=true"> @click="isDueSubmenuActive=true">
{{ dueDateReminderText }} {{ dueDateReminderText }}
@@ -144,20 +143,21 @@
</template> </template>
<script> <script>
import { NcAppNavigationIconBullet, NcAppNavigationCounter, NcAppNavigationItem, NcColorPicker, NcActions, NcActionButton } from '@nextcloud/vue' import { NcAppNavigationIconBullet, NcAppNavigationItem, NcColorPicker, NcActions, NcActionButton } from '@nextcloud/vue'
import ClickOutside from 'vue-click-outside' import ClickOutside from 'vue-click-outside'
import ArchiveIcon from 'vue-material-design-icons/Archive.vue' import ArchiveIcon from 'vue-material-design-icons/Archive.vue'
import CloneIcon from 'vue-material-design-icons/ContentDuplicate.vue' import CloneIcon from 'vue-material-design-icons/ContentDuplicate.vue'
import AccountIcon from 'vue-material-design-icons/Account.vue'
export default { export default {
name: 'AppNavigationBoard', name: 'AppNavigationBoard',
components: { components: {
NcAppNavigationIconBullet, NcAppNavigationIconBullet,
NcAppNavigationCounter,
NcAppNavigationItem, NcAppNavigationItem,
NcColorPicker, NcColorPicker,
NcActions, NcActions,
NcActionButton, NcActionButton,
AccountIcon,
ArchiveIcon, ArchiveIcon,
CloneIcon, CloneIcon,
}, },

View File

@@ -21,7 +21,7 @@
--> -->
<template> <template>
<NcAppNavigationItem v-if="boards.length > 0" <NcAppNavigationItem v-if="boards.length > 0"
:title="text" :name="text"
:to="to" :to="to"
:exact="true" :exact="true"
:allow-collapse="collapsible" :allow-collapse="collapsible"

22
src/directives/focus.js Normal file
View File

@@ -0,0 +1,22 @@
/**
*
* @param el
* @param binding
*/
function focusElement(el, binding) {
// If directive has bound value
if (binding.value !== undefined && !binding.value) return
// Focus the element
el.focus()
}
// Register a global custom directive called `v-focus`
export default {
bind(el, binding, vnode) {
// When the component of the element gets activated
vnode.context.$on('hook:activated', () => focusElement(el, binding))
},
// When the bound element is inserted into the DOM...
inserted: focusElement,
}

View File

@@ -19,29 +19,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { registerWidget, registerCustomPickerElement, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Components/NcRichText.js' import { registerWidget, registerCustomPickerElement, NcCustomPickerRenderResult } from '@nextcloud/vue/dist/Functions/registerReference.js'
import { Tooltip } from '@nextcloud/vue'
import Vue from 'vue'
import CardReferenceWidget from './views/CardReferenceWidget.vue'
import BoardReferenceWidget from './views/BoardReferenceWidget.vue'
import CommentReferenceWidget from './views/CommentReferenceWidget.vue'
import { translate, translatePlural } from '@nextcloud/l10n' import { translate, translatePlural } from '@nextcloud/l10n'
import './shared-init.js' import './shared-init.js'
Vue.prototype.t = translate const prepareVue = (Vue) => {
Vue.prototype.n = translatePlural Vue.prototype.t = translate
Vue.prototype.OC = window.OC Vue.prototype.n = translatePlural
Vue.prototype.OCA = window.OCA Vue.prototype.OC = window.OC
Vue.directive('tooltip', Tooltip) Vue.prototype.OCA = window.OCA
Vue.directive('focus', { Vue.directive('focus', {
inserted(el) { inserted(el) {
el.focus() el.focus()
}, },
}) })
}
registerWidget('deck-card', (el, { richObjectType, richObject, accessible }) => { registerWidget('deck-card', async (el, { richObjectType, richObject, accessible }) => {
const { default: Vue } = await import('vue')
prepareVue(Vue)
const { default: CardReferenceWidget } = await import('./views/CardReferenceWidget.vue')
// trick to change the wrapper element size, otherwise it always is 100% // trick to change the wrapper element size, otherwise it always is 100%
// which is not very nice with a simple card // which is not very nice with a simple card
el.parentNode.style['max-width'] = '400px' el.parentNode.style['max-width'] = '400px'
@@ -58,7 +57,10 @@ registerWidget('deck-card', (el, { richObjectType, richObject, accessible }) =>
}).$mount(el) }).$mount(el)
}) })
registerWidget('deck-board', (el, { richObjectType, richObject, accessible }) => { registerWidget('deck-board', async (el, { richObjectType, richObject, accessible }) => {
const { default: Vue } = await import('vue')
prepareVue(Vue)
const { default: BoardReferenceWidget } = await import('./views/BoardReferenceWidget.vue')
el.parentNode.style['max-width'] = '400px' el.parentNode.style['max-width'] = '400px'
el.parentNode.style['margin-left'] = '0' el.parentNode.style['margin-left'] = '0'
el.parentNode.style['margin-right'] = '0' el.parentNode.style['margin-right'] = '0'
@@ -73,7 +75,11 @@ registerWidget('deck-board', (el, { richObjectType, richObject, accessible }) =>
}).$mount(el) }).$mount(el)
}) })
registerWidget('deck-comment', (el, { richObjectType, richObject, accessible }) => { registerWidget('deck-comment', async (el, { richObjectType, richObject, accessible }) => {
const { default: Vue } = await import('vue')
prepareVue(Vue)
const { default: CommentReferenceWidget } = await import('./views/CommentReferenceWidget.vue')
el.parentNode.style['max-width'] = '400px' el.parentNode.style['max-width'] = '400px'
el.parentNode.style['margin-left'] = '0' el.parentNode.style['margin-left'] = '0'
el.parentNode.style['margin-right'] = '0' el.parentNode.style['margin-right'] = '0'
@@ -89,9 +95,9 @@ registerWidget('deck-comment', (el, { richObjectType, richObject, accessible })
}) })
registerCustomPickerElement('create-new-deck-card', async (el, { providerId, accessible }) => { registerCustomPickerElement('create-new-deck-card', async (el, { providerId, accessible }) => {
const { default: Vue } = await import(/* webpackChunkName: "reference-picker-lazy" */'vue') const { default: Vue } = await import('vue')
Vue.mixin({ methods: { t, n } }) Vue.mixin({ methods: { t, n } })
const { default: CreateNewCardCustomPicker } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/CreateNewCardCustomPicker.vue') const { default: CreateNewCardCustomPicker } = await import('./views/CreateNewCardCustomPicker.vue')
const Element = Vue.extend(CreateNewCardCustomPicker) const Element = Vue.extend(CreateNewCardCustomPicker)
const vueElement = new Element({ const vueElement = new Element({
propsData: { propsData: {

View File

@@ -15,40 +15,40 @@
<div class="selector-wrapper--icon"> <div class="selector-wrapper--icon">
<DeckIcon :size="20" /> <DeckIcon :size="20" />
</div> </div>
<NcMultiselect v-model="selectedBoard" <NcSelect v-model="selectedBoard"
:placeholder="t('deck', 'Select a board')" :placeholder="t('deck', 'Select a board')"
:options="boards" :options="boards"
:disabled="loading" :disabled="loading"
label="title" label="title"
class="selector-wrapper--selector multiselect-board" class="selector-wrapper--selector multiselect-board"
@select="onSelectBoard"> @option:selected="onSelectBoard">
<template slot="singleLabel" slot-scope="props"> <template #selected-option="option">
<span> <span>
<span :style="{ 'backgroundColor': '#' + props.option.color }" class="board-bullet" /> <span :style="{ 'backgroundColor': '#' + option.color }" class="board-bullet" />
<span>{{ props.option.title }}</span> <span data-cy="board-select-title">{{ option.title }}</span>
</span> </span>
</template> </template>
<template slot="option" slot-scope="props"> <template #option="option">
<span> <span>
<span :style="{ 'backgroundColor': '#' + props.option.color }" class="board-bullet" /> <span :style="{ 'backgroundColor': '#' + option.color }" class="board-bullet" />
<span>{{ props.option.title }}</span> <span data-cy="board-select-title">{{ option.title }}</span>
</span> </span>
</template> </template>
</NcMultiselect> </NcSelect>
</div> </div>
<div class="col selector-wrapper"> <div class="col selector-wrapper">
<div class="selector-wrapper--icon"> <div class="selector-wrapper--icon">
<FormatColumnsIcon :size="20" /> <FormatColumnsIcon :size="20" />
</div> </div>
<NcMultiselect v-model="selectedStack" <NcSelect v-model="selectedStack"
:placeholder="t('deck', 'Select a list')" :placeholder="t('deck', 'Select a list')"
:options="stacksFromBoard" :options="stacksFromBoard"
:max-height="100" :max-height="100"
:disabled="loading || !selectedBoard" :disabled="loading || !selectedBoard"
class="selector-wrapper--selector multiselect-list" class="selector-wrapper--selector multiselect-list"
label="title" label="title"
@select="onSelectStack" /> @option:selected="onSelectStack" />
</div> </div>
</div> </div>
@@ -117,7 +117,7 @@
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { import {
NcButton, NcButton,
NcMultiselect, NcSelect,
NcEmptyContent, NcEmptyContent,
NcLoadingIcon, NcLoadingIcon,
} from '@nextcloud/vue' } from '@nextcloud/vue'
@@ -148,7 +148,7 @@ export default {
TagSelector, TagSelector,
AssignmentSelector, AssignmentSelector,
NcButton, NcButton,
NcMultiselect, NcSelect,
NcEmptyContent, NcEmptyContent,
NcLoadingIcon, NcLoadingIcon,
}, },
@@ -373,7 +373,7 @@ h2 {
gap: 12px; gap: 12px;
} }
.multiselect { .v-select {
min-width: auto !important; min-width: auto !important;
} }