@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
27 lines (26 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformValueByType = transformValueByType;
function transformValueByType(values, config, formComponents) {
for (var key in values) {
var _formComponents$type, _formComponents$type2;
var type = '';
var outProps = {};
for (var i = 0; i < config.length; i++) {
var cc = config[i];
if ((cc === null || cc === void 0 ? void 0 : cc.key) === key) {
type = cc.type;
outProps = cc.props;
}
}
var transform = (_formComponents$type = formComponents[type]) === null || _formComponents$type === void 0 ? void 0 : _formComponents$type.transformDefaultValue;
// @ts-ignore
var propsNew = formComponents === null || formComponents === void 0 ? void 0 : (_formComponents$type2 = formComponents[type]) === null || _formComponents$type2 === void 0 ? void 0 : _formComponents$type2.transformProps(outProps, {});
if (transform) {
values[key] = transform(values[key], propsNew);
}
}
return values;
}