Render editable keyword input for settings that have type ['list', 'tuple']

This commit is contained in:
Angelina Filippova 2020-07-11 03:28:53 +03:00
parent 0323053fee
commit 3f82738d86
2 changed files with 7 additions and 2 deletions

View file

@ -254,7 +254,8 @@ export default {
}
},
keywordData() {
if (this.settingParent.length > 0) {
if (this.settingParent.length > 0 ||
(Array.isArray(this.setting.type) && this.setting.type.includes('tuple') && this.setting.type.includes('list'))) {
return Array.isArray(this.data[this.setting.key]) ? this.data[this.setting.key] : []
}
return Array.isArray(this.data) ? this.data : []
@ -286,6 +287,7 @@ export default {
return type === 'map' ||
(Array.isArray(type) && type.includes('keyword') && type.includes('integer')) ||
(Array.isArray(type) && type.includes('keyword') && type.includes('string')) ||
(Array.isArray(type) && type.includes('tuple') && type.includes('list')) ||
(Array.isArray(type) && type.includes('keyword') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1)
},
getFormattedDescription(desc) {

View file

@ -64,7 +64,10 @@ export default {
return Array.isArray(this.setting.type) && this.setting.type.includes('keyword') && this.setting.type.includes('integer')
},
editableKeywordWithString() {
return Array.isArray(this.setting.type) && this.setting.type.includes('keyword') && this.setting.type.includes('string')
return Array.isArray(this.setting.type) && (
(this.setting.type.includes('keyword') && this.setting.type.includes('string')) ||
(this.setting.type.includes('tuple') && this.setting.type.includes('list'))
)
},
isDesktop() {
return this.$store.state.app.device === 'desktop'