dialog.scss 3.7 KB

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