@ant-design/compatible
Version:
Ant Design v3 to v4 compatible package
67 lines (66 loc) • 3.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.resetForm = exports.genFormControlValidation = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var resetForm = function resetForm(token) {
var _ref;
var colorText = token.colorText,
colorTextSecondary = token.colorTextSecondary,
fontSizeLG = token.fontSizeLG,
lineHeight = token.lineHeight,
lineWidth = token.lineWidth,
lineType = token.lineType,
colorBorder = token.colorBorder,
fontSize = token.fontSize;
return _ref = {
// Based on Bootstrap framework
legend: {
display: 'block',
width: '100%',
marginBottom: '20px',
padding: '0',
color: colorTextSecondary,
fontSize: fontSizeLG,
lineHeight: 'inherit',
border: '0',
borderBottom: "".concat(lineWidth, "px ").concat(lineType, " ").concat(colorBorder)
},
label: {
fontSize: fontSize
}
}, _defineProperty(_ref, "input[type='search']", {
boxSizing: 'border-box'
}), _defineProperty(_ref, "input[type='radio'], input[type='checkbox']", {
lineHeight: 'normal'
}), _defineProperty(_ref, "input[type='file']", {
display: 'block'
}), _defineProperty(_ref, "input[type='range']", {
display: 'block',
width: '100%'
}), _defineProperty(_ref, 'select[multiple], select[size]', {
height: 'auto'
}), _defineProperty(_ref, "input[type='file']:focus, input[type='radio']:focus, input[type='checkbox']:focus", [{
outline: 'thin dotted'
}, {
outline: '5px auto -webkit-focus-ring-color',
outlineOffset: '-2px'
}]), _defineProperty(_ref, "output", {
display: 'block',
paddingTop: '15px',
color: colorText,
fontSize: fontSize,
lineHeight: lineHeight
}), _ref;
};
exports.resetForm = resetForm;
var genFormControlValidation = function genFormControlValidation(componentCls, colorText) {
return _defineProperty({}, "".concat(componentCls, "-explain, ").concat(componentCls, "-split"), {
color: colorText
});
};
exports.genFormControlValidation = genFormControlValidation;