e58902e4b9267fb52a3ebba616ec75974afe0e2d111b570488457ae66504641a0b80d579e711f14c01fce4b0c1ee56b9a05246a64d1f354093bb693a603dce 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. @import "mixins/mixins";
  2. @import "common/var";
  3. @include b(tabs) {
  4. @include e(header) {
  5. padding: 0;
  6. position: relative;
  7. margin: 0 0 15px;
  8. }
  9. @include e(active-bar) {
  10. position: absolute;
  11. bottom: 0;
  12. left: 0;
  13. height: 2px;
  14. background-color: $--color-primary;
  15. z-index: 1;
  16. transition: transform .3s cubic-bezier(.645,.045,.355,1);
  17. list-style: none;
  18. }
  19. @include e(new-tab) {
  20. float: right;
  21. border: 1px solid #d3dce6;
  22. height: 18px;
  23. width: 18px;
  24. line-height: 18px;
  25. margin: 12px 0 9px 10px;
  26. border-radius: 3px;
  27. text-align: center;
  28. font-size: 12px;
  29. color: #d3dce6;
  30. cursor: pointer;
  31. transition: all .15s;
  32. .el-icon-plus {
  33. transform: scale(0.8, 0.8);
  34. }
  35. &:hover {
  36. color: $--color-primary;
  37. }
  38. }
  39. @include e(nav-wrap) {
  40. overflow: hidden;
  41. margin-bottom: -1px;
  42. position: relative;
  43. &::after {
  44. content: "";
  45. position: absolute;
  46. left: 0;
  47. bottom: 0;
  48. width: 100%;
  49. height: 2px;
  50. background-color: $--border-color-light;
  51. z-index: $--index-normal;
  52. }
  53. @include when(scrollable) {
  54. padding: 0 20px;
  55. box-sizing: border-box;
  56. }
  57. }
  58. @include e(nav-scroll) {
  59. overflow: hidden;
  60. }
  61. @include e((nav-next, nav-prev)) {
  62. position: absolute;
  63. cursor: pointer;
  64. line-height: 44px;
  65. font-size: 12px;
  66. color: $--color-text-secondary;
  67. }
  68. @include e(nav-next) {
  69. right: 0;
  70. }
  71. @include e(nav-prev) {
  72. left: 0;
  73. }
  74. @include e(nav) {
  75. white-space: nowrap;
  76. position: relative;
  77. transition: transform .3s;
  78. float: left;
  79. z-index: #{$--index-normal + 1};
  80. @include when(stretch) {
  81. min-width: 100%;
  82. display: flex;
  83. & > * {
  84. flex: 1;
  85. text-align: center;
  86. }
  87. }
  88. }
  89. @include e(item) {
  90. padding: 0 20px;
  91. height: 40px;
  92. box-sizing: border-box;
  93. line-height: 40px;
  94. display: inline-block;
  95. list-style: none;
  96. font-size: 14px;
  97. font-weight: 500;
  98. color: $--color-text-primary;
  99. position: relative;
  100. &:focus, &:focus:active {
  101. outline: none;
  102. }
  103. &:focus.is-active.is-focus:not(:active) {
  104. box-shadow: 0 0 2px 2px $--color-primary inset;
  105. border-radius: 3px;
  106. }
  107. & .el-icon-close {
  108. border-radius: 50%;
  109. text-align: center;
  110. transition: all .3s cubic-bezier(.645,.045,.355,1);
  111. margin-left: 5px;
  112. &:before {
  113. transform: scale(.9);
  114. display: inline-block;
  115. }
  116. &:hover {
  117. background-color: $--color-text-placeholder;
  118. color: $--color-white;
  119. }
  120. }
  121. @include when(active) {
  122. color: $--color-primary;
  123. }
  124. &:hover {
  125. color: $--color-primary;
  126. cursor: pointer;
  127. }
  128. @include when(disabled) {
  129. color: $--disabled-color-base;
  130. cursor: default;
  131. }
  132. }
  133. @include e(content) {
  134. overflow: hidden;
  135. position: relative;
  136. }
  137. @include m(card) {
  138. > .el-tabs__header {
  139. border-bottom: 1px solid $--border-color-light;
  140. }
  141. > .el-tabs__header .el-tabs__nav-wrap::after {
  142. content: none;
  143. }
  144. > .el-tabs__header .el-tabs__nav {
  145. border: 1px solid $--border-color-light;
  146. border-bottom: none;
  147. border-radius: 4px 4px 0 0;
  148. box-sizing: border-box;
  149. }
  150. > .el-tabs__header .el-tabs__active-bar {
  151. display: none;
  152. }
  153. > .el-tabs__header .el-tabs__item .el-icon-close {
  154. position: relative;
  155. font-size: 12px;
  156. width: 0;
  157. height: 14px;
  158. vertical-align: middle;
  159. line-height: 15px;
  160. overflow: hidden;
  161. top: -1px;
  162. right: -2px;
  163. transform-origin: 100% 50%;
  164. }
  165. > .el-tabs__header .el-tabs__item {
  166. border-bottom: 1px solid transparent;
  167. border-left: 1px solid $--border-color-light;
  168. transition: color .3s cubic-bezier(.645,.045,.355,1), padding .3s cubic-bezier(.645,.045,.355,1);
  169. &:first-child {
  170. border-left: none;
  171. }
  172. &.is-closable {
  173. &:hover {
  174. padding-left: 13px;
  175. padding-right: 13px;
  176. & .el-icon-close {
  177. width: 14px;
  178. }
  179. }
  180. }
  181. &.is-active {
  182. border-bottom-color: $--color-white;
  183. &.is-closable {
  184. padding-left: 20px;
  185. padding-right: 20px;
  186. .el-icon-close {
  187. width: 14px;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. @include m(border-card) {
  194. background: $--color-white;
  195. border: 1px solid $--border-color-base;
  196. box-shadow: 0 2px 4px 0 rgba(0,0,0,0.12), 0 0 6px 0 rgba(0,0,0,0.04);
  197. > .el-tabs__content {
  198. padding: 15px;
  199. }
  200. > .el-tabs__header {
  201. background-color: $--background-color-base;
  202. border-bottom: 1px solid $--border-color-light;
  203. margin: 0;
  204. }
  205. > .el-tabs__header .el-tabs__nav-wrap::after {
  206. content: none;
  207. }
  208. > .el-tabs__header .el-tabs__item {
  209. transition: all .3s cubic-bezier(.645,.045,.355,1);
  210. border: 1px solid transparent;
  211. margin-top: -1px;
  212. color: $--color-text-secondary;
  213. &:first-child {
  214. margin-left: -1px;
  215. }
  216. & + .el-tabs__item {
  217. margin-left: -1px;
  218. }
  219. &.is-active {
  220. color: $--color-primary;
  221. background-color: $--color-white;
  222. border-right-color: $--border-color-base;
  223. border-left-color: $--border-color-base;
  224. }
  225. &:not(.is-disabled):hover {
  226. color: $--color-primary;
  227. }
  228. &.is-disabled {
  229. color: $--disabled-color-base;
  230. }
  231. }
  232. > .el-tabs__header .is-scrollable .el-tabs__item:first-child {
  233. margin-left: 0;
  234. }
  235. }
  236. @include m((top, bottom)) {
  237. .el-tabs__item.is-top:nth-child(2),
  238. .el-tabs__item.is-bottom:nth-child(2) {
  239. padding-left: 0;
  240. }
  241. .el-tabs__item.is-top:last-child,
  242. .el-tabs__item.is-bottom:last-child {
  243. padding-right: 0;
  244. }
  245. &.el-tabs--border-card, &.el-tabs--card,
  246. .el-tabs--left, .el-tabs--right {
  247. > .el-tabs__header {
  248. .el-tabs__item:nth-child(2) {
  249. padding-left: 20px;
  250. }
  251. .el-tabs__item:last-child {
  252. padding-right: 20px;
  253. }
  254. }
  255. }
  256. }
  257. @include m(bottom) {
  258. .el-tabs__header.is-bottom {
  259. margin-bottom: 0;
  260. margin-top: 10px;
  261. }
  262. &.el-tabs--border-card {
  263. .el-tabs__header.is-bottom {
  264. border-bottom: 0;
  265. border-top: 1px solid $--border-color-base;
  266. }
  267. .el-tabs__nav-wrap.is-bottom {
  268. margin-top: -1px;
  269. margin-bottom: 0;
  270. }
  271. .el-tabs__item.is-bottom:not(.is-active) {
  272. border: 1px solid transparent;
  273. }
  274. .el-tabs__item.is-bottom {
  275. margin: 0 -1px -1px -1px;
  276. }
  277. }
  278. }
  279. @include m((left, right)) {
  280. overflow: hidden;
  281. .el-tabs__header.is-left,
  282. .el-tabs__header.is-right,
  283. .el-tabs__nav-wrap.is-left,
  284. .el-tabs__nav-wrap.is-right,
  285. .el-tabs__nav-scroll {
  286. height: 100%;
  287. }
  288. .el-tabs__active-bar.is-left,
  289. .el-tabs__active-bar.is-right {
  290. top: 0;
  291. bottom: auto;
  292. width: 2px;
  293. height: auto;
  294. }
  295. .el-tabs__nav-wrap.is-left,
  296. .el-tabs__nav-wrap.is-right {
  297. margin-bottom: 0;
  298. > .el-tabs__nav-prev,
  299. > .el-tabs__nav-next {
  300. height: 30px;
  301. line-height: 30px;
  302. width: 100%;
  303. text-align: center;
  304. cursor: pointer;
  305. i {
  306. transform: rotateZ(90deg);
  307. }
  308. }
  309. > .el-tabs__nav-prev {
  310. left: auto;
  311. top: 0;
  312. }
  313. > .el-tabs__nav-next {
  314. right: auto;
  315. bottom: 0;
  316. }
  317. &.is-scrollable {
  318. padding: 30px 0;
  319. }
  320. &::after {
  321. height: 100%;
  322. width: 2px;
  323. bottom: auto;
  324. top: 0;
  325. }
  326. }
  327. .el-tabs__nav.is-left,
  328. .el-tabs__nav.is-right {
  329. float: none;
  330. }
  331. .el-tabs__item.is-left,
  332. .el-tabs__item.is-right {
  333. display: block;
  334. }
  335. }
  336. @include m(left) {
  337. .el-tabs__header.is-left {
  338. float: left;
  339. margin-bottom: 0;
  340. margin-right: 10px;
  341. }
  342. .el-tabs__nav-wrap.is-left {
  343. margin-right: -1px;
  344. &::after {
  345. left: auto;
  346. right: 0;
  347. }
  348. }
  349. .el-tabs__active-bar.is-left {
  350. right: 0;
  351. left: auto;
  352. }
  353. .el-tabs__item.is-left {
  354. text-align: right;
  355. }
  356. &.el-tabs--card {
  357. .el-tabs__active-bar.is-left {
  358. display: none;
  359. }
  360. .el-tabs__item.is-left {
  361. border-left: none;
  362. border-right: 1px solid $--border-color-light;
  363. border-bottom: none;
  364. border-top: 1px solid $--border-color-light;
  365. text-align: left;
  366. }
  367. .el-tabs__item.is-left:first-child {
  368. border-right: 1px solid $--border-color-light;
  369. border-top: none;
  370. }
  371. .el-tabs__item.is-left.is-active {
  372. border: 1px solid $--border-color-light;
  373. border-right-color: #fff;
  374. border-left: none;
  375. border-bottom: none;
  376. &:first-child {
  377. border-top: none;
  378. }
  379. &:last-child {
  380. border-bottom: none;
  381. }
  382. }
  383. .el-tabs__nav {
  384. border-radius: 4px 0 0 4px;
  385. border-bottom: 1px solid $--border-color-light;
  386. border-right: none;
  387. }
  388. .el-tabs__new-tab {
  389. float: none;
  390. }
  391. }
  392. &.el-tabs--border-card {
  393. .el-tabs__header.is-left {
  394. border-right: 1px solid #dfe4ed;
  395. }
  396. .el-tabs__item.is-left {
  397. border: 1px solid transparent;
  398. margin: -1px 0 -1px -1px;
  399. &.is-active {
  400. border-color: transparent;
  401. border-top-color: rgb(209, 219, 229);
  402. border-bottom-color: rgb(209, 219, 229);
  403. }
  404. }
  405. }
  406. }
  407. @include m(right) {
  408. .el-tabs__header.is-right {
  409. float: right;
  410. margin-bottom: 0;
  411. margin-left: 10px;
  412. }
  413. .el-tabs__nav-wrap.is-right {
  414. margin-left: -1px;
  415. &::after {
  416. left: 0;
  417. right: auto;
  418. }
  419. }
  420. .el-tabs__active-bar.is-right {
  421. left: 0;
  422. }
  423. &.el-tabs--card {
  424. .el-tabs__active-bar.is-right {
  425. display: none;
  426. }
  427. .el-tabs__item.is-right {
  428. border-bottom: none;
  429. border-top: 1px solid $--border-color-light;
  430. }
  431. .el-tabs__item.is-right:first-child {
  432. border-left: 1px solid $--border-color-light;
  433. border-top: none;
  434. }
  435. .el-tabs__item.is-right.is-active {
  436. border: 1px solid $--border-color-light;
  437. border-left-color: #fff;
  438. border-right: none;
  439. border-bottom: none;
  440. &:first-child {
  441. border-top: none;
  442. }
  443. &:last-child {
  444. border-bottom: none;
  445. }
  446. }
  447. .el-tabs__nav {
  448. border-radius: 0 4px 4px 0;
  449. border-bottom: 1px solid $--border-color-light;
  450. border-left: none;
  451. }
  452. }
  453. &.el-tabs--border-card {
  454. .el-tabs__header.is-right {
  455. border-left: 1px solid #dfe4ed;
  456. }
  457. .el-tabs__item.is-right {
  458. border: 1px solid transparent;
  459. margin: -1px -1px -1px 0;
  460. &.is-active {
  461. border-color: transparent;
  462. border-top-color: rgb(209, 219, 229);
  463. border-bottom-color: rgb(209, 219, 229);
  464. }
  465. }
  466. }
  467. }
  468. }
  469. .slideInRight-transition,
  470. .slideInLeft-transition {
  471. display: inline-block;
  472. }
  473. .slideInRight-enter {
  474. animation: slideInRight-enter .3s;
  475. }
  476. .slideInRight-leave {
  477. position: absolute;
  478. left: 0;
  479. right: 0;
  480. animation: slideInRight-leave .3s;
  481. }
  482. .slideInLeft-enter {
  483. animation: slideInLeft-enter .3s;
  484. }
  485. .slideInLeft-leave {
  486. position: absolute;
  487. left: 0;
  488. right: 0;
  489. animation: slideInLeft-leave .3s;
  490. }
  491. @keyframes slideInRight-enter {
  492. 0% {
  493. opacity: 0;
  494. -webkit-transform-origin: 0 0;
  495. transform-origin: 0 0;
  496. -webkit-transform: translateX(100%);
  497. transform: translateX(100%)
  498. }
  499. to {
  500. opacity: 1;
  501. -webkit-transform-origin: 0 0;
  502. transform-origin: 0 0;
  503. -webkit-transform: translateX(0);
  504. transform: translateX(0)
  505. }
  506. }
  507. @keyframes slideInRight-leave {
  508. 0% {
  509. -webkit-transform-origin: 0 0;
  510. transform-origin: 0 0;
  511. -webkit-transform: translateX(0);
  512. transform: translateX(0);
  513. opacity: 1
  514. }
  515. 100% {
  516. -webkit-transform-origin: 0 0;
  517. transform-origin: 0 0;
  518. -webkit-transform: translateX(100%);
  519. transform: translateX(100%);
  520. opacity: 0
  521. }
  522. }
  523. @keyframes slideInLeft-enter {
  524. 0% {
  525. opacity: 0;
  526. -webkit-transform-origin: 0 0;
  527. transform-origin: 0 0;
  528. -webkit-transform: translateX(-100%);
  529. transform: translateX(-100%)
  530. }
  531. to {
  532. opacity: 1;
  533. -webkit-transform-origin: 0 0;
  534. transform-origin: 0 0;
  535. -webkit-transform: translateX(0);
  536. transform: translateX(0)
  537. }
  538. }
  539. @keyframes slideInLeft-leave {
  540. 0% {
  541. -webkit-transform-origin: 0 0;
  542. transform-origin: 0 0;
  543. -webkit-transform: translateX(0);
  544. transform: translateX(0);
  545. opacity: 1
  546. }
  547. 100% {
  548. -webkit-transform-origin: 0 0;
  549. transform-origin: 0 0;
  550. -webkit-transform: translateX(-100%);
  551. transform: translateX(-100%);
  552. opacity: 0
  553. }
  554. }