How to use @form-create/utils - 10 common examples

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 / src2 / factory / handler.js View on Github external
col: parseCol(rule.col),
        props: parseProps(rule.props),
        emitEvent: parseEmit(rule.field, rule.emitPrefix, rule.emit, vm),
        validate: parseArray(rule.validate),
        options: parseArray(rule.options)
    };

    // parseRule.event = extend(rule.event, parseRule.emitEvent);
    parseRule.on = parseOn(rule.on, parseRule.emitEvent);

    Object.keys(parseRule).forEach(k => {
        $set(rule, k, parseRule[k]);
    });

    if (!rule.field && !noVal) {
        console.error('规则的 field 字段不能空' + errMsg());
    }

    return rule;
}
github xaboy / form-create / packages / element-ui / src / components / upload / render.js View on Github external
init() {
        let handler = this.handler;
        this.uploadOptions = extend({...this.options.upload}, this.handler.rule.props);
        this.issetIcon = this.uploadOptions.allowRemove || this.uploadOptions.handleIcon;
        this.propsData = this.vData.props(this.uploadOptions).class('fc-upload-con', true)
            .props('onSuccess', (...args) => this.onSuccess(...args))
            // .props('onRemove', (...args) => this.onRemove(...args))
            .ref(handler.refName).key(`fip${handler.unique}`).get();
    }
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 / components / upload / handler.js View on Github external
init() {
        this.parseValue = [];
        const props = this.rule.props;
        props.fileList = [];
        props.showFileList = false;
        if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');
        if (!props.modalTitle) $set(props, 'modalTitle', '预览');
        if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);
        $set(this.rule, 'value', parseValue(this.rule.value));
    }
github xaboy / form-create / packages / iview / src / components / cascader / handler.js View on Github external
init() {
        let rule = this.rule;
        if (!rule.props.data) $set(rule.props, 'data', []);
        if (!rule.props.options) $set(rule.props, 'options', []);
        if (!Array.isArray(this.rule.value)) $set(rule, 'value', []);
    }
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 / components / upload / handler.js View on Github external
export function getFileName(pic) {
    return toString(pic).split('/').pop()
}
github xaboy / form-create / packages / iview / src / components / upload / index.jsx View on Github external
function getFileName(file) {
    return toString(file).split('/').pop()
}