ColumnWrapper.vue
2 years ago
CxVuiCollapseMini.vue
2 years ago
CxVuiDate.vue
2 years ago
CxVuiFSelect.vue
2 years ago
CxVuiPopup.vue
2 years ago
CxVuiSelect.vue
2 years ago
CxVuiTabs.vue
2 years ago
CxVuiTabsPanel.vue
2 years ago
Delimiter.vue
2 years ago
DetailsTable.vue
2 years ago
DetailsTableRow.vue
2 years ago
DetailsTableRowValue.vue
2 years ago
ExternalLink.vue
2 years ago
ListComponents.vue
2 years ago
PrintButton.vue
2 years ago
RowWrapper.vue
2 years ago
Tooltip.vue
2 years ago
CxVuiCollapseMini.vue
170 lines
| 1 | <template> |
| 2 | <div :class="{ |
| 3 | 'cx-vui-panel': withPanel, |
| 4 | 'cx-vui-collapse-mini--disabled': disabled, |
| 5 | 'cx-vui-collapse-mini__item': true, |
| 6 | 'cx-vui-collapse-mini__item--active': isActive |
| 7 | }"> |
| 8 | <div |
| 9 | class="cx-vui-collapse-mini__header" |
| 10 | @click="collapse" |
| 11 | > |
| 12 | <div class="cx-vui-collapse-mini__header-label"> |
| 13 | <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 14 | <path d="M14 13.9999L14 -0.00012207L0 -0.000121458L6.11959e-07 13.9999L14 13.9999Z" |
| 15 | fill="white"></path> |
| 16 | <path d="M5.32911 1L11 7L5.32911 13L4 11.5938L8.34177 7L4 2.40625L5.32911 1Z" fill="#007CBA"></path> |
| 17 | </svg> |
| 18 | {{ label }} |
| 19 | </div> |
| 20 | <div |
| 21 | v-if="icon" |
| 22 | class="cx-vui-collapse-mini__header-desc" |
| 23 | > |
| 24 | <component |
| 25 | v-if="'object' === typeof icon" |
| 26 | v-bind:is="icon" |
| 27 | /> |
| 28 | </div> |
| 29 | <div |
| 30 | v-else-if="desc" |
| 31 | class="cx-vui-collapse-mini__header-desc" |
| 32 | > |
| 33 | {{ desc }} |
| 34 | </div> |
| 35 | <div |
| 36 | v-if="$slots.description" |
| 37 | class="cx-vui-collapse-mini__header-custom-description" |
| 38 | > |
| 39 | <slot name="description"></slot> |
| 40 | </div> |
| 41 | </div> |
| 42 | <template v-if="!disabled"> |
| 43 | <template v-if="this.$slots.default"> |
| 44 | <div |
| 45 | v-show="isActive" |
| 46 | class="cx-vui-collapse-mini__content" |
| 47 | > |
| 48 | <slot></slot> |
| 49 | </div> |
| 50 | </template> |
| 51 | <template v-else> |
| 52 | <slot name="custom" :state="{ isActive }"></slot> |
| 53 | </template> |
| 54 | </template> |
| 55 | </div> |
| 56 | </template> |
| 57 | |
| 58 | <script> |
| 59 | |
| 60 | export default { |
| 61 | name: 'cx-vui-collapse-mini', |
| 62 | props: { |
| 63 | withPanel: { |
| 64 | type: Boolean, |
| 65 | default: false, |
| 66 | }, |
| 67 | initialActive: { |
| 68 | type: Boolean, |
| 69 | default: false, |
| 70 | }, |
| 71 | label: { |
| 72 | type: String, |
| 73 | default: 'Collapse Mini', |
| 74 | }, |
| 75 | desc: { |
| 76 | type: String, |
| 77 | default: '', |
| 78 | }, |
| 79 | disabled: { |
| 80 | type: Boolean, |
| 81 | default: false, |
| 82 | }, |
| 83 | icon: { |
| 84 | type: [ Object, String ], |
| 85 | default: '', |
| 86 | }, |
| 87 | }, |
| 88 | data() { |
| 89 | return { |
| 90 | isActive: false, |
| 91 | }; |
| 92 | }, |
| 93 | created() { |
| 94 | this.isActive = this.initialActive; |
| 95 | }, |
| 96 | methods: { |
| 97 | collapse() { |
| 98 | if ( this.disabled ) { |
| 99 | return; |
| 100 | } |
| 101 | this.isActive = !this.isActive; |
| 102 | this.$emit( 'change', this.isActive ); |
| 103 | }, |
| 104 | }, |
| 105 | }; |
| 106 | </script> |
| 107 | |
| 108 | <style lang="scss"> |
| 109 | .cx-vui-collapse-mini { |
| 110 | &__wrap { |
| 111 | padding: 0 0 20px; |
| 112 | } |
| 113 | |
| 114 | &__item { |
| 115 | &:first-child { |
| 116 | border-top: 1px solid #ECECEC; |
| 117 | } |
| 118 | |
| 119 | &:last-child { |
| 120 | margin-bottom: unset; |
| 121 | } |
| 122 | |
| 123 | &--active .cx-vui-collapse-mini__header-label > svg { |
| 124 | transform: rotate(90deg); |
| 125 | } |
| 126 | |
| 127 | border-bottom: 1px solid #ECECEC; |
| 128 | } |
| 129 | |
| 130 | &__header { |
| 131 | padding: 1.2rem; |
| 132 | display: flex; |
| 133 | align-items: center; |
| 134 | cursor: pointer; |
| 135 | column-gap: 1em; |
| 136 | |
| 137 | &-label { |
| 138 | font-weight: 500; |
| 139 | font-size: 15px; |
| 140 | line-height: 23px; |
| 141 | color: #007CBA; |
| 142 | display: flex; |
| 143 | align-items: center; |
| 144 | } |
| 145 | |
| 146 | &-desc { |
| 147 | font-size: 15px; |
| 148 | line-height: 23px; |
| 149 | color: #7B7E81; |
| 150 | } |
| 151 | |
| 152 | &-label svg { |
| 153 | margin: -1px 8px 0 0; |
| 154 | transition: 0.3s; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | &--disabled { |
| 159 | opacity: 0.5; |
| 160 | |
| 161 | .cx-vui-collapse-mini__header { |
| 162 | cursor: not-allowed; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | &__content { |
| 167 | padding: 0 1.5rem 1.5rem; |
| 168 | } |
| 169 | } |
| 170 | </style> |