cascader.scss 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/var' as *;
  4. @use 'common/var' as *;
  5. @mixin cascader-tag-normal($background-color) {
  6. .#{$namespace}-tag {
  7. display: inline-flex;
  8. align-items: center;
  9. max-width: 100%;
  10. margin: 2px 0 2px 6px;
  11. text-overflow: ellipsis;
  12. background: $background-color;
  13. &:not(.is-hit) {
  14. border-color: transparent;
  15. }
  16. > span {
  17. flex: 1;
  18. overflow: hidden;
  19. text-overflow: ellipsis;
  20. }
  21. .#{$namespace}-icon-close {
  22. flex: none;
  23. background-color: getCssVar('text-color', 'placeholder');
  24. color: getCssVar('color-white');
  25. &:hover {
  26. background-color: getCssVar('text-color', 'secondary');
  27. }
  28. }
  29. }
  30. }
  31. @include b(cascader) {
  32. @include set-component-css-var('cascader', $cascader);
  33. display: inline-block;
  34. vertical-align: middle;
  35. position: relative;
  36. font-size: getCssVar('font-size', 'base');
  37. line-height: map.get($input-height, 'default');
  38. outline: none;
  39. &:not(.is-disabled):hover {
  40. .#{$namespace}-input__wrapper {
  41. cursor: pointer;
  42. box-shadow: 0 0 0 1px getCssVar('input', 'hover-border-color') inset;
  43. }
  44. }
  45. .#{$namespace}-input {
  46. display: flex;
  47. cursor: pointer;
  48. .#{$namespace}-input__inner {
  49. text-overflow: ellipsis;
  50. cursor: pointer;
  51. }
  52. .#{$namespace}-input__suffix-inner {
  53. .#{$namespace}-icon {
  54. height: calc(100% - 2px);
  55. svg {
  56. vertical-align: middle;
  57. }
  58. }
  59. }
  60. .icon-arrow-down {
  61. transition: transform getCssVar('transition-duration');
  62. font-size: 14px;
  63. @include when(reverse) {
  64. transform: rotateZ(180deg);
  65. }
  66. }
  67. .icon-circle-close:hover {
  68. color: var(
  69. #{getCssVarName('input', 'clear-hover-color')},
  70. map.get($input, 'clear-hover-color')
  71. );
  72. }
  73. @include when(focus) {
  74. .#{$namespace}-input__wrapper {
  75. box-shadow: 0 0 0 1px
  76. var(
  77. #{getCssVarName('input', 'focus-border-color')},
  78. map.get($input, 'focus-border-color')
  79. )
  80. inset;
  81. }
  82. }
  83. }
  84. @each $size in (large, small) {
  85. @include m($size) {
  86. font-size: map.get($input-font-size, $size);
  87. line-height: map.get($input-height, $size);
  88. }
  89. }
  90. @include when(disabled) {
  91. .#{$namespace}-cascader__label {
  92. z-index: calc(getCssVar('index', 'normal') + 1);
  93. color: getCssVar('disabled-text-color');
  94. }
  95. }
  96. @include e(dropdown) {
  97. @include set-component-css-var('cascader', $cascader);
  98. }
  99. @include e(dropdown) {
  100. font-size: getCssVar('cascader-menu-font-size');
  101. border-radius: getCssVar('cascader-menu-radius');
  102. @include picker-popper(
  103. getCssVar('cascader-menu-fill'),
  104. getCssVar('cascader-menu-border'),
  105. getCssVar('cascader-menu-shadow')
  106. );
  107. &.#{$namespace}-popper {
  108. box-shadow: getCssVar('cascader-menu-shadow');
  109. }
  110. }
  111. @include e(tags) {
  112. position: absolute;
  113. left: 0;
  114. right: 30px;
  115. top: 50%;
  116. transform: translateY(-50%);
  117. display: flex;
  118. flex-wrap: wrap;
  119. line-height: normal;
  120. text-align: left;
  121. box-sizing: border-box;
  122. @include cascader-tag-normal(getCssVar('cascader-tag-background'));
  123. &.is-validate {
  124. right: 55px;
  125. }
  126. }
  127. @include e(collapse-tags) {
  128. white-space: normal;
  129. z-index: getCssVar('index-normal');
  130. @include cascader-tag-normal(getCssVar('fill-color'));
  131. }
  132. @include e(suggestion-panel) {
  133. border-radius: getCssVar('cascader-menu', 'radius');
  134. }
  135. @include e(suggestion-list) {
  136. max-height: 204px;
  137. margin: 0;
  138. padding: 6px 0;
  139. font-size: getCssVar('font-size', 'base');
  140. color: getCssVar('cascader-menu', 'text-color');
  141. text-align: center;
  142. }
  143. @include e(suggestion-item) {
  144. display: flex;
  145. justify-content: space-between;
  146. align-items: center;
  147. height: 34px;
  148. padding: 0 15px;
  149. text-align: left;
  150. outline: none;
  151. cursor: pointer;
  152. &:hover,
  153. &:focus {
  154. background: getCssVar('cascader-node', 'background-hover');
  155. }
  156. &.is-checked {
  157. color: getCssVar('cascader', 'menu-selected-text-color');
  158. font-weight: bold;
  159. }
  160. > span {
  161. margin-right: 10px;
  162. }
  163. }
  164. @include e(empty-text) {
  165. margin: 10px 0;
  166. color: getCssVar('cascader', 'color-empty');
  167. }
  168. @include e(search-input) {
  169. flex: 1;
  170. height: 24px;
  171. min-width: 60px;
  172. margin: 2px 0 2px map.get($input-padding-horizontal, 'default')-$border-width;
  173. padding: 0;
  174. color: getCssVar('cascader', 'menu-text-color');
  175. border: none;
  176. outline: none;
  177. box-sizing: border-box;
  178. background: transparent;
  179. &::placeholder {
  180. // two input overlap
  181. color: transparent;
  182. }
  183. }
  184. }