| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.genCompactItemStyle = genCompactItemStyle;
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
- // handle border collapse
- function compactItemBorder(token, parentCls, options) {
- const {
- focusElCls,
- focus,
- borderElCls
- } = options;
- const childCombinator = borderElCls ? '> *' : '';
- const hoverEffects = ['hover', focus ? 'focus' : null, 'active'].filter(Boolean).map(n => `&:${n} ${childCombinator}`).join(',');
- return {
- [`&-item:not(${parentCls}-last-item)`]: {
- marginInlineEnd: -token.lineWidth
- },
- '&-item': (0, _extends2.default)((0, _extends2.default)({
- [hoverEffects]: {
- zIndex: 2
- }
- }, focusElCls ? {
- [`&${focusElCls}`]: {
- zIndex: 2
- }
- } : {}), {
- [`&[disabled] ${childCombinator}`]: {
- zIndex: 0
- }
- })
- };
- }
- // handle border-radius
- function compactItemBorderRadius(prefixCls, parentCls, options) {
- const {
- borderElCls
- } = options;
- const childCombinator = borderElCls ? `> ${borderElCls}` : '';
- return {
- [`&-item:not(${parentCls}-first-item):not(${parentCls}-last-item) ${childCombinator}`]: {
- borderRadius: 0
- },
- [`&-item:not(${parentCls}-last-item)${parentCls}-first-item`]: {
- [`& ${childCombinator}, &${prefixCls}-sm ${childCombinator}, &${prefixCls}-lg ${childCombinator}`]: {
- borderStartEndRadius: 0,
- borderEndEndRadius: 0
- }
- },
- [`&-item:not(${parentCls}-first-item)${parentCls}-last-item`]: {
- [`& ${childCombinator}, &${prefixCls}-sm ${childCombinator}, &${prefixCls}-lg ${childCombinator}`]: {
- borderStartStartRadius: 0,
- borderEndStartRadius: 0
- }
- }
- };
- }
- function genCompactItemStyle(token) {
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
- focus: true
- };
- const {
- componentCls
- } = token;
- const compactCls = `${componentCls}-compact`;
- return {
- [compactCls]: (0, _extends2.default)((0, _extends2.default)({}, compactItemBorder(token, compactCls, options)), compactItemBorderRadius(componentCls, compactCls, options))
- };
- }
|