Dialog.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!-- Fenêtre de dialogue -->
  2. <template>
  3. <v-dialog
  4. :model-value="_show"
  5. :persistent="true"
  6. :max-width="maxWidth"
  7. :content-class="contentClass"
  8. >
  9. <v-card class="d-flex flex-row">
  10. <div
  11. :class="
  12. 'dialog-type flex-column justify-center d-none d-sm-flex theme-' +
  13. theme
  14. "
  15. >
  16. <h3 class="d-flex">
  17. <slot name="dialogType" />
  18. </h3>
  19. </div>
  20. <div class="dialog-container d-flex flex-column flex-grow-1">
  21. <v-card-title class="dialog-title theme-neutral">
  22. <slot name="dialogTitle" />
  23. </v-card-title>
  24. <div class="dialog-text-container">
  25. <slot name="dialogText" />
  26. </div>
  27. <v-spacer />
  28. <v-divider />
  29. <v-card-actions class="justify-center">
  30. <slot name="dialogBtn" />
  31. </v-card-actions>
  32. </div>
  33. </v-card>
  34. </v-dialog>
  35. </template>
  36. <script setup lang="ts">
  37. const props = defineProps({
  38. show: {
  39. type: [Boolean, Object],
  40. required: true,
  41. },
  42. contentClass: {
  43. type: String,
  44. required: false,
  45. },
  46. theme: {
  47. type: String,
  48. required: false,
  49. default: 'primary',
  50. },
  51. maxWidth: {
  52. type: [Number, String],
  53. required: false,
  54. default: 800,
  55. },
  56. })
  57. // @ts-ignore -> just to avoid the error with the prop's type of v-dialog
  58. const _show = computed(() => props.show) as boolean
  59. </script>
  60. <style lang="scss" scoped>
  61. .dialog-title {
  62. padding-left: 40px;
  63. font-weight: normal;
  64. }
  65. .dialog-type {
  66. width: 60px;
  67. min-width: 60px;
  68. max-width: 60px;
  69. min-height: 120px;
  70. padding: 25px 10px;
  71. h3 {
  72. font-size: 25px;
  73. font-weight: normal;
  74. writing-mode: vertical-lr;
  75. transform: rotate(-180deg);
  76. }
  77. }
  78. .dialog-container {
  79. overflow-x: scroll;
  80. }
  81. .dialog-text-container {
  82. max-height: 70vh;
  83. overflow: auto;
  84. }
  85. .modal-level-alert {
  86. .dialog-type {
  87. background: rgb(var(--v-theme-danger, #f56954));
  88. }
  89. }
  90. .modal-level-warning {
  91. .dialog-type {
  92. background: rgb(var(--v-theme-warning, #f39c12));
  93. }
  94. }
  95. :deep(.v-card-actions) {
  96. min-height: 62px;
  97. }
  98. </style>