[web] Rename "Dropdown" control

The control "Dropdown" is renamed and depending components have been linted.
This commit is contained in:
Alain Nussbaumer 2023-07-08 14:43:38 +02:00
parent 332a57040e
commit 0a072c7889
10 changed files with 61 additions and 60 deletions

View File

@ -8,20 +8,20 @@
<button <button
class="button" class="button"
aria-haspopup="true" aria-haspopup="true"
aria-controls="dropdown-menu" aria-controls="dropdown"
@click="is_active = !is_active" @click="is_active = !is_active"
> >
<span v-text="option.name" /> <span v-text="option.name" />
<mdicon class="icon" name="chevron-down" size="16" /> <mdicon class="icon" name="chevron-down" size="16" />
</button> </button>
</div> </div>
<div id="dropdown-menu" class="dropdown-menu" role="menu"> <div id="dropdown" class="dropdown-menu" role="menu">
<div class="dropdown-content"> <div class="dropdown-content">
<a <a
v-for="o in options" v-for="o in options"
:key="o.id" :key="o.id"
class="dropdown-item" class="dropdown-item"
:class="{ 'is-active': modelValue === o.id }" :class="{ 'is-active': value === o.id }"
@click="select(o)" @click="select(o)"
v-text="o.name" v-text="o.name"
/> />
@ -32,9 +32,9 @@
<script> <script>
export default { export default {
name: 'DropdownMenu', name: 'ControlDropdown',
props: ['modelValue', 'options'], props: ['value', 'options'],
emits: ['update:modelValue'], emits: ['update:value'],
data() { data() {
return { return {
@ -45,7 +45,7 @@ export default {
computed: { computed: {
option: { option: {
get() { get() {
return this.options.find((option) => option.id === this.modelValue) return this.options.find((option) => option.id === this.value)
} }
} }
}, },
@ -57,7 +57,7 @@ export default {
select(option) { select(option) {
this.is_active = false this.is_active = false
this.$emit('update:modelValue', option.id) this.$emit('update:value', option.id)
} }
} }
} }

View File

@ -44,10 +44,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'NavbarItemOutput', name: 'NavbarItemOutput',
props: ['output'],
components: { components: {
ControlSlider ControlSlider
}, },
props: ['output'],
data() { data() {
return { return {
volume: this.output.selected ? this.output.volume : 0, volume: this.output.selected ? this.output.volume : 0,

View File

@ -40,8 +40,8 @@
</div> </div>
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.albums.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.albums.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -63,14 +63,14 @@
</template> </template>
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import TabsMusic from '@/components/TabsMusic.vue'
import IndexButtonList from '@/components/IndexButtonList.vue'
import ListAlbums from '@/components/ListAlbums.vue'
import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { GroupByList, byName, byYear } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ControlDropdown from '@/components/ControlDropdown.vue'
import IndexButtonList from '@/components/IndexButtonList.vue'
import ListAlbums from '@/components/ListAlbums.vue'
import TabsMusic from '@/components/TabsMusic.vue'
import webapi from '@/webapi'
const dataObject = { const dataObject = {
load(to) { load(to) {
@ -86,10 +86,10 @@ export default {
name: 'PageAlbums', name: 'PageAlbums',
components: { components: {
ContentWithHeading, ContentWithHeading,
TabsMusic, ControlDropdown,
IndexButtonList, IndexButtonList,
ListAlbums, ListAlbums,
DropdownMenu TabsMusic
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {

View File

@ -5,8 +5,8 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -58,9 +58,9 @@
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ControlDropdown from '@/components/ControlDropdown.vue'
import ListAlbums from '@/components/ListAlbums.vue' import ListAlbums from '@/components/ListAlbums.vue'
import ModalDialogArtist from '@/components/ModalDialogArtist.vue' import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { GroupByList, byName, byYear } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
@ -83,9 +83,9 @@ export default {
name: 'PageArtist', name: 'PageArtist',
components: { components: {
ContentWithHeading, ContentWithHeading,
ControlDropdown,
ListAlbums, ListAlbums,
ModalDialogArtist, ModalDialogArtist,
DropdownMenu
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {

View File

@ -6,8 +6,8 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -58,14 +58,14 @@
</template> </template>
<script> <script>
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import ControlDropdown from '@/components/ControlDropdown.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListTracks from '@/components/ListTracks.vue' import ListTracks from '@/components/ListTracks.vue'
import ModalDialogArtist from '@/components/ModalDialogArtist.vue' import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load(to) { load(to) {
@ -85,7 +85,7 @@ export default {
name: 'PageArtistTracks', name: 'PageArtistTracks',
components: { components: {
ContentWithHeading, ContentWithHeading,
DropdownMenu, ControlDropdown,
IndexButtonList, IndexButtonList,
ListTracks, ListTracks,
ModalDialogArtist ModalDialogArtist

View File

@ -40,8 +40,8 @@
</div> </div>
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.artists.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.artists.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -63,14 +63,14 @@
</template> </template>
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import TabsMusic from '@/components/TabsMusic.vue'
import IndexButtonList from '@/components/IndexButtonList.vue'
import ListArtists from '@/components/ListArtists.vue'
import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { GroupByList, byName, byYear } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ControlDropdown from '@/components/ControlDropdown.vue'
import IndexButtonList from '@/components/IndexButtonList.vue'
import ListArtists from '@/components/ListArtists.vue'
import TabsMusic from '@/components/TabsMusic.vue'
import webapi from '@/webapi'
const dataObject = { const dataObject = {
load(to) { load(to) {
@ -86,10 +86,10 @@ export default {
name: 'PageArtists', name: 'PageArtists',
components: { components: {
ContentWithHeading, ContentWithHeading,
TabsMusic, ControlDropdown,
IndexButtonList, IndexButtonList,
ListArtists, ListArtists,
DropdownMenu TabsMusic,
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {

View File

@ -6,8 +6,8 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.artist.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -60,14 +60,14 @@
</template> </template>
<script> <script>
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import ControlDropdown from '@/components/ControlDropdown.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListTracks from '@/components/ListTracks.vue' import ListTracks from '@/components/ListTracks.vue'
import ModalDialogComposer from '@/components/ModalDialogComposer.vue' import ModalDialogComposer from '@/components/ModalDialogComposer.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load(to) { load(to) {
@ -87,7 +87,7 @@ export default {
name: 'PageComposerTracks', name: 'PageComposerTracks',
components: { components: {
ContentWithHeading, ContentWithHeading,
DropdownMenu, ControlDropdown,
IndexButtonList, IndexButtonList,
ListTracks, ListTracks,
ModalDialogComposer ModalDialogComposer

View File

@ -6,8 +6,8 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p class="heading mb-5" v-text="$t('page.genre.sort-by.title')" /> <p class="heading mb-5" v-text="$t('page.genre.sort-by.title')" />
<dropdown-menu <control-dropdown
v-model="selected_groupby_option_id" v-model:value="selected_groupby_option_id"
:options="groupby_options" :options="groupby_options"
/> />
</div> </div>
@ -54,14 +54,14 @@
</template> </template>
<script> <script>
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import ControlDropdown from '@/components/ControlDropdown.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListTracks from '@/components/ListTracks.vue' import ListTracks from '@/components/ListTracks.vue'
import ModalDialogGenre from '@/components/ModalDialogGenre.vue' import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load(to) { load(to) {
@ -81,7 +81,7 @@ export default {
name: 'PageGenreTracks', name: 'PageGenreTracks',
components: { components: {
ContentWithHeading, ContentWithHeading,
DropdownMenu, ControlDropdown,
IndexButtonList, IndexButtonList,
ListTracks, ListTracks,
ModalDialogGenre ModalDialogGenre

View File

@ -6,7 +6,7 @@
<div class="title is-4" v-text="$t('page.settings.general.language')" /> <div class="title is-4" v-text="$t('page.settings.general.language')" />
</template> </template>
<template #content> <template #content>
<dropdown-menu v-model="locale" :options="locales" /> <control-dropdown v-model:value="locale" :options="locales" />
</template> </template>
</content-with-heading> </content-with-heading>
<content-with-heading> <content-with-heading>
@ -179,21 +179,21 @@
<script> <script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import TabsSettings from '@/components/TabsSettings.vue' import ControlDropdown from '@/components/ControlDropdown.vue'
import SettingsCheckbox from '@/components/SettingsCheckbox.vue' import SettingsCheckbox from '@/components/SettingsCheckbox.vue'
import SettingsTextfield from '@/components/SettingsTextfield.vue'
import SettingsIntfield from '@/components/SettingsIntfield.vue' import SettingsIntfield from '@/components/SettingsIntfield.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import SettingsTextfield from '@/components/SettingsTextfield.vue'
import TabsSettings from '@/components/TabsSettings.vue'
export default { export default {
name: 'SettingsPageWebinterface', name: 'SettingsPageWebinterface',
components: { components: {
ContentWithHeading, ContentWithHeading,
TabsSettings, ControlDropdown,
SettingsCheckbox, SettingsCheckbox,
SettingsTextfield,
SettingsIntfield, SettingsIntfield,
DropdownMenu SettingsTextfield,
TabsSettings,
}, },
computed: { computed: {
@ -207,7 +207,7 @@ export default {
locale: { locale: {
get() { get() {
let languages = this.$i18n.availableLocales const languages = this.$i18n.availableLocales
let locale = languages.find((lang) => lang === this.$i18n.locale) let locale = languages.find((lang) => lang === this.$i18n.locale)
let partial = this.$i18n.locale.split('-')[0] let partial = this.$i18n.locale.split('-')[0]
if (!locale) { if (!locale) {

View File

@ -60,7 +60,7 @@ export default {
}, },
mounted() { mounted() {
if (this.$slots['options']) { if (this.$slots.options) {
this.observer = new IntersectionObserver(this.onElementObserved, { this.observer = new IntersectionObserver(this.onElementObserved, {
rootMargin: '-82px 0px 0px 0px', rootMargin: '-82px 0px 0px 0px',
threshold: 1.0 threshold: 1.0