How to use the @form-create/utils.isPlainObject function in @form-create/utils

To help you get started, we’ve selected a few @form-create/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xaboy / form-create / packages / core / src / core / handle.js View on Github external
emit.forEach(config => {
            let inject, eventName = config;
            if (isPlainObject(config)) {
                eventName = config.name;
                inject = config.inject;
            }
            if (!eventName) return;

            const emitKey = emitPrefix ? emitPrefix : field;
            const fieldKey = toLine(`${emitKey}-${eventName}`).replace('_', '-');

            const fn = (...arg) => {
                this.vm.$emit(fieldKey, ...arg);
            };
            fn.__emit = true;
            event[eventName] = (this.options.injectEvent || config.inject !== undefined) ? this.inject(rule, fn, inject) : fn;
        });
github xaboy / form-create / packages / element-ui / src / fApi.js View on Github external
setValue(field, value) {
            let formData = field;
            if (!isPlainObject(field))
                formData = {[field]: value};
            Object.keys(formData).forEach(key => {
                this.changeValue(key, formData[key]);
            });
        },
        changeValue(field, value) {
github xaboy / form-create / packages / core / src / core / api.js View on Github external
setValue(field, value) {
            let formData = field;
            if (!isPlainObject(field))
                formData = {[field]: value};
            Object.keys(formData).forEach(key => {
                const parser = h.fieldList[key];
                if (!parser) return;
                parser.rule.value = formData[key];
            });
        },
        changeValue(field, value) {
github xaboy / form-create / packages / core / src / factory / vData.js View on Github external
class(classList, status = true) {
        if (isUndef(classList)) return this;

        if (Array.isArray(classList)) {
            classList.forEach((cls) => {
                $set(this._data.class, toString(cls), true);
            });
        } else if (isPlainObject(classList)) {
            $set(this._data, 'class', extend(this._data.class, classList));
        } else {
            $set(this._data.class, toString(classList), status === undefined ? true : status);
        }

        return this;
    }
github xaboy / form-create / packages / framework / src / factory / vData.js View on Github external
VData.prototype[key] = function (obj, val) {
        if (isUndef(obj)) return this;

        if (isPlainObject(obj)) {
            $set(this._data, key, extend(this._data[key], obj));
        } else {
            $set(this._data[key], toString(obj), val);
        }

        return this;
    };
});
github xaboy / form-create / packages / core / src / core / index.js View on Github external
function install(Vue, options) {
        if (Vue._installedFormCreate === true) return;
        Vue._installedFormCreate = true;

        if (options && isPlainObject(options))
            margeGlobal(globalConfig, options);

        Vue.use(FormCreate);
    }
github xaboy / form-create / packages / iview / src / core / index.js View on Github external
Creator.prototype.event = function (key, value) {
    let event;

    if (!isPlainObject(key)) {
        event = {[key]: value}
    } else {
        event = key;
    }

    Object.keys(event).forEach((eventName) => {
        const name = toString(eventName).indexOf('on-') === 0 ? eventName : `on-${eventName}`;
        this.on(name, event[eventName]);
    });
    return this;
};
github xaboy / form-create / packages / core / src / factory / maker.js View on Github external
function parse(rule, toMaker = false) {
    if (isString(rule)) rule = parseJson(rule);

    if (rule instanceof Creator) return toMaker ? rule : rule.getRule();
    if (isPlainObject(rule)) {
        const maker = ruleToMaker(rule);
        return toMaker ? maker : maker.getRule();
    } else if (!Array.isArray(rule)) return rule;
    else {
        const rules = rule.map(r => parse(r, toMaker));
        Object.defineProperties(rules, {
            find: enumerable(findField),
            model: enumerable(model)
        });

        return rules;
    }
}
github xaboy / form-create / packages / framework / src / factory / vData.js View on Github external
class(classList, status = true) {
        if (isUndef(classList)) return this;

        if (Array.isArray(classList)) {
            classList.forEach((cls) => {
                $set(this._data.class, toString(cls), true);
            });
        } else if (isPlainObject(classList)) {
            $set(this._data, 'class', extend(this._data.class, classList));
        } else {
            $set(this._data.class, toString(classList), status === undefined ? true : status);
        }

        return this;
    }