智慧水务管理系统 - 精河县供水工程综合管理平台

menu.scss 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @use 'common/transition';
  5. @mixin menu-item {
  6. display: flex;
  7. align-items: center;
  8. height: getCssVar('menu-item-height');
  9. line-height: getCssVar('menu-item-height');
  10. font-size: getCssVar('menu-item-font-size');
  11. color: getCssVar('menu-text-color');
  12. padding: 0 getCssVar('menu-base-level-padding');
  13. list-style: none;
  14. cursor: pointer;
  15. position: relative;
  16. transition:
  17. border-color getCssVar('transition-duration'),
  18. background-color getCssVar('transition-duration'),
  19. color getCssVar('transition-duration');
  20. box-sizing: border-box;
  21. white-space: nowrap;
  22. * {
  23. vertical-align: bottom;
  24. }
  25. i {
  26. color: inherit;
  27. }
  28. &:hover,
  29. &:focus {
  30. outline: none;
  31. }
  32. &:hover {
  33. background-color: getCssVar('menu-hover-bg-color');
  34. }
  35. @include when(disabled) {
  36. opacity: 0.25;
  37. cursor: not-allowed;
  38. background: none !important;
  39. }
  40. }
  41. :root {
  42. // They are defined on :root so they can be inherited by sub-menu instead of overwritten
  43. @include set-component-css-var('menu', $menu);
  44. }
  45. @include b(menu) {
  46. border-right: solid 1px getCssVar('menu-border-color');
  47. list-style: none;
  48. position: relative;
  49. margin: 0;
  50. padding-left: 0;
  51. background-color: getCssVar('menu-bg-color');
  52. box-sizing: border-box;
  53. @include m(vertical) {
  54. &:not(.#{$namespace}-menu--collapse):not(
  55. .#{$namespace}-menu--popup-container
  56. ) {
  57. & .#{$namespace}-menu-item,
  58. & .#{$namespace}-sub-menu__title,
  59. & .#{$namespace}-menu-item-group__title {
  60. white-space: nowrap;
  61. padding-left: calc(
  62. #{getCssVar('menu-base-level-padding')} + #{getCssVar('menu-level')} *
  63. #{getCssVar('menu-level-padding')}
  64. );
  65. }
  66. }
  67. }
  68. &:not(.#{$namespace}-menu--collapse) .#{$namespace}-sub-menu__title {
  69. padding-right: calc(
  70. #{getCssVar('menu-base-level-padding')} + #{getCssVar('menu-icon-width')}
  71. );
  72. }
  73. @include m(horizontal) {
  74. display: flex;
  75. flex-wrap: nowrap;
  76. border-right: none;
  77. height: getCssVar('menu-horizontal-height');
  78. // reset menu-item popup height
  79. &.#{$namespace}-menu--popup-container {
  80. height: unset;
  81. }
  82. &.#{$namespace}-menu {
  83. border-bottom: solid 1px getCssVar('menu-border-color');
  84. }
  85. & > .#{$namespace}-menu-item {
  86. display: inline-flex;
  87. justify-content: center;
  88. align-items: center;
  89. height: 100%;
  90. margin: 0;
  91. border-bottom: 2px solid transparent;
  92. color: getCssVar('menu-text-color');
  93. a,
  94. a:hover {
  95. color: inherit;
  96. }
  97. }
  98. & > .#{$namespace}-sub-menu {
  99. &:focus,
  100. &:hover {
  101. outline: none;
  102. }
  103. &:hover {
  104. .#{$namespace}-sub-menu__title {
  105. color: getCssVar('menu-hover-text-color');
  106. }
  107. }
  108. &.is-active {
  109. .#{$namespace}-sub-menu__title {
  110. border-bottom: 2px solid getCssVar('menu-active-color');
  111. color: getCssVar('menu-active-color');
  112. }
  113. }
  114. & .#{$namespace}-sub-menu__title {
  115. height: 100%;
  116. border-bottom: 2px solid transparent;
  117. color: getCssVar('menu-text-color');
  118. &:hover {
  119. background-color: getCssVar('menu-bg-color');
  120. }
  121. }
  122. }
  123. & .#{$namespace}-menu {
  124. & .#{$namespace}-menu-item,
  125. & .#{$namespace}-sub-menu__title {
  126. background-color: getCssVar('menu-bg-color');
  127. display: flex;
  128. align-items: center;
  129. height: getCssVar('menu-horizontal-sub-item-height');
  130. line-height: getCssVar('menu-horizontal-sub-item-height');
  131. padding: 0 10px;
  132. color: getCssVar('menu-text-color');
  133. }
  134. & .#{$namespace}-sub-menu__title {
  135. padding-right: 40px;
  136. }
  137. & .#{$namespace}-menu-item.is-active,
  138. & .#{$namespace}-menu-item.is-active:hover,
  139. & .#{$namespace}-sub-menu.is-active > .#{$namespace}-sub-menu__title,
  140. &
  141. .#{$namespace}-sub-menu.is-active
  142. > .#{$namespace}-sub-menu__title:hover {
  143. color: getCssVar('menu-active-color');
  144. }
  145. }
  146. & .#{$namespace}-menu-item:not(.is-disabled):hover,
  147. & .#{$namespace}-menu-item:not(.is-disabled):focus {
  148. outline: none;
  149. color: getCssVarWithDefault(
  150. 'menu-active-color',
  151. getCssVar('menu-hover-text-color')
  152. );
  153. background-color: getCssVar('menu-hover-bg-color');
  154. }
  155. & > .#{$namespace}-menu-item.is-active {
  156. border-bottom: 2px solid getCssVar('menu-active-color');
  157. color: getCssVar('menu-active-color') !important;
  158. }
  159. }
  160. @include m(collapse) {
  161. width: calc(
  162. #{getCssVar('menu-icon-width')} +
  163. #{getCssVar('menu-base-level-padding')} * 2
  164. );
  165. > .#{$namespace}-menu-item,
  166. > .#{$namespace}-sub-menu > .#{$namespace}-sub-menu__title,
  167. > .#{$namespace}-menu-item-group
  168. > ul
  169. > .#{$namespace}-sub-menu
  170. > .#{$namespace}-sub-menu__title {
  171. [class^='#{$namespace}-icon'] {
  172. margin: 0;
  173. vertical-align: middle;
  174. width: getCssVar('menu-icon-width');
  175. text-align: center;
  176. }
  177. .#{$namespace}-sub-menu__icon-arrow {
  178. display: none;
  179. }
  180. > span {
  181. height: 0;
  182. width: 0;
  183. overflow: hidden;
  184. visibility: hidden;
  185. display: inline-block;
  186. }
  187. }
  188. > .#{$namespace}-menu-item.is-active i {
  189. color: inherit;
  190. }
  191. .#{$namespace}-menu .#{$namespace}-sub-menu {
  192. min-width: 200px;
  193. }
  194. .#{$namespace}-sub-menu {
  195. &.is-active .#{$namespace}-sub-menu__title {
  196. color: getCssVar('menu-active-color');
  197. }
  198. }
  199. }
  200. @include m(popup) {
  201. z-index: 100;
  202. min-width: 200px;
  203. border: none;
  204. padding: 5px 0;
  205. border-radius: getCssVar('border-radius-small');
  206. box-shadow: getCssVar('box-shadow-light');
  207. }
  208. .#{$namespace}-icon {
  209. flex-shrink: 0;
  210. }
  211. }
  212. @include b(menu-item) {
  213. @include menu-item;
  214. & [class^='#{$namespace}-icon'] {
  215. margin-right: 5px;
  216. width: getCssVar('menu-icon-width');
  217. text-align: center;
  218. font-size: 18px;
  219. vertical-align: middle;
  220. }
  221. @include when(active) {
  222. color: getCssVar('menu-active-color');
  223. i {
  224. color: inherit;
  225. }
  226. }
  227. .#{$namespace}-menu-tooltip__trigger {
  228. position: absolute;
  229. left: 0;
  230. top: 0;
  231. height: 100%;
  232. width: 100%;
  233. display: inline-flex;
  234. align-items: center;
  235. box-sizing: border-box;
  236. padding: 0 getCssVar('menu-base-level-padding');
  237. }
  238. }
  239. @include b(sub-menu) {
  240. list-style: none;
  241. margin: 0;
  242. padding-left: 0;
  243. @include e(title) {
  244. @include menu-item;
  245. &:hover {
  246. background-color: getCssVar('menu-hover-bg-color');
  247. }
  248. }
  249. & .#{$namespace}-menu {
  250. border: none;
  251. }
  252. & .#{$namespace}-menu-item {
  253. height: getCssVar('menu-sub-item-height');
  254. line-height: getCssVar('menu-sub-item-height');
  255. }
  256. &.#{$namespace}-sub-menu__hide-arrow .#{$namespace}-sub-menu__title {
  257. padding-right: getCssVar('menu-base-level-padding');
  258. }
  259. @include e(hide-arrow) {
  260. .#{$namespace}-sub-menu__icon-arrow {
  261. display: none !important;
  262. }
  263. }
  264. @include when(active) {
  265. .#{$namespace}-sub-menu__title {
  266. border-bottom-color: getCssVar('menu-active-color');
  267. }
  268. }
  269. @include when(disabled) {
  270. .#{$namespace}-sub-menu__title,
  271. .#{$namespace}-menu-item {
  272. opacity: 0.25;
  273. cursor: not-allowed;
  274. background: none !important;
  275. }
  276. }
  277. .#{$namespace}-icon {
  278. vertical-align: middle;
  279. margin-right: 5px;
  280. width: getCssVar('menu-icon-width');
  281. text-align: center;
  282. font-size: 18px;
  283. &.#{$namespace}-sub-menu__icon-more {
  284. margin-right: 0 !important;
  285. }
  286. }
  287. .#{$namespace}-sub-menu__icon-arrow {
  288. position: absolute;
  289. top: 50%;
  290. right: getCssVar('menu-base-level-padding');
  291. margin-top: -6px;
  292. transition: transform getCssVar('transition-duration');
  293. font-size: 12px;
  294. margin-right: 0;
  295. width: inherit;
  296. }
  297. }
  298. @include b(menu-item-group) {
  299. > ul {
  300. padding: 0;
  301. }
  302. @include e(title) {
  303. padding: 7px 0 7px getCssVar('menu-base-level-padding');
  304. line-height: normal;
  305. font-size: 12px;
  306. color: getCssVar('text-color', 'secondary');
  307. }
  308. }
  309. .horizontal-collapse-transition
  310. .#{$namespace}-sub-menu__title
  311. .#{$namespace}-sub-menu__icon-arrow {
  312. transition: getCssVar('transition-duration-fast');
  313. opacity: 0;
  314. }
  315. .#{$namespace}-popper,
  316. .#{$namespace}-menu--popup-container,
  317. .#{$namespace}-menu {
  318. outline: none;
  319. }