mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-12-24 02:25:48 +01:00
d51e5ab65d
- fix: Translation fixes - fix: Various fixes - feat: PB translations, configuration changes - fix: Bugfixes GitOrigin-RevId: 55f8b148c42a296162fc707c36a5146ca0073b4b
57 lines
1.0 KiB
Vue
57 lines
1.0 KiB
Vue
<script>
|
|
|
|
export default {
|
|
name: 'BaseList',
|
|
props: {
|
|
value: {
|
|
type: Array,
|
|
default: function () { return [] }
|
|
},
|
|
typeName: {
|
|
type: String,
|
|
default: 'element'
|
|
},
|
|
getDisplayName: {
|
|
type: Function,
|
|
default: function (x) {
|
|
return x
|
|
}
|
|
},
|
|
afterProcess: {
|
|
type: Function,
|
|
default: function (x) {
|
|
return x
|
|
}
|
|
},
|
|
mutable: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
newElement: null
|
|
}
|
|
},
|
|
methods: {
|
|
handleAddElementInit () {
|
|
this.$refs.newElementModal.show()
|
|
},
|
|
handleAddElementOk () {
|
|
let processed = this.afterProcess(this.newElement)
|
|
this.value.push(processed)
|
|
this.$emit('added', processed)
|
|
this.newElement = null
|
|
},
|
|
handleAddElementCancel () {
|
|
this.newElement = null
|
|
},
|
|
deleteElement (elementIndex) {
|
|
let deleted = this.value[elementIndex]
|
|
this.value.splice(elementIndex, 1)
|
|
this.$emit('deleted', deleted)
|
|
}
|
|
}
|
|
}
|
|
</script>
|