Sha256: a1891c586ee1adbda143703942874579ab9fa3880eab91a4efbdffd0f78ec138

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

import {MDCDrawer} from '@material/drawer';
import {VBaseComponent} from './base-component';
import {hookupComponents} from './base-component';
import {eventHandlerMixin} from './mixins/event-handler';

export function initDrawer(e) {
    console.debug('\tDrawer');
    hookupComponents(e, '.v-drawer__modal', VModalDrawer, MDCDrawer);
    hookupComponents(e, '.v-drawer__dismissible', VDismissibleDrawer, MDCDrawer);
}

class VDrawer extends eventHandlerMixin(VBaseComponent) {
    constructor(element, mdcComponent) {
        super(element, mdcComponent);
        const header = this.root.querySelector('.v-header');
        if (header) {
            header.addEventListener('MDCTopAppBar:nav',
                () => {
                    if (this.isActive()) {
                        this.mdcComponent.open = !this.mdcComponent.open;
                    }
                });
        }
    }

    isActive() {
        return (getComputedStyle(this.element).
            getPropertyValue('--v-drawer-active') !== 'no');
    }
}

export class VModalDrawer extends VDrawer {
    constructor(element, mdcComponent) {
        super(element, mdcComponent);
        this.mdcComponent.open = false;
    }
}

export class VDismissibleDrawer extends VDrawer {
    constructor(element, mdcComponent) {
        super(element, mdcComponent);
    }
}

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
coprl-3.0.0.beta.12 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.11 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.10 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.9 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.8 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.7 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.6 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.5 views/mdc/assets/js/components/drawer.js
voom-presenters-2.1.2 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.4 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.3 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.2 views/mdc/assets/js/components/drawer.js
coprl-3.0.0.beta.1 views/mdc/assets/js/components/drawer.js
voom-presenters-2.1.0 views/mdc/assets/js/components/drawer.js
voom-presenters-2.0.3 views/mdc/assets/js/components/drawer.js
voom-presenters-2.0.2 views/mdc/assets/js/components/drawer.js
voom-presenters-2.0.1 views/mdc/assets/js/components/drawer.js
voom-presenters-2.0.0 views/mdc/assets/js/components/drawer.js