Sha256: 1bd27333050541a955d3afd7c7c9b670c931e25d98ab44278f3f85804391d289

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

import {MDCSelect} from '@material/select';
import {VBaseComponent} from './base-component';
import {eventHandlerMixin} from './mixins/event-handler';

export function initSelects() {
    console.log('\tSelects');
    var components = document.querySelectorAll('.mdc-select');
    for (var i = 0; i < components.length; i++) {
        var component = components[i];
        if (!component.vComponent) {
            let vSelect = new VSelect(component, MDCSelect.attachTo(component));
            component.vComponent = vSelect;
            var selectInput = component.querySelector('select');
            selectInput.vComponent = vSelect;
        }
    }
}


export class VSelect extends eventHandlerMixin(VBaseComponent) {
    constructor(element, mdcComponent) {
        super(element);
        this.select = element.querySelector('select');
        this.mdcComponent = mdcComponent;
    }

    prepareSubmit(form, params) {
        // On actual post/submit the form is passed and we are not expected to return our value
        if (!form) {
            params.push([this.select.name, this.select.value]);
        }
    }

    validate() {
        return true;
    }

    name(){
            
    }

    value(){

    }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.12 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.11 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.10 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.9 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.8 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.7 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.6 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.5 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.4 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.3 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.2 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.1 views/mdc/assets/js/components/selects.js
voom-presenters-0.1.0 views/mdc/assets/js/components/selects.js