tree.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @use 'common/transition';
  5. @include b(tree) {
  6. @include set-component-css-var('tree', $tree);
  7. }
  8. @include b(tree) {
  9. position: relative;
  10. cursor: default;
  11. background: getCssVar('fill-color', 'blank');
  12. color: getCssVar('tree-text-color');
  13. font-size: getCssVar('font-size', 'base');
  14. @include e(empty-block) {
  15. position: relative;
  16. min-height: 60px;
  17. text-align: center;
  18. width: 100%;
  19. height: 100%;
  20. }
  21. @include e(empty-text) {
  22. position: absolute;
  23. left: 50%;
  24. top: 50%;
  25. transform: translate(-50%, -50%);
  26. color: getCssVar('text-color', 'secondary');
  27. font-size: getCssVar('font-size', 'base');
  28. }
  29. @include e(drop-indicator) {
  30. position: absolute;
  31. left: 0;
  32. right: 0;
  33. height: 1px;
  34. background-color: getCssVar('color-primary');
  35. }
  36. }
  37. @include b(tree-node) {
  38. white-space: nowrap;
  39. outline: none;
  40. &:focus {
  41. /* focus */
  42. > .#{$namespace}-tree-node__content {
  43. background-color: getCssVar('tree-node-hover-bg-color');
  44. }
  45. }
  46. @include when(drop-inner) {
  47. > .#{$namespace}-tree-node__content .#{$namespace}-tree-node__label {
  48. background-color: getCssVar('color-primary');
  49. color: #fff;
  50. }
  51. }
  52. @include e(content) {
  53. @include css-var-from-global('checkbox-height', 'tree-node-content-height');
  54. display: flex;
  55. align-items: center;
  56. height: getCssVar('tree-node-content-height');
  57. cursor: pointer;
  58. & > .#{$namespace}-tree-node__expand-icon {
  59. padding: 6px;
  60. box-sizing: content-box;
  61. }
  62. & > label.#{$namespace}-checkbox {
  63. margin-right: 8px;
  64. }
  65. &:hover {
  66. background-color: getCssVar('tree-node-hover-bg-color');
  67. }
  68. .#{$namespace}-tree.is-dragging & {
  69. cursor: move;
  70. & * {
  71. pointer-events: none;
  72. }
  73. }
  74. .#{$namespace}-tree.is-dragging.is-drop-not-allow & {
  75. cursor: not-allowed;
  76. }
  77. }
  78. @include e(expand-icon) {
  79. cursor: pointer;
  80. color: getCssVar('tree-expand-icon-color');
  81. font-size: 12px;
  82. transform: rotate(0deg);
  83. transition: transform getCssVar('transition-duration') ease-in-out;
  84. &.expanded {
  85. transform: rotate(90deg);
  86. }
  87. &.is-leaf {
  88. color: transparent;
  89. cursor: default;
  90. visibility: hidden;
  91. }
  92. &.is-hidden {
  93. visibility: hidden;
  94. }
  95. }
  96. @include e(loading-icon) {
  97. margin-right: 8px;
  98. font-size: getCssVar('font-size', 'base');
  99. color: getCssVar('tree-expand-icon-color');
  100. }
  101. & > .#{$namespace}-tree-node__children {
  102. overflow: hidden;
  103. background-color: transparent;
  104. }
  105. &.is-expanded > .#{$namespace}-tree-node__children {
  106. display: block;
  107. }
  108. }
  109. .#{$namespace}-tree--highlight-current
  110. .#{$namespace}-tree-node.is-current
  111. > .#{$namespace}-tree-node__content {
  112. background-color: getCssVar('color-primary-light-9');
  113. }