index.less 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. @import './var.less';
  2. :root {
  3. --van-calendar-background-color: @calendar-background-color;
  4. --van-calendar-popup-height: @calendar-popup-height;
  5. --van-calendar-header-box-shadow: @calendar-header-box-shadow;
  6. --van-calendar-header-title-height: @calendar-header-title-height;
  7. --van-calendar-header-title-font-size: @calendar-header-title-font-size;
  8. --van-calendar-header-subtitle-font-size: @calendar-header-subtitle-font-size;
  9. --van-calendar-weekdays-height: @calendar-weekdays-height;
  10. --van-calendar-weekdays-font-size: @calendar-weekdays-font-size;
  11. --van-calendar-month-title-font-size: @calendar-month-title-font-size;
  12. --van-calendar-month-mark-color: @calendar-month-mark-color;
  13. --van-calendar-month-mark-font-size: @calendar-month-mark-font-size;
  14. --van-calendar-day-height: @calendar-day-height;
  15. --van-calendar-day-font-size: @calendar-day-font-size;
  16. --van-calendar-day-margin-bottom: @calendar-day-margin-bottom;
  17. --van-calendar-range-edge-color: @calendar-range-edge-color;
  18. --van-calendar-range-edge-background-color: @calendar-range-edge-background-color;
  19. --van-calendar-range-middle-color: @calendar-range-middle-color;
  20. --van-calendar-range-middle-background-opacity: @calendar-range-middle-background-opacity;
  21. --van-calendar-selected-day-size: @calendar-selected-day-size;
  22. --van-calendar-selected-day-color: @calendar-selected-day-color;
  23. --van-calendar-info-font-size: @calendar-info-font-size;
  24. --van-calendar-info-line-height: @calendar-info-line-height;
  25. --van-calendar-selected-day-background-color: @calendar-selected-day-background-color;
  26. --van-calendar-day-disabled-color: @calendar-day-disabled-color;
  27. --van-calendar-confirm-button-height: @calendar-confirm-button-height;
  28. --van-calendar-confirm-button-margin: @calendar-confirm-button-margin;
  29. }
  30. .van-calendar {
  31. display: flex;
  32. flex-direction: column;
  33. height: 100%;
  34. background: var(--van-calendar-background-color);
  35. &__popup {
  36. &.van-popup--top,
  37. &.van-popup--bottom {
  38. height: var(--van-calendar-popup-height);
  39. }
  40. &.van-popup--left,
  41. &.van-popup--right {
  42. height: 100%;
  43. }
  44. .van-popup__close-icon {
  45. top: 11px;
  46. }
  47. }
  48. &__header {
  49. flex-shrink: 0;
  50. box-shadow: var(--van-calendar-header-box-shadow);
  51. }
  52. &__month-title,
  53. &__header-title,
  54. &__header-subtitle {
  55. height: var(--van-calendar-header-title-height);
  56. font-weight: var(--van-font-weight-bold);
  57. line-height: var(--van-calendar-header-title-height);
  58. text-align: center;
  59. }
  60. &__header-title {
  61. font-size: var(--van-calendar-header-title-font-size);
  62. }
  63. &__header-subtitle {
  64. font-size: var(--van-calendar-header-subtitle-font-size);
  65. }
  66. &__month-title {
  67. font-size: var(--van-calendar-month-title-font-size);
  68. }
  69. &__weekdays {
  70. display: flex;
  71. }
  72. &__weekday {
  73. flex: 1;
  74. font-size: var(--van-calendar-weekdays-font-size);
  75. line-height: var(--van-calendar-weekdays-height);
  76. text-align: center;
  77. }
  78. &__body {
  79. flex: 1;
  80. overflow: auto;
  81. -webkit-overflow-scrolling: touch;
  82. }
  83. &__days {
  84. position: relative;
  85. display: flex;
  86. flex-wrap: wrap;
  87. user-select: none;
  88. }
  89. &__month-mark {
  90. position: absolute;
  91. top: 50%;
  92. left: 50%;
  93. z-index: 0;
  94. color: var(--van-calendar-month-mark-color);
  95. font-size: var(--van-calendar-month-mark-font-size);
  96. transform: translate(-50%, -50%);
  97. pointer-events: none;
  98. }
  99. &__day,
  100. &__selected-day {
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. text-align: center;
  105. }
  106. &__day {
  107. position: relative;
  108. width: 14.285%;
  109. height: var(--van-calendar-day-height);
  110. font-size: var(--van-calendar-day-font-size);
  111. margin-bottom: var(--van-calendar-day-margin-bottom);
  112. cursor: pointer;
  113. &--end,
  114. &--start,
  115. &--start-end,
  116. &--multiple-middle,
  117. &--multiple-selected {
  118. color: var(--van-calendar-range-edge-color);
  119. background: var(--van-calendar-range-edge-background-color);
  120. }
  121. &--start {
  122. border-radius: var(--van-border-radius-md) 0 0 var(--van-border-radius-md);
  123. }
  124. &--end {
  125. border-radius: 0 var(--van-border-radius-md) var(--van-border-radius-md) 0;
  126. }
  127. &--start-end,
  128. &--multiple-selected {
  129. border-radius: var(--van-border-radius-md);
  130. }
  131. &--middle {
  132. color: var(--van-calendar-range-middle-color);
  133. &::after {
  134. position: absolute;
  135. top: 0;
  136. right: 0;
  137. bottom: 0;
  138. left: 0;
  139. background-color: currentColor;
  140. opacity: var(--van-calendar-range-middle-background-opacity);
  141. content: '';
  142. }
  143. }
  144. &--disabled {
  145. color: var(--van-calendar-day-disabled-color);
  146. cursor: default;
  147. }
  148. }
  149. &__top-info,
  150. &__bottom-info {
  151. position: absolute;
  152. right: 0;
  153. left: 0;
  154. font-size: var(--van-calendar-info-font-size);
  155. line-height: var(--van-calendar-info-line-height);
  156. @media (max-width: 350px) {
  157. font-size: 9px;
  158. }
  159. }
  160. &__top-info {
  161. top: 6px;
  162. }
  163. &__bottom-info {
  164. bottom: 6px;
  165. }
  166. &__selected-day {
  167. width: var(--van-calendar-selected-day-size);
  168. height: var(--van-calendar-selected-day-size);
  169. color: var(--van-calendar-selected-day-color);
  170. background: var(--van-calendar-selected-day-background-color);
  171. border-radius: var(--van-border-radius-md);
  172. }
  173. &__footer {
  174. flex-shrink: 0;
  175. padding-left: var(--van-padding-md);
  176. padding-right: var(--van-padding-md);
  177. }
  178. &__confirm {
  179. height: var(--van-calendar-confirm-button-height);
  180. margin: var(--van-calendar-confirm-button-margin);
  181. }
  182. }