@txdfe/at
Version:
一个设计体系组件库
31 lines • 1.51 kB
JavaScript
var _excluded = ["listType", "defaultFileList", "fileList"];
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
// compatible with 0.x version
/* istanbul ignore next */
var transform = function transform(props, deprecated) {
var listType = props.listType,
defaultFileList = props.defaultFileList,
fileList = props.fileList,
others = _objectWithoutProperties(props, _excluded);
var newprops = others;
if (listType === 'text-image') {
deprecated('listType=text-image', 'listType=image', 'Upload');
newprops.listType = 'image';
} else if (listType === 'picture-card') {
deprecated('listType=picture-card', 'listType=card', 'Upload');
newprops.listType = 'card';
} else {
newprops.listType = listType;
}
if ('defaultFileList' in props) {
deprecated('defaultFileList', 'defaultValue', 'Upload');
newprops.defaultValue = defaultFileList;
}
if ('fileList' in props) {
deprecated('fileList', 'value', 'Upload');
newprops.value = fileList;
}
return newprops;
};
export default transform;