index.less 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. @import '~ant-design-vue/es/style/themes/index';
  2. @import '~ant-design-vue/es/style/mixins/index';
  3. @import '~ant-design-vue/es/checkbox/style/mixin';
  4. @import './mixin';
  5. @import './directory';
  6. @tree-prefix-cls : ~'@{ant-prefix}-tree';
  7. @tree-showline-icon-color: @text-color-secondary;
  8. @tree-node-padding : 4px;
  9. .antCheckboxFn(@checkbox-prefix-cls: ~'@{ant-prefix}-tree-checkbox');
  10. .@{tree-prefix-cls} {
  11. /* see https://github.com/ant-design/ant-design/issues/16259 */
  12. &-checkbox-checked::after {
  13. position: absolute;
  14. top : 16.67%;
  15. left : 0;
  16. width : 100%;
  17. height : 66.67%;
  18. }
  19. .reset-component;
  20. margin : 0;
  21. padding: 0;
  22. ol,
  23. ul {
  24. margin : 0;
  25. padding : 0;
  26. list-style: none;
  27. }
  28. li {
  29. margin : 0;
  30. padding : @tree-node-padding 0;
  31. white-space: nowrap;
  32. list-style : none;
  33. outline : 0;
  34. span[draggable],
  35. span[draggable='true'] {
  36. line-height : @tree-title-height - 4px;
  37. border-top : 2px transparent solid;
  38. border-bottom : 2px transparent solid;
  39. user-select : none;
  40. /* Required to make elements draggable in old WebKit */
  41. -khtml-user-drag : element;
  42. -webkit-user-drag: element;
  43. }
  44. &.drag-over {
  45. >span[draggable] {
  46. color : white;
  47. background-color: @primary-color;
  48. opacity : 0.8;
  49. }
  50. }
  51. &.drag-over-gap-top {
  52. >span[draggable] {
  53. border-top-color: @primary-color;
  54. }
  55. }
  56. &.drag-over-gap-bottom {
  57. >span[draggable] {
  58. border-bottom-color: @primary-color;
  59. }
  60. }
  61. &.filter-node {
  62. >span {
  63. color : @highlight-color !important;
  64. font-weight: 500 !important;
  65. }
  66. }
  67. // When node is loading
  68. &.@{tree-prefix-cls}-treenode-loading {
  69. span {
  70. &.@{tree-prefix-cls}-switcher {
  71. &.@{tree-prefix-cls}-switcher_open,
  72. &.@{tree-prefix-cls}-switcher_close {
  73. .@{tree-prefix-cls}-switcher-loading-icon {
  74. position : absolute;
  75. left : 0;
  76. display : inline-block;
  77. width : 24px;
  78. height : @tree-title-height;
  79. color : @primary-color;
  80. font-size: @font-size-base;
  81. transform: none;
  82. svg {
  83. position: absolute;
  84. top : 0;
  85. right : 0;
  86. bottom : 0;
  87. left : 0;
  88. margin : auto;
  89. }
  90. }
  91. :root &::after {
  92. opacity: 0;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. ul {
  99. margin : 0;
  100. padding: 0 0 0 @tree-child-padding;
  101. }
  102. .@{tree-prefix-cls}-node-content-wrapper {
  103. display : inline-block;
  104. height : @tree-title-height;
  105. margin : 0;
  106. padding : 0 5px;
  107. color : @text-color;
  108. line-height : @tree-title-height;
  109. text-decoration: none;
  110. vertical-align : top;
  111. border-radius : @border-radius-sm;
  112. cursor : pointer;
  113. transition : all 0.3s;
  114. &:hover {
  115. background-color: @tree-node-hover-bg;
  116. }
  117. &.@{tree-prefix-cls}-node-selected {
  118. background-color: @tree-node-selected-bg;
  119. }
  120. }
  121. span {
  122. &.@{tree-prefix-cls}-checkbox {
  123. top : initial;
  124. height : @tree-title-height;
  125. margin : 0 4px 0 2px;
  126. padding: ((@tree-title-height - 16px) / 2) 0;
  127. }
  128. &.@{tree-prefix-cls}-switcher,
  129. &.@{tree-prefix-cls}-iconEle {
  130. display : inline-block;
  131. width : 24px;
  132. height : @tree-title-height;
  133. margin : 0;
  134. line-height : @tree-title-height;
  135. text-align : center;
  136. vertical-align: top;
  137. border : 0 none;
  138. outline : none;
  139. cursor : pointer;
  140. }
  141. &.@{tree-prefix-cls}-iconEle:empty {
  142. display: none;
  143. }
  144. &.@{tree-prefix-cls}-switcher {
  145. position: relative;
  146. &.@{tree-prefix-cls}-switcher-noop {
  147. cursor: default;
  148. }
  149. &.@{tree-prefix-cls}-switcher_open {
  150. .antTreeSwitcherIcon();
  151. }
  152. &.@{tree-prefix-cls}-switcher_close {
  153. .antTreeSwitcherIcon();
  154. .@{tree-prefix-cls}-switcher-icon {
  155. svg {
  156. transform: rotate(-90deg);
  157. }
  158. }
  159. }
  160. }
  161. }
  162. &:last-child>span {
  163. &.@{tree-prefix-cls}-switcher,
  164. &.@{tree-prefix-cls}-iconEle {
  165. &::before {
  166. display: none;
  167. }
  168. }
  169. }
  170. }
  171. >li {
  172. &:first-child {
  173. padding-top: 7px;
  174. }
  175. &:last-child {
  176. padding-bottom: 7px;
  177. }
  178. }
  179. &-child-tree {
  180. // https://github.com/ant-design/ant-design/issues/14958
  181. >li {
  182. // Provide additional padding between top child node and parent node
  183. &:first-child {
  184. padding-top: 2 * @tree-node-padding;
  185. }
  186. // Hide additional padding between last child node and next parent node
  187. &:last-child {
  188. padding-bottom: 0;
  189. }
  190. }
  191. }
  192. li&-treenode-disabled {
  193. >span:not(.@{tree-prefix-cls}-switcher),
  194. >.@{tree-prefix-cls}-node-content-wrapper,
  195. >.@{tree-prefix-cls}-node-content-wrapper span {
  196. color : @disabled-color;
  197. cursor: not-allowed;
  198. }
  199. >.@{tree-prefix-cls}-node-content-wrapper:hover {
  200. background: transparent;
  201. }
  202. }
  203. &-icon__open {
  204. margin-right : 2px;
  205. vertical-align: top;
  206. }
  207. &-icon__close {
  208. margin-right : 2px;
  209. vertical-align: top;
  210. }
  211. // Tree with line
  212. &&-show-line {
  213. li {
  214. position: relative;
  215. span {
  216. &.@{tree-prefix-cls}-switcher {
  217. color : @tree-showline-icon-color;
  218. background: @component-background;
  219. &.@{tree-prefix-cls}-switcher-noop {
  220. .antTreeShowLineIcon('tree-doc-icon');
  221. }
  222. &.@{tree-prefix-cls}-switcher_open {
  223. .antTreeShowLineIcon('tree-showline-open-icon');
  224. }
  225. &.@{tree-prefix-cls}-switcher_close {
  226. .antTreeShowLineIcon('tree-showline-close-icon');
  227. }
  228. }
  229. }
  230. }
  231. li:not(:last-child)::before {
  232. position : absolute;
  233. left : 12px;
  234. width : 1px;
  235. height : 100%;
  236. height : calc(100% - 22px); // Remove additional height if support
  237. margin : 22px 0 0;
  238. border-left: 1px solid @border-color-base;
  239. content : ' ';
  240. }
  241. }
  242. &.@{tree-prefix-cls}-icon-hide {
  243. .@{tree-prefix-cls}-treenode-loading {
  244. .@{tree-prefix-cls}-iconEle {
  245. display: none;
  246. }
  247. }
  248. }
  249. &.@{tree-prefix-cls}-block-node {
  250. li {
  251. .@{tree-prefix-cls}-node-content-wrapper {
  252. width: ~'calc(100% - 24px)';
  253. }
  254. span {
  255. &.@{tree-prefix-cls}-checkbox {
  256. +.@{tree-prefix-cls}-node-content-wrapper {
  257. width: ~'calc(100% - 46px)';
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }