How to use the @form-create/utils.$set 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 / 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 / core / src2 / factory / handler.js View on Github external
Object.keys(event).forEach(function(eventName) {
        const _name = toString(eventName).indexOf('on-') === 0 ? eventName : `on-${eventName}`;

        if (_name !== eventName) {
            $set(event, _name, event[eventName]);
        }
    });
github xaboy / form-create / packages / core / src / core / handle.js View on Github external
setParser(parser) {
        let {id, field, name, rule} = parser;
        if (this.parsers[id])
            return;
        this.parsers[id] = parser;

        if (name)
            $set(this.customData, name, parser);

        if (this.isNoVal(parser)) return;
        this.fieldList[field] = parser;
        $set(this.formData, field, parser.toFormValue(rule.value));
        $set(this.validate, field, rule.validate || []);
        $set(this.trueData, field, parser);
    }
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 / framework / src / factory / vData.js View on Github external
classList.forEach((cls) => {
                $set(this._data.class, toString(cls), true);
            });
        } else if (isPlainObject(classList)) {
github xaboy / form-create / packages / iview / 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', iviewConfig.fileUpIcon);
    if (!props.width) $set(props, 'width', '500px');
    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', '预览');
    if (!props.loadingText) $set(props, 'loadingText', '加载中...');

    let handleIcon = props.handleIcon;
    if (props.type === 'file' && props.handleIcon === undefined)
        handleIcon = false;
    else
        handleIcon = (props.handleIcon === true || props.handleIcon === undefined) ? 'ios-eye-outline' : props.handleIcon;
    $set(props, 'handleIcon', handleIcon);
    if (props.allowRemove === undefined) $set(props, 'allowRemove', true);
github xaboy / form-create / packages / core / src / core / handle.js View on Github external
setParser(parser) {
        let {id, field, name, rule} = parser;
        if (this.parsers[id])
            return;
        this.parsers[id] = parser;

        if (name)
            $set(this.customData, name, parser);

        if (this.isNoVal(parser)) return;
        this.fieldList[field] = parser;
        $set(this.formData, field, parser.toFormValue(rule.value));
        $set(this.validate, field, rule.validate || []);
        $set(this.trueData, field, parser);
    }