AmOption.vue
117 lines
| 1 | <template> |
| 2 | <!-- Option --> |
| 3 | <el-option |
| 4 | ref="amSelectOption" |
| 5 | class="am-select-option" |
| 6 | :value="value" |
| 7 | :label="label" |
| 8 | :disabled="disabled" |
| 9 | > |
| 10 | <slot /> |
| 11 | </el-option> |
| 12 | <!-- /Option --> |
| 13 | </template> |
| 14 | |
| 15 | <script setup> |
| 16 | import { ref } from 'vue' |
| 17 | |
| 18 | /** |
| 19 | * Component Props |
| 20 | */ |
| 21 | defineProps({ |
| 22 | value: { |
| 23 | type: [String, Number, Object], |
| 24 | required: true, |
| 25 | }, |
| 26 | label: { |
| 27 | type: [String, Number], |
| 28 | default: '', |
| 29 | }, |
| 30 | disabled: { |
| 31 | type: Boolean, |
| 32 | default: false, |
| 33 | }, |
| 34 | }) |
| 35 | |
| 36 | /** |
| 37 | * Component reference |
| 38 | */ |
| 39 | const amSelectOption = ref(null) |
| 40 | </script> |
| 41 | |
| 42 | <style lang="scss"> |
| 43 | .am-select-popper { |
| 44 | --am-hmin-select-option: 32px; |
| 45 | --am-h-select-option: auto; |
| 46 | --am-flh-select-option: 1.4; |
| 47 | --am-c-select-option-text: var(--am-c-option-text); |
| 48 | --am-c-select-option-bgr: transparent; |
| 49 | --am-pad-select-option: 8px; |
| 50 | --am-mar-select-option: 0px; |
| 51 | --am-fs-select-option: 14px; |
| 52 | --am-fw-select-option: 400; |
| 53 | --am-ff-select-option: var(--am-font-family); |
| 54 | background-color: var(--am-c-option-bgr) !important; |
| 55 | |
| 56 | &.el-select__popper.el-popper[role='tooltip']='tooltip'] { |
| 57 | background-color: transparent; |
| 58 | border-color: var(--am-c-option-border); |
| 59 | overflow: hidden; |
| 60 | } |
| 61 | |
| 62 | &.el-select-dropdown { |
| 63 | margin: 0; |
| 64 | position: static; |
| 65 | border: none; |
| 66 | } |
| 67 | |
| 68 | * { |
| 69 | font-family: var(--am-font-family), sans-serif; |
| 70 | border-radius: unset; |
| 71 | } |
| 72 | |
| 73 | .el-select-dropdown { |
| 74 | &__list { |
| 75 | padding: 0; |
| 76 | } |
| 77 | |
| 78 | &__item { |
| 79 | min-height: var(--am-hmin-select-option) !important; |
| 80 | height: var(--am-h-select-option) !important; |
| 81 | font-family: var(--am-ff-select-option), sans-serif !important; |
| 82 | font-size: var(--am-fs-select-option) !important; |
| 83 | font-weight: var(--am-fw-select-option) !important; |
| 84 | line-height: var(--am-flh-select-option) !important; |
| 85 | color: var(--am-c-select-option-text) !important; |
| 86 | background-color: var(--am-c-select-option-bgr) !important; |
| 87 | padding: var(--am-pad-select-option) !important; |
| 88 | margin: var(--am-mar-select-option) !important; |
| 89 | white-space: normal; |
| 90 | |
| 91 | &:hover, |
| 92 | &.is-hovering { |
| 93 | --am-c-select-option-bgr: var(--am-c-option-hover); |
| 94 | } |
| 95 | |
| 96 | &.is-selected { |
| 97 | --am-c-select-option-text: var(--am-c-option-selected); |
| 98 | } |
| 99 | |
| 100 | &.is-disabled { |
| 101 | --am-c-select-option-text: var(--am-c-option-text-op50) !important; |
| 102 | } |
| 103 | |
| 104 | &:last-child { |
| 105 | border-bottom: none; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | p.el-select-dropdown__empty { |
| 110 | padding: 16px; |
| 111 | font-size: 14px; |
| 112 | color: var(--am-c-option-text-op65); |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | </style> |
| 117 |