dialog.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. @use 'common/popup' as *;
  7. @include b(dialog) {
  8. @include set-component-css-var('dialog', $dialog);
  9. position: relative;
  10. margin: var(#{getCssVarName('dialog-margin-top')}, 15vh) auto 50px;
  11. background: getCssVar('dialog', 'bg-color');
  12. border-radius: getCssVar('dialog', 'border-radius');
  13. box-shadow: getCssVar('dialog', 'box-shadow');
  14. box-sizing: border-box;
  15. padding: getCssVar('dialog', 'padding-primary');
  16. width: var(#{getCssVarName('dialog-width')}, 50%);
  17. overflow-wrap: break-word;
  18. &:focus {
  19. outline: none !important;
  20. }
  21. @include when(align-center) {
  22. margin: auto;
  23. }
  24. @include when(fullscreen) {
  25. @include set-css-var-value('dialog-width', 100%);
  26. @include set-css-var-value('dialog-margin-top', 0);
  27. margin-bottom: 0;
  28. height: 100%;
  29. overflow: auto;
  30. }
  31. @include e(wrapper) {
  32. position: fixed;
  33. top: 0;
  34. right: 0;
  35. bottom: 0;
  36. left: 0;
  37. overflow: auto;
  38. margin: 0;
  39. }
  40. @include when(draggable) {
  41. @include e(header) {
  42. cursor: move;
  43. user-select: none;
  44. }
  45. }
  46. @include e(header) {
  47. padding-bottom: getCssVar('dialog', 'padding-primary');
  48. &.show-close {
  49. padding-right: calc(
  50. getCssVar('dialog', 'padding-primary') +
  51. var(
  52. #{getCssVarName('message-close-size')},
  53. map.get($message, 'close-size')
  54. )
  55. );
  56. }
  57. }
  58. @include e(headerbtn) {
  59. position: absolute;
  60. top: 0;
  61. right: 0;
  62. padding: 0;
  63. width: 48px;
  64. height: 48px;
  65. background: transparent;
  66. border: none;
  67. outline: none;
  68. cursor: pointer;
  69. font-size: var(
  70. #{getCssVarName('message-close-size')},
  71. map.get($message, 'close-size')
  72. );
  73. .#{$namespace}-dialog__close {
  74. color: getCssVar('color', 'info');
  75. font-size: inherit;
  76. }
  77. &:focus,
  78. &:hover {
  79. .#{$namespace}-dialog__close {
  80. color: getCssVar('color', 'primary');
  81. }
  82. }
  83. }
  84. @include e(title) {
  85. line-height: getCssVar('dialog-font-line-height');
  86. font-size: getCssVar('dialog-title-font-size');
  87. color: getCssVar('text-color', 'primary');
  88. }
  89. @include e(body) {
  90. color: getCssVar('text-color', 'regular');
  91. font-size: getCssVar('dialog-content-font-size');
  92. }
  93. @include e(footer) {
  94. padding-top: getCssVar('dialog', 'padding-primary');
  95. text-align: right;
  96. box-sizing: border-box;
  97. }
  98. // 内容居中布局
  99. @include m(center) {
  100. text-align: center;
  101. @include e(body) {
  102. text-align: initial;
  103. }
  104. @include e(footer) {
  105. text-align: inherit;
  106. }
  107. }
  108. }
  109. .#{$namespace}-overlay-dialog {
  110. position: fixed;
  111. top: 0;
  112. right: 0;
  113. bottom: 0;
  114. left: 0;
  115. overflow: auto;
  116. }
  117. .dialog-fade-enter-active {
  118. animation: modal-fade-in getCssVar('transition-duration');
  119. .#{$namespace}-overlay-dialog {
  120. animation: dialog-fade-in getCssVar('transition-duration');
  121. }
  122. }
  123. .dialog-fade-leave-active {
  124. animation: modal-fade-out getCssVar('transition-duration');
  125. .#{$namespace}-overlay-dialog {
  126. animation: dialog-fade-out getCssVar('transition-duration');
  127. }
  128. }
  129. @keyframes dialog-fade-in {
  130. 0% {
  131. transform: translate3d(0, -20px, 0);
  132. opacity: 0;
  133. }
  134. 100% {
  135. transform: translate3d(0, 0, 0);
  136. opacity: 1;
  137. }
  138. }
  139. @keyframes dialog-fade-out {
  140. 0% {
  141. transform: translate3d(0, 0, 0);
  142. opacity: 1;
  143. }
  144. 100% {
  145. transform: translate3d(0, -20px, 0);
  146. opacity: 0;
  147. }
  148. }
  149. @keyframes modal-fade-in {
  150. 0% {
  151. opacity: 0;
  152. }
  153. 100% {
  154. opacity: 1;
  155. }
  156. }
  157. @keyframes modal-fade-out {
  158. 0% {
  159. opacity: 1;
  160. }
  161. 100% {
  162. opacity: 0;
  163. }
  164. }