You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.0 KiB
60 lines
1.0 KiB
2 years ago
|
/**
|
||
|
* Mixin to Extend a Sidebar
|
||
|
*
|
||
|
* @author Björn Hase
|
||
|
* @license http://opensource.org/licenses/MIT The MIT License
|
||
|
* @link https://gitea.node001.net/tiny-components/sidebar-form
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
export default {
|
||
|
|
||
|
state: {
|
||
|
open: false, // if sidebar is open
|
||
|
loading: false, // if loading is shown
|
||
|
current: { // current data of form
|
||
|
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* close current sidebar
|
||
|
*
|
||
|
*/
|
||
|
handleClose() {
|
||
|
this.state.open = false
|
||
|
this.reset()
|
||
|
|
||
|
this.update()
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* getting css classes for sidebar
|
||
|
*
|
||
|
*
|
||
|
* @return {String}
|
||
|
*/
|
||
|
getCssClasses() {
|
||
|
const classes = [
|
||
|
'sidebar'
|
||
|
]
|
||
|
|
||
|
if (this.state.open === true) {
|
||
|
classes.push('sidebar--open')
|
||
|
}
|
||
|
|
||
|
return classes.join(' ')
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*
|
||
|
*/
|
||
|
onBeforeMount() {
|
||
|
if (!this.hasOwnProperty('reset')) {
|
||
|
throw new Error('reset-Function in Form is missing')
|
||
|
}
|
||
|
|
||
|
this.reset()
|
||
|
}
|
||
|
}
|