/**
 *  mixin extends sidebarForm
 *
 *  @author Björn Hase
 *  @license hhttps://www.gnu.org/licenses/gpl-3.0.en.html GPL-3
 *  @link https://gitea.node001.net/HerrHase/potato-launcher.git
 *
 */

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.reset()

        this.state.open = false
        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()
    }
}