Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = [];
}
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));
}
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', []);
}
Object.keys(event).forEach(function(eventName) {
const _name = toString(eventName).indexOf('on-') === 0 ? eventName : `on-${eventName}`;
if (_name !== eventName) {
$set(event, _name, event[eventName]);
}
});
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);
}
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);
}
classList.forEach((cls) => {
$set(this._data.class, toString(cls), true);
});
} else if (isPlainObject(classList)) {
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);
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);
}