pagination.scss 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/utils' as *;
  4. @use 'mixins/var' as *;
  5. @use 'common/var' as *;
  6. @mixin pagination-button {
  7. display: flex;
  8. justify-content: center;
  9. align-items: center;
  10. font-size: getCssVar('pagination-font-size');
  11. min-width: getCssVar('pagination-button-width');
  12. height: getCssVar('pagination-button-height');
  13. line-height: getCssVar('pagination-button-height');
  14. color: getCssVar('pagination-button-color');
  15. background: getCssVar('pagination-bg-color');
  16. padding: 0 4px;
  17. border: none;
  18. border-radius: getCssVar('pagination-border-radius');
  19. cursor: pointer;
  20. text-align: center;
  21. box-sizing: border-box;
  22. * {
  23. pointer-events: none;
  24. }
  25. &:focus {
  26. outline: none;
  27. }
  28. &:hover {
  29. color: getCssVar('pagination-hover-color');
  30. }
  31. &.is-active {
  32. color: getCssVar('pagination-hover-color');
  33. cursor: default;
  34. font-weight: bold;
  35. &.is-disabled {
  36. font-weight: bold;
  37. color: getCssVar('text-color', 'secondary');
  38. }
  39. }
  40. &:disabled,
  41. &.is-disabled {
  42. color: getCssVar('pagination-button-disabled-color');
  43. background-color: getCssVar('pagination-button-disabled-bg-color');
  44. cursor: not-allowed;
  45. }
  46. &:focus-visible {
  47. outline: 1px solid getCssVar('pagination-hover-color');
  48. outline-offset: -1px;
  49. }
  50. }
  51. @include b(pagination) {
  52. @include set-component-css-var('pagination', $pagination);
  53. white-space: nowrap;
  54. color: getCssVar('pagination-text-color');
  55. font-size: getCssVar('pagination-font-size');
  56. font-weight: normal;
  57. display: flex;
  58. align-items: center;
  59. .#{$namespace}-input__inner {
  60. text-align: center;
  61. -moz-appearance: textfield;
  62. }
  63. .#{$namespace}-select .#{$namespace}-input {
  64. width: 128px;
  65. }
  66. button {
  67. @include pagination-button;
  68. }
  69. .btn-prev,
  70. .btn-next {
  71. .#{$namespace}-icon {
  72. display: block;
  73. font-size: 12px;
  74. font-weight: bold;
  75. width: inherit;
  76. }
  77. }
  78. & > * {
  79. @include when(first) {
  80. margin-left: 0 !important;
  81. }
  82. @include when(last) {
  83. margin-right: 0 !important;
  84. }
  85. }
  86. .btn-prev {
  87. margin-left: getCssVar('pagination-item-gap');
  88. }
  89. @include e(sizes) {
  90. margin-left: getCssVar('pagination-item-gap');
  91. font-weight: normal;
  92. color: getCssVar('text-color', 'regular');
  93. }
  94. @include e(total) {
  95. margin-left: getCssVar('pagination-item-gap');
  96. font-weight: normal;
  97. color: getCssVar('text-color', 'regular');
  98. &[disabled='true'] {
  99. color: getCssVar('text-color', 'placeholder');
  100. }
  101. }
  102. @include e(jump) {
  103. display: flex;
  104. align-items: center;
  105. margin-left: getCssVar('pagination-item-gap');
  106. font-weight: normal;
  107. color: getCssVar('text-color', 'regular');
  108. &[disabled='true'] {
  109. color: getCssVar('text-color', 'placeholder');
  110. }
  111. @include e(goto) {
  112. margin-right: 8px;
  113. }
  114. @include e(editor) {
  115. text-align: center;
  116. box-sizing: border-box;
  117. &.#{$namespace}-input {
  118. width: 56px;
  119. }
  120. .#{$namespace}-input__inner::-webkit-inner-spin-button,
  121. .#{$namespace}-input__inner::-webkit-outer-spin-button {
  122. -webkit-appearance: none;
  123. margin: 0;
  124. }
  125. }
  126. @include e(classifier) {
  127. margin-left: 8px;
  128. }
  129. }
  130. @include e(rightwrapper) {
  131. flex: 1;
  132. display: flex;
  133. align-items: center;
  134. justify-content: flex-end;
  135. }
  136. @include when(background) {
  137. .btn-prev,
  138. .btn-next,
  139. .#{$namespace}-pager li {
  140. margin: 0 4px;
  141. background-color: getCssVar('pagination-button-bg-color');
  142. &.is-active {
  143. background-color: getCssVar('color-primary');
  144. color: getCssVar('color-white');
  145. }
  146. &:disabled,
  147. &.is-disabled {
  148. color: getCssVar('text-color', 'placeholder');
  149. background-color: getCssVar('disabled-bg-color');
  150. &.is-active {
  151. color: getCssVar('text-color', 'secondary');
  152. background-color: getCssVar('fill-color', 'dark');
  153. }
  154. }
  155. }
  156. .btn-prev {
  157. margin-left: getCssVar('pagination-item-gap');
  158. }
  159. }
  160. @include m(small) {
  161. .btn-prev,
  162. .btn-next,
  163. .#{$namespace}-pager li {
  164. height: getCssVar('pagination-button-height-small');
  165. line-height: getCssVar('pagination-button-height-small');
  166. font-size: getCssVar('pagination-font-size-small');
  167. min-width: getCssVar('pagination-button-width-small');
  168. }
  169. span:not([class*='suffix']),
  170. button {
  171. font-size: getCssVar('pagination-font-size-small');
  172. }
  173. .#{$namespace}-select .#{$namespace}-input {
  174. width: 100px;
  175. }
  176. }
  177. }
  178. @include b(pager) {
  179. user-select: none;
  180. list-style: none;
  181. font-size: 0;
  182. padding: 0;
  183. margin: 0;
  184. display: flex;
  185. align-items: center;
  186. li {
  187. @include pagination-button;
  188. }
  189. }