How to use the @form-create/utils.isUndef 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 / iview / src / components / upload / handler.js View on Github external
init() {
        let props = this.rule.props;
        $set(props, 'defaultFileList', []);
        if (isUndef(props.showUploadList)) $set(props, 'showUploadList', false);
        if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');

        if (props.maxLength === undefined) $set(props, 'maxLength', 0);
        if (props.action === undefined) $set(props, 'action', '');
        if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);

        if (!props.modalTitle) $set(props, 'modalTitle', '预览');

        $set(this.rule, 'value', parseValue(this.rule.value));

        this.parseValue = [];
    }
github xaboy / form-create / packages / element-ui / src / fApi.js View on Github external
getValue(field) {
            const handler = fc.handlers[field];
            if (isUndef(handler)) return;
            let val = undefined;
            if (handler.noValue === true)
                handler.$emit('input', (v) => {
                    val = v;
                }, this);
            else
                val = deepExtend({}, {value: vm._value(field)}).value;
            return val;
        },
        setValue(field, value) {
github xaboy / form-create / packages / core / src / core / render.js View on Github external
renderTemplate(parser) {
        const {id, rule, key} = parser;
        if (Vue.compile === undefined) {
            console.error('使用的 Vue 版本不支持 compile' + errMsg());
            return [];
        }

        if (!this.renderList[id]) {
            let vm = rule.vm;
            if (isUndef(rule.vm))
                vm = new Vue;
            else if (isFunction(rule.vm))
                vm = rule.vm(this.$handle.getInjectData(rule));

            this.renderList[id] = {
                vm,
                template: Vue.compile(rule.template)
            };

        }

        const {vm, template} = this.renderList[id];

        setTemplateProps(vm, parser, this.$handle.fCreateApi);

        vm.$off('input');
github xaboy / form-create / packages / element-ui / src / form.js View on Github external
makeResetBtn(unique, span) {
        const resetBtn = this.fc.options.resetBtn,
            props = isUndef(this.fc.options.resetBtn.col) ? {span: span, push: 1} : resetBtn.col;

        return this.vNode.col({props: props, key: `${this.unique}col3`}, [
            this.vNode.button({
                key: `frsbtn${unique}`, props: this.vm.resetProps, on: {
                    'click': () => {
                        const fApi = this.fc.fCreateApi;
                        isFunction(resetBtn.click)
                            ? resetBtn.click(fApi)
                            : fApi.resetFields();
                    }
                }, style: {width: this.vm.resetProps.width}
            }, [this.vm.resetProps.innerText])
        ]);
    }
github xaboy / form-create / packages / element-ui / src / components / frame / handler.js View on Github external
export function parseRule(rule) {
    let props = rule.props;
    if (!props.type) $set(props, 'type', 'input');
    if (!props.icon) $set(props, 'icon', 'el-icon-upload2');
    if (!props.height) $set(props, 'height', '370px');
    if (isUndef(props.spin)) $set(props, 'spin', true);
    if (!props.title) $set(props, 'title', '请选择' + rule.title);
    if (!props.maxLength) $set(props, 'maxLength', 0);

    if (!props.okBtnText) $set(props, 'okBtnText', '确定');
    if (!props.closeBtnText) $set(props, 'closeBtnText', '关闭');
    if (!props.modalTitle) $set(props, 'modalTitle', '预览');

    let handleIcon = props.handleIcon;
    if (props.type === 'file' && props.handleIcon === undefined)
        handleIcon = false;
    else
        handleIcon = props.handleIcon === true || props.handleIcon === undefined ? 'el-icon-view' : props.handleIcon;
    $set(props, 'handleIcon', handleIcon);

    if (props.allowRemove === undefined) $set(props, 'allowRemove', true);
github xaboy / form-create / packages / element-ui / src / core / modal.js View on Github external
const Modal = (options, cb) => {
    if (isUndef(options.width)) options.width = '30%';
    return {
        name: 'fc-modal',
        data() {
            return {
                visible: true,
                ...options
            }
        },
        render() {
            vNode.setVm(this);
            return vNode.modal({
                props: this.$data,
                on: {
                    close: this.onClose,
                    closed: this.onClosed,
                }
github xaboy / form-create / packages / core / src2 / factory / handler.js View on Github external
function parseProps(props) {
    if (isUndef(props.hidden)) $set(props, 'hidden', false);
    if (isUndef(props.visibility)) $set(props, 'visibility', false);

    return props;
}
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;
    };
});