@oceanbase/design
Version:
The Design System of OceanBase
93 lines • 6.03 kB
JavaScript
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
export var genCompactStyle = function genCompactStyle(componentCls) {
var subComponentCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return _defineProperty(_defineProperty(_defineProperty({}, "&".concat(componentCls, "-compact-item:not(").concat(componentCls, "-compact-last-item)").concat(componentCls, "-compact-first-item ").concat(subComponentCls), {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}), "&".concat(componentCls, "-compact-item:not(").concat(componentCls, "-compact-first-item):not(").concat(componentCls, "-compact-last-item) ").concat(subComponentCls), {
borderRadius: 0
}), "&".concat(componentCls, "-compact-item:not(").concat(componentCls, "-compact-first-item)").concat(componentCls, "-compact-last-item ").concat(subComponentCls), {
borderStartStartRadius: 0,
borderEndStartRadius: 0
});
};
export var genLargeStyle = function genLargeStyle(token) {
var antCls = token.antCls,
iconCls = token.iconCls,
fontSize = token.fontSize,
lineWidth = token.lineWidth,
borderRadiusLG = token.borderRadiusLG,
controlHeight = token.controlHeight,
controlHeightSM = token.controlHeightSM,
controlHeightLG = token.controlHeightLG;
var height = controlHeightLG;
var lineHeight = "".concat(controlHeightLG, "px");
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(antCls, "-btn"), _objectSpread({
// limit min width for icon button
minWidth: controlHeightLG,
height: height,
fontSize: fontSize,
borderRadius: borderRadiusLG
}, genCompactStyle("".concat(antCls, "-btn")))), "".concat(antCls, "-radio-group"), _defineProperty({}, "".concat(antCls, "-radio-button-wrapper"), _defineProperty(_defineProperty({
height: height,
lineHeight: "".concat(height - lineWidth * 2, "px"),
fontSize: fontSize
}, "&:first-child", {
borderStartStartRadius: borderRadiusLG,
borderEndStartRadius: borderRadiusLG
}), "&:last-child", {
borderStartEndRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
}))), "".concat(antCls, "-select"), _objectSpread(_objectSpread({
height: height,
fontSize: fontSize
}, genCompactStyle("".concat(antCls, "-select"), "".concat(antCls, "-select-selector"))), {}, _defineProperty(_defineProperty({}, "".concat(antCls, "-select-selector"), {
borderRadius: borderRadiusLG
}), "".concat(antCls, "-select-selection-item"), {
fontSize: fontSize
}))), "".concat(antCls, "-select-multiple ").concat(antCls, "-select-selection-wrap"), {
// ref: https://github.com/oceanbase/oceanbase-design/pull/881
height: '100%'
}), "".concat(antCls, "-input-wrapper"), _defineProperty(_defineProperty({
fontSize: fontSize
}, "".concat(iconCls), {
fontSize: fontSize
}), "".concat(antCls, "-input-affix-wrapper"), {
borderStartEndRadius: 0,
borderEndEndRadius: 0
})), "".concat(antCls, "-input-affix-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
height: height,
borderRadius: borderRadiusLG
}, "&:not(".concat(antCls, "-input-affix-wrapper-lg)"), {
lineHeight: "".concat(controlHeight - lineWidth * 2, "px")
}), "".concat(antCls, "-input"), {
height: "".concat(controlHeight - lineWidth * 2, "px")
}), "".concat(antCls, "-input-lg"), {
height: controlHeightSM
}), "".concat(antCls, "-input-sm"), {
height: "".concat(controlHeightLG - lineWidth * 2, "px")
})), "".concat(antCls, "-input"), _objectSpread({
height: height,
fontSize: fontSize,
borderRadius: borderRadiusLG
}, genCompactStyle("".concat(antCls, "-input")))), "".concat(antCls, "-input-search-button"), {
height: height,
lineHeight: lineHeight,
borderStartEndRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
}), "".concat(antCls, "-input-group-addon"), {
fontSize: fontSize,
borderStartEndRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
}), "".concat(antCls, "-picker"), _objectSpread(_objectSpread({
height: height,
borderRadius: borderRadiusLG
}, genCompactStyle("".concat(antCls, "-picker"))), {}, _defineProperty({}, "".concat(antCls, "-picker-input>input"), {
fontSize: fontSize
})));
};