148 lines
3.2 KiB
Vue
148 lines
3.2 KiB
Vue
<!--
|
|
Nextcloud - Tasks
|
|
|
|
@author Georg Ehrke
|
|
@copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
|
|
|
|
@author Raimund Schlüßler
|
|
@copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
License as published by the Free Software Foundation; either
|
|
version 3 of the License, or any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public
|
|
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-->
|
|
|
|
<template>
|
|
<div class="property__item">
|
|
<Multiselect
|
|
label="displayName"
|
|
track-by="displayName"
|
|
:disabled="isDisabled"
|
|
:options="calendars"
|
|
:value="calendar"
|
|
:placeholder="translate('tasks', 'Select a calendar')"
|
|
@select="change">
|
|
<template slot="singleLabel" slot-scope="scope">
|
|
<CalendarPickerOption v-bind="scope.option" />
|
|
</template>
|
|
<template slot="option" slot-scope="scope">
|
|
<CalendarPickerOption v-bind="scope.option" />
|
|
</template>
|
|
<template slot="noResult">
|
|
<CalendarPickerOption
|
|
color=""
|
|
owner=""
|
|
:is-shared-with-me="false"
|
|
:display-name="translate('tasks', 'No calendar matches the search.')" />
|
|
</template>
|
|
</Multiselect>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CalendarPickerOption from './CalendarPickerOption.vue'
|
|
|
|
import { translate } from '@nextcloud/l10n'
|
|
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
|
|
|
|
export default {
|
|
components: {
|
|
CalendarPickerOption,
|
|
Multiselect,
|
|
},
|
|
props: {
|
|
calendar: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
calendars: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
required: false,
|
|
},
|
|
},
|
|
computed: {
|
|
isDisabled() {
|
|
return this.calendars.length < 2 || this.disabled
|
|
},
|
|
},
|
|
methods: {
|
|
translate,
|
|
/**
|
|
* TODO: this should emit the calendar id instead
|
|
* @param {Object} newCalendar The selected calendar
|
|
*/
|
|
change(newCalendar) {
|
|
if (!newCalendar) {
|
|
return
|
|
}
|
|
this.$emit('changeCalendar', newCalendar)
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.property__item::v-deep {
|
|
display: flex;
|
|
border-bottom: 1px solid var(--color-border);
|
|
width: 100%;
|
|
|
|
.multiselect {
|
|
width: 100%;
|
|
|
|
&--active .multiselect__tags {
|
|
border: 1px solid var(--color-border-dark);
|
|
}
|
|
|
|
&--disabled,
|
|
&--disabled .multiselect__single {
|
|
background-color: var(--color-main-background) !important;
|
|
|
|
& * {
|
|
cursor: default !important;
|
|
}
|
|
}
|
|
|
|
&__tags {
|
|
border: 1px solid transparent;
|
|
height: 44px;
|
|
|
|
.multiselect__single {
|
|
padding: 0;
|
|
}
|
|
|
|
input.multiselect__input {
|
|
padding: 0 !important;
|
|
padding-left: 44px !important;
|
|
width: 100% !important;
|
|
position: absolute !important;
|
|
font-weight: bold;
|
|
font-size: var(--default-font-size);
|
|
}
|
|
}
|
|
|
|
&__content-wrapper li > span {
|
|
padding: 0;
|
|
|
|
&.multiselect__option--selected {
|
|
color: var(--color-main-text);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|