[web] Add default value for properties

This commit is contained in:
Alain Nussbaumer 2024-02-28 13:10:08 +01:00
parent ff8b8a0399
commit b24e025b43
37 changed files with 109 additions and 76 deletions

View File

@ -33,7 +33,10 @@
<script> <script>
export default { export default {
name: 'ControlDropdown', name: 'ControlDropdown',
props: { value: [String, Number], options: Array }, props: {
options: { required: true, type: Array },
value: { required: true, type: [String, Number] }
},
emits: ['update:value'], emits: ['update:value'],
data() { data() {

View File

@ -17,7 +17,12 @@
<script> <script>
export default { export default {
name: 'ControlSlider', name: 'ControlSlider',
props: { value: Number, max: Number, disabled: Boolean, cursor: String }, props: {
cursor: { default: '', type: String },
disabled: Boolean,
max: { required: true, type: Number },
value: { required: true, type: Number }
},
emits: ['update:value'], emits: ['update:value'],
computed: { computed: {

View File

@ -14,11 +14,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'CoverArtwork', name: 'CoverArtwork',
props: { props: {
artist: String, album: { default: '', type: String },
album: String, artist: { default: '', type: String },
artwork_url: String, artwork_url: { default: '', type: String },
maxwidth: Number, maxheight: { default: 600, type: Number },
maxheight: Number maxwidth: { default: 600, type: Number }
}, },
emits: ['click'], emits: ['click'],

View File

@ -15,7 +15,7 @@
<script> <script>
export default { export default {
name: 'IndexButtonList', name: 'IndexButtonList',
props: { indices: Array } props: { indices: { required: true, type: Array } }
} }
</script> </script>

View File

@ -77,7 +77,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ListAlbums', name: 'ListAlbums',
components: { CoverArtwork, ModalDialog, ModalDialogAlbum }, components: { CoverArtwork, ModalDialog, ModalDialogAlbum },
props: { albums: Object, media_kind: String, hide_group_title: Boolean }, props: {
albums: { required: true, type: Object },
hide_group_title: Boolean,
media_kind: { default: '', type: String }
},
emits: ['play-count-changed', 'podcast-deleted'], emits: ['play-count-changed', 'podcast-deleted'],
data() { data() {

View File

@ -39,7 +39,10 @@ import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
export default { export default {
name: 'ListArtists', name: 'ListArtists',
components: { ModalDialogArtist }, components: { ModalDialogArtist },
props: { artists: Object, hide_group_title: Boolean }, props: {
artists: { required: true, type: Object },
hide_group_title: Boolean
},
data() { data() {
return { return {

View File

@ -40,7 +40,11 @@ import ModalDialogComposer from '@/components/ModalDialogComposer.vue'
export default { export default {
name: 'ListComposers', name: 'ListComposers',
components: { ModalDialogComposer }, components: { ModalDialogComposer },
props: { composers: Object, media_kind: String, hide_group_title: Boolean }, props: {
composers: { required: true, type: Object },
hide_group_title: Boolean,
media_kind: { required: true, type: String }
},
data() { data() {
return { return {

View File

@ -48,7 +48,7 @@ import ModalDialogDirectory from '@/components/ModalDialogDirectory.vue'
export default { export default {
name: 'ListDirectories', name: 'ListDirectories',
components: { ModalDialogDirectory }, components: { ModalDialogDirectory },
props: { directories: Array }, props: { directories: { required: true, type: Array } },
data() { data() {
return { return {

View File

@ -40,7 +40,11 @@ import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
export default { export default {
name: 'ListGenres', name: 'ListGenres',
components: { ModalDialogGenre }, components: { ModalDialogGenre },
props: { genres: Object, hide_group_title: Boolean, media_kind: String }, props: {
genres: { required: true, type: Object },
hide_group_title: Boolean,
media_kind: { required: true, type: String }
},
data() { data() {
return { return {

View File

@ -25,7 +25,7 @@
<script> <script>
export default { export default {
name: 'ListItemAlbumSpotify', name: 'ListItemAlbumSpotify',
props: { album: Object } props: { album: { required: true, type: Object } }
} }
</script> </script>

View File

@ -12,7 +12,7 @@
<script> <script>
export default { export default {
name: 'ListItemArtistSpotify', name: 'ListItemArtistSpotify',
props: { artist: Object }, props: { artist: { required: true, type: Object } },
methods: { methods: {
open_artist() { open_artist() {

View File

@ -13,7 +13,7 @@
<script> <script>
export default { export default {
name: 'ListItemPlaylistSpotify', name: 'ListItemPlaylistSpotify',
props: { playlist: Object }, props: { playlist: { required: true, type: Object } },
methods: { methods: {
open_playlist() { open_playlist() {

View File

@ -50,11 +50,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ListItemQueueItem', name: 'ListItemQueueItem',
props: { props: {
item: Object, current_position: { required: true, type: Number },
position: Number, edit_mode: Boolean,
current_position: Number, item: { required: true, type: Object },
show_only_next_items: Boolean, position: { required: true, type: Number },
edit_mode: Boolean show_only_next_items: Boolean
}, },
computed: { computed: {

View File

@ -44,7 +44,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ListItemTrackSpotify', name: 'ListItemTrackSpotify',
props: { track: Object, position: Number, context_uri: String }, props: {
context_uri: { required: true, type: String },
position: { required: true, type: Number },
track: { required: true, type: Object }
},
methods: { methods: {
play() { play() {
if (this.track.is_playable) { if (this.track.is_playable) {

View File

@ -32,7 +32,7 @@ import ModalDialogPlaylist from '@/components/ModalDialogPlaylist.vue'
export default { export default {
name: 'ListPlaylists', name: 'ListPlaylists',
components: { ModalDialogPlaylist }, components: { ModalDialogPlaylist },
props: { playlists: Object }, props: { playlists: { required: true, type: Object } },
data() { data() {
return { return {

View File

@ -62,11 +62,11 @@ export default {
name: 'ListTracks', name: 'ListTracks',
components: { ModalDialogTrack }, components: { ModalDialogTrack },
props: { props: {
tracks: Object, expression: { default: '', type: String },
uris: String, show_icon: Boolean,
expression: String,
show_progress: Boolean, show_progress: Boolean,
show_icon: Boolean tracks: { required: true, type: Object },
uris: { default: '', type: String }
}, },
emits: ['play-count-changed'], emits: ['play-count-changed'],

View File

@ -12,10 +12,7 @@
<footer class="card-footer is-clipped"> <footer class="card-footer is-clipped">
<a class="card-footer-item has-text-dark" @click="$emit('close')"> <a class="card-footer-item has-text-dark" @click="$emit('close')">
<mdicon class="icon" name="cancel" size="16" /> <mdicon class="icon" name="cancel" size="16" />
<span <span class="is-size-7" v-text="close_action" />
class="is-size-7"
v-text="close_action ? close_action : $t('dialog.cancel')"
/>
</a> </a>
<a <a
v-if="delete_action" v-if="delete_action"
@ -50,11 +47,11 @@
export default { export default {
name: 'ModalDialog', name: 'ModalDialog',
props: { props: {
close_action: { default: 'dialog.cancel', type: String },
delete_action: { default: '', type: String },
ok_action: { default: '', type: String },
show: Boolean, show: Boolean,
title: String, title: { required: true, type: String }
ok_action: String,
delete_action: String,
close_action: String
}, },
emits: ['delete', 'close', 'ok'] emits: ['delete', 'close', 'ok']
} }

View File

@ -121,10 +121,10 @@ export default {
name: 'ModalDialogAlbum', name: 'ModalDialogAlbum',
components: { CoverArtwork }, components: { CoverArtwork },
props: { props: {
show: Boolean, album: { required: true, type: Object },
album: Object, media_kind: { default: '', type: String },
media_kind: String, new_tracks: { required: true, type: Array },
new_tracks: Array show: Boolean
}, },
emits: ['close', 'remove-podcast', 'play-count-changed'], emits: ['close', 'remove-podcast', 'play-count-changed'],

View File

@ -94,7 +94,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogAlbumSpotify', name: 'ModalDialogAlbumSpotify',
components: { CoverArtwork }, components: { CoverArtwork },
props: { show: Boolean, album: Object }, props: { album: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
data() { data() {

View File

@ -69,7 +69,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogArtist', name: 'ModalDialogArtist',
props: { show: Boolean, artist: Object }, props: { artist: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -75,7 +75,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogArtistSpotify', name: 'ModalDialogArtistSpotify',
props: { show: Boolean, artist: Object }, props: { artist: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -71,7 +71,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogComposer', name: 'ModalDialogComposer',
props: { show: Boolean, composer: Object }, props: { composer: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -42,7 +42,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogDirectory', name: 'ModalDialogDirectory',
props: { show: Boolean, directory: String }, props: { directory: { required: true, type: String }, show: Boolean },
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -62,7 +62,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogGenre', name: 'ModalDialogGenre',
props: { genre: Object, media_kind: String, show: Boolean }, props: {
genre: { required: true, type: Object },
media_kind: { required: true, type: String },
show: Boolean
},
emits: ['close'], emits: ['close'],
computed: { computed: {

View File

@ -68,7 +68,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogPlaylist', name: 'ModalDialogPlaylist',
props: { show: Boolean, playlist: Object, uris: String }, props: {
playlist: { required: true, type: Object },
show: Boolean,
uris: { default: '', type: String }
},
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -80,7 +80,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogPlaylistSpotify', name: 'ModalDialogPlaylistSpotify',
props: { show: Boolean, playlist: Object }, props: { playlist: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -154,7 +154,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogQueueItem', name: 'ModalDialogQueueItem',
props: { show: Boolean, item: Object }, props: { item: { required: true, type: Object }, show: Boolean },
emits: ['close'], emits: ['close'],
data() { data() {

View File

@ -185,7 +185,7 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogTrack', name: 'ModalDialogTrack',
props: { show: Boolean, track: Object }, props: { show: Boolean, track: { required: true, type: Object } },
emits: ['close', 'play-count-changed'], emits: ['close', 'play-count-changed'],
data() { data() {

View File

@ -110,7 +110,11 @@ import webapi from '@/webapi'
export default { export default {
name: 'ModalDialogTrackSpotify', name: 'ModalDialogTrackSpotify',
props: { show: Boolean, track: Object, album: Object }, props: {
album: { required: true, type: Object },
show: Boolean,
track: { required: true, type: Object }
},
emits: ['close'], emits: ['close'],
methods: { methods: {

View File

@ -16,7 +16,7 @@ export default {
name: 'NavbarItemLink', name: 'NavbarItemLink',
props: { props: {
exact: Boolean, exact: Boolean,
to: Object to: { required: true, type: Object }
}, },
computed: { computed: {

View File

@ -47,12 +47,12 @@ export default {
components: { components: {
ControlSlider ControlSlider
}, },
props: { output: Object }, props: { output: { required: true, type: Object } },
data() { data() {
return { return {
volume: this.output.selected ? this.output.volume : 0, cursor: mdiCancel,
cursor: mdiCancel volume: this.output.selected ? this.output.volume : 0
} }
}, },

View File

@ -14,11 +14,8 @@ import webapi from '@/webapi'
export default { export default {
name: 'PlayerButtonSeekBack', name: 'PlayerButtonSeekBack',
props: { props: {
seek_ms: Number, icon_size: { default: 16, type: Number },
icon_size: { seek_ms: { required: true, type: Number }
type: Number,
default: 16
}
}, },
computed: { computed: {

View File

@ -14,11 +14,8 @@ import webapi from '@/webapi'
export default { export default {
name: 'PlayerButtonSeekForward', name: 'PlayerButtonSeekForward',
props: { props: {
seek_ms: Number, icon_size: { default: 16, type: Number },
icon_size: { seek_ms: { required: true, type: Number }
type: Number,
default: 16
}
}, },
computed: { computed: {

View File

@ -26,13 +26,16 @@ import webapi from '@/webapi'
export default { export default {
name: 'SettingsCheckbox', name: 'SettingsCheckbox',
props: { category_name: String, option_name: String }, props: {
category_name: { required: true, type: String },
option_name: { required: true, type: String }
},
data() { data() {
return { return {
statusUpdate: '',
timerDelay: 2000, timerDelay: 2000,
timerId: -1, timerId: -1
statusUpdate: ''
} }
}, },

View File

@ -33,10 +33,10 @@ import webapi from '@/webapi'
export default { export default {
name: 'SettingsIntfield', name: 'SettingsIntfield',
props: { props: {
category_name: String, category_name: { required: true, type: String },
option_name: String, disabled: Boolean,
placeholder: String, option_name: { required: true, type: String },
disabled: Boolean placeholder: { default: '', type: String }
}, },
data() { data() {

View File

@ -32,10 +32,10 @@ import webapi from '@/webapi'
export default { export default {
name: 'SettingsTextfield', name: 'SettingsTextfield',
props: { props: {
category_name: String, category_name: { required: true, type: String },
option_name: String, disabled: Boolean,
placeholder: String, option_name: { required: true, type: String },
disabled: Boolean placeholder: { default: '', type: String }
}, },
data() { data() {

View File

@ -38,7 +38,7 @@ import * as types from '@/store/mutation_types'
export default { export default {
name: 'TabsSearch', name: 'TabsSearch',
props: { query: String }, props: { query: { default: '', type: String } },
computed: { computed: {
spotify_enabled() { spotify_enabled() {