Ejemplo n.º 1
0
Archivo: state.js Proyecto: uikit/uikit
    function getProps(opts, name) {

        const data = {};
        const {args = [], props = {}, el} = opts;

        if (!props) {
            return data;
        }

        for (const key in props) {
            const prop = hyphenate(key);
            let value = getData(el, prop);

            if (!isUndefined(value)) {

                value = props[key] === Boolean && value === ''
                    ? true
                    : coerce(props[key], value);

                if (prop === 'target' && (!value || startsWith(value, '_'))) {
                    continue;
                }

                data[key] = value;
            }
        }

        const options = parseOptions(getData(el, name), args);

        for (const key in options) {
            const prop = camelize(key);
            if (props[prop] !== undefined) {
                data[prop] = coerce(props[prop], options[key]);
            }
        }

        return data;
    }
Ejemplo n.º 2
0
 return toNodes(nodes).sort((a, b) => data(a, sort).localeCompare(data(b, sort)) * (order === 'asc' || -1));
Ejemplo n.º 3
0
function getFilter(el, attr) {
    return parseOptions(data(el, attr), ['filter']);
}
Ejemplo n.º 4
0
 $$(`[${this.attrItem}],[data-${this.attrItem}]`, this.$el).forEach(el => {
     const index = data(el, this.attrItem);
     this.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index) && (this.sets && !includes(this.sets, toFloat(index)) || index > this.maxIndex));
 });
Ejemplo n.º 5
0
        },

        {
            name: 'click',

            el() {
                return this.connects;
            },

            delegate() {
                return `[${this.attrItem}],[data-${this.attrItem}]`;
            },

            handler(e) {
                e.preventDefault();
                this.show(data(e.current, this.attrItem));
            }
        },

        {
            name: 'swipeRight swipeLeft',

            filter() {
                return this.swiping;
            },

            el() {
                return this.connects;
            },

            handler({type}) {
Ejemplo n.º 6
0
 items.push(['href', 'caption', 'type', 'poster', 'alt'].reduce((obj, attr) => {
     obj[attr === 'href' ? 'source' : attr] = data(el, attr);
     return obj;
 }, {}));