compact-item.less 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. .compact-item-border-radius(@prefix-cls, @bordered-item-cls: null) {
  2. & when (@bordered-item-cls = null) {
  3. // border-radius
  4. &-item:not(&-first-item):not(&-last-item).@{prefix-cls} {
  5. border-radius: 0;
  6. }
  7. &-item.@{prefix-cls}&-first-item:not(&-last-item):not(&-item-rtl) {
  8. border-top-right-radius: 0;
  9. border-bottom-right-radius: 0;
  10. }
  11. &-item.@{prefix-cls}&-last-item:not(&-first-item):not(&-item-rtl) {
  12. border-top-left-radius: 0;
  13. border-bottom-left-radius: 0;
  14. }
  15. // ----------rtl for first item----------
  16. &-item.@{prefix-cls}&-item-rtl&-first-item:not(&-last-item) {
  17. border-top-left-radius: 0;
  18. border-bottom-left-radius: 0;
  19. }
  20. // ----------rtl for last item----------
  21. &-item.@{prefix-cls}&-item-rtl&-last-item:not(&-first-item) {
  22. border-top-right-radius: 0;
  23. border-bottom-right-radius: 0;
  24. }
  25. }
  26. & when (not (@bordered-item-cls = null)) {
  27. // border-radius
  28. &-item:not(&-first-item):not(&-last-item).@{prefix-cls} .@{bordered-item-cls} {
  29. border-radius: 0;
  30. }
  31. &-item&-first-item.@{prefix-cls}:not(&-last-item):not(&-item-rtl) .@{bordered-item-cls} {
  32. border-top-right-radius: 0;
  33. border-bottom-right-radius: 0;
  34. }
  35. &-item&-last-item.@{prefix-cls}:not(&-first-item):not(&-item-rtl) .@{bordered-item-cls} {
  36. border-top-left-radius: 0;
  37. border-bottom-left-radius: 0;
  38. }
  39. // ----------rtl for first item----------
  40. &-item.@{prefix-cls}&-first-item&-item-rtl:not(&-last-item) .@{bordered-item-cls} {
  41. border-top-left-radius: 0;
  42. border-bottom-left-radius: 0;
  43. }
  44. // ----------rtl for last item----------
  45. &-item.@{prefix-cls}&-last-item&-item-rtl:not(&-first-item) .@{bordered-item-cls} {
  46. border-top-right-radius: 0;
  47. border-bottom-right-radius: 0;
  48. }
  49. }
  50. }
  51. .compact-item-border(@prefix-cls, @bordered-item-cls: null, @special-open-cls) {
  52. & when (@bordered-item-cls = null) {
  53. // border collapse
  54. &-item:not(&-last-item):not(&-item-rtl) {
  55. margin-right: -@border-width-base;
  56. }
  57. // rtl border collapse
  58. &-item:not(&-last-item)&-item-rtl {
  59. margin-left: -@border-width-base;
  60. }
  61. &-item {
  62. &:hover,
  63. &:focus,
  64. &:active {
  65. z-index: 2;
  66. }
  67. // Select has an extra focus className
  68. & when (not (@special-item-cls = null)) {
  69. &.@{special-item-cls} {
  70. z-index: 2;
  71. }
  72. }
  73. &[disabled] {
  74. z-index: 0;
  75. }
  76. }
  77. }
  78. & when (not (@bordered-item-cls = null)) {
  79. // border collapse
  80. &-item:not(&-last-item) {
  81. margin-right: -@border-width-base;
  82. &.@{prefix-cls}-compact-item-rtl {
  83. margin-right: 0;
  84. margin-left: -@border-width-base;
  85. }
  86. }
  87. &-item {
  88. &:hover,
  89. &:focus,
  90. &:active {
  91. > * {
  92. z-index: 2;
  93. }
  94. }
  95. // Select has an special focus-item
  96. & when (not (@special-item-cls = null)) {
  97. &.@{special-item-cls} > * {
  98. z-index: 2;
  99. }
  100. }
  101. &[disabled] > * {
  102. z-index: 0;
  103. }
  104. }
  105. }
  106. }
  107. .compact-item(@prefix-cls, @bordered-item-cls: null, @special-item-cls: null) {
  108. &-compact {
  109. .compact-item-border(@prefix-cls, @bordered-item-cls, @special-item-cls);
  110. .compact-item-border-radius(@prefix-cls, @bordered-item-cls);
  111. }
  112. }