index.less 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @splitter-prefix-cls: ~'@{ant-prefix}-splitter';
  4. .@{splitter-prefix-cls} {
  5. .reset-component();
  6. display: flex;
  7. align-items: stretch;
  8. box-sizing: border-box;
  9. width: 100%;
  10. height: 100%;
  11. margin: 0;
  12. padding: 0;
  13. color: @text-color;
  14. font-size: @font-size-base;
  15. font-family: @font-family;
  16. line-height: @line-height-base;
  17. list-style: none;
  18. @half-trigger-size: calc(@splitter-split-trigger-size / 2);
  19. &-horizontal {
  20. flex-direction: row;
  21. }
  22. &-vertical {
  23. flex-direction: column;
  24. }
  25. &-panel {
  26. box-sizing: border-box;
  27. padding: 0 1px;
  28. overflow: auto;
  29. scrollbar-width: thin;
  30. &-hidden {
  31. padding: 0;
  32. overflow: hidden;
  33. }
  34. &:has(.@{splitter-prefix-cls}:only-child) {
  35. overflow: hidden;
  36. }
  37. }
  38. &-bar {
  39. position: relative;
  40. flex: none;
  41. user-select: none;
  42. &-preview {
  43. position: absolute;
  44. z-index: 1;
  45. display: none;
  46. background: @primary-color;
  47. opacity: 0.2;
  48. transition: none;
  49. pointer-events: none;
  50. &-active {
  51. display: block;
  52. }
  53. }
  54. // ======================= Dragger =======================
  55. &-dragger {
  56. position: absolute;
  57. top: 50%;
  58. left: 50%;
  59. z-index: 1;
  60. transform: translate(-50%, -50%);
  61. // Hover background
  62. &::before {
  63. position: absolute;
  64. top: 50%;
  65. left: 50%;
  66. background: @splitter-bar-bg;
  67. transform: translate(-50%, -50%);
  68. content: '';
  69. }
  70. // Hover
  71. &:hover:not(&-active) {
  72. &::before {
  73. background: @splitter-bar-hover-bg;
  74. }
  75. }
  76. // Spinner
  77. &::after {
  78. position: absolute;
  79. top: 50%;
  80. left: 50%;
  81. background: @fill-color;
  82. transform: translate(-50%, -50%);
  83. content: '';
  84. }
  85. // Active
  86. &-active {
  87. z-index: 2;
  88. &::before {
  89. background: @splitter-bar-active-bg;
  90. }
  91. }
  92. }
  93. &:hover &-collapse-bar, &:active &-collapse-bar {
  94. opacity: 1;
  95. }
  96. }
  97. // Disabled
  98. & > &-bar > &-bar-dragger&-bar-dragger-disabled {
  99. z-index: 0;
  100. &, &:hover, &-active {
  101. cursor: default;
  102. &::before {
  103. background: @splitter-bar-bg;
  104. }
  105. }
  106. &::after {
  107. display: none;
  108. }
  109. }
  110. // ======================= Collapse =======================
  111. &-bar-collapse-bar {
  112. position: absolute;
  113. top: 50%;
  114. left: 50%;
  115. z-index: 1000;
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. color: @text-color;
  120. font-size: @font-size-sm;
  121. background: @splitter-bar-bg;
  122. border-radius: @border-radius-sm;
  123. transform: translate(-50%, -50%);
  124. cursor: pointer;
  125. opacity: 0;
  126. &:hover {
  127. background: @splitter-bar-hover-bg;
  128. }
  129. &:active {
  130. background: @splitter-bar-active-bg;
  131. }
  132. }
  133. &-horizontal > &-bar {
  134. width: 0;
  135. }
  136. &-horizontal > &-bar &-bar-dragger {
  137. width: @splitter-split-trigger-size;
  138. height: 100%;
  139. cursor: col-resize;
  140. }
  141. &-horizontal > &-bar &-bar-dragger::before {
  142. width: @splitter-split-bar-size;
  143. height: 100%;
  144. }
  145. &-horizontal > &-bar &-bar-dragger::after {
  146. width: @splitter-split-bar-size;
  147. height: @splitter-split-bar-draggable-size;
  148. }
  149. &-horizontal > &-bar &-bar-preview {
  150. width: @splitter-split-bar-size;
  151. height: 100%;
  152. }
  153. &-horizontal > &-bar &-bar-collapse-bar {
  154. width: @font-size-sm;
  155. height: @splitter-split-bar-collapsible-size;
  156. }
  157. &-horizontal > &-bar &-bar-collapse-bar-start {
  158. right: @half-trigger-size;
  159. left: auto;
  160. transform: translateY(-50%);
  161. }
  162. &-horizontal > &-bar &-bar-collapse-bar-end {
  163. right: auto;
  164. left: @half-trigger-size;
  165. transform: translateY(-50%);
  166. }
  167. &-vertical > &-bar {
  168. height: 0;
  169. }
  170. &-vertical > &-bar &-bar-dragger {
  171. width: 100%;
  172. height: @splitter-split-trigger-size;
  173. cursor: row-resize;
  174. &:has(&-disabled) {
  175. cursor: default;
  176. }
  177. }
  178. &-vertical > &-bar &-bar-dragger::before {
  179. width: 100%;
  180. height: @splitter-split-bar-size;
  181. }
  182. &-vertical > &-bar &-bar-dragger::after {
  183. width: @splitter-split-bar-draggable-size;
  184. height: @splitter-split-bar-size;
  185. }
  186. &-vertical > &-bar &-bar-preview {
  187. width: 100%;
  188. height: @splitter-split-bar-size;
  189. }
  190. &-vertical > &-bar &-bar-collapse-bar {
  191. width: 24px;
  192. height: @font-size-sm;
  193. }
  194. &-vertical > &-bar &-bar-collapse-bar-start {
  195. top: auto;
  196. bottom: @half-trigger-size;
  197. transform: translateX(-50%);
  198. }
  199. &-vertical > &-bar &-bar-collapse-bar-end {
  200. top: @half-trigger-size;
  201. bottom: auto;
  202. transform: translateX(-50%);
  203. }
  204. // ======================= Mask =======================
  205. // Util dom for handle cursor
  206. &-mask {
  207. position: fixed;
  208. z-index: 1000;
  209. inset: 0;
  210. &-horizontal {
  211. cursor: col-resize;
  212. }
  213. &-vertical {
  214. cursor: row-resize;
  215. }
  216. }
  217. }
  218. @import './rtl';