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
DetailsTableRow.vue
132 lines
| 1 | <template> |
| 2 | <div class="table-details-row"> |
| 3 | <template v-if="'rowValue' === type"> |
| 4 | <div :class="headingClasses"> |
| 5 | <template v-if="role !== 'default'">{{ 'Name' }}</template> |
| 6 | <template v-else> |
| 7 | <slot name="name"></slot> |
| 8 | : |
| 9 | </template> |
| 10 | </div> |
| 11 | <div :class="contentClasses"> |
| 12 | <template v-if="role !== 'default'">{{ 'Value' }}</template> |
| 13 | <template v-else> |
| 14 | <slot name="value"></slot> |
| 15 | </template> |
| 16 | </div> |
| 17 | <div :class="actionClasses"> |
| 18 | <template v-if="role !== 'default'">{{ 'Actions' }}</template> |
| 19 | <template v-else> |
| 20 | <slot name="actions"></slot> |
| 21 | </template> |
| 22 | </div> |
| 23 | |
| 24 | </template> |
| 25 | <template v-else> |
| 26 | <h3> |
| 27 | <slot name="name"></slot> |
| 28 | </h3> |
| 29 | </template> |
| 30 | </div> |
| 31 | </template> |
| 32 | |
| 33 | <script> |
| 34 | function defaultColumnClasses() { |
| 35 | return { |
| 36 | 'table-details-row-column': true, |
| 37 | }; |
| 38 | } |
| 39 | |
| 40 | export default { |
| 41 | name: 'DetailsTableRow', |
| 42 | props: { |
| 43 | role: { |
| 44 | type: String, |
| 45 | default: 'default', |
| 46 | validator: function( value ) { |
| 47 | return ( |
| 48 | -1 !== [ 'header', 'default', 'footer' ].indexOf( value ) |
| 49 | ); |
| 50 | }, |
| 51 | }, |
| 52 | type: { |
| 53 | type: String, |
| 54 | default: 'rowValue', |
| 55 | validator: function( value ) { |
| 56 | return ( |
| 57 | -1 !== [ 'rowValue', 'heading' ].indexOf( value ) |
| 58 | ); |
| 59 | }, |
| 60 | }, |
| 61 | }, |
| 62 | computed: { |
| 63 | headingClasses() { |
| 64 | return this.classes( { |
| 65 | 'table-details-row--heading': true, |
| 66 | } ); |
| 67 | }, |
| 68 | contentClasses() { |
| 69 | return this.classes( { |
| 70 | 'table-details-row--content': true, |
| 71 | } ); |
| 72 | }, |
| 73 | actionClasses() { |
| 74 | return this.classes( { |
| 75 | 'table-details-row--actions': true, |
| 76 | } ); |
| 77 | }, |
| 78 | }, |
| 79 | methods: { |
| 80 | classes( classes ) { |
| 81 | return { |
| 82 | ...defaultColumnClasses(), |
| 83 | ...classes, |
| 84 | [ 'table-details-row-role--' + this.role ]: true, |
| 85 | }; |
| 86 | }, |
| 87 | }, |
| 88 | }; |
| 89 | </script> |
| 90 | |
| 91 | <style lang="scss"> |
| 92 | |
| 93 | .table-details-row { |
| 94 | display: flex; |
| 95 | justify-content: space-between; |
| 96 | font-size: 1.1em; |
| 97 | &:first-child { |
| 98 | font-weight: bold; |
| 99 | } |
| 100 | &:nth-child(even) { |
| 101 | background-color: #eeeeee; |
| 102 | } |
| 103 | &-column { |
| 104 | padding: 0.5em 1em; |
| 105 | /*border-bottom: 1px solid #ccc;*/ |
| 106 | } |
| 107 | &--heading { |
| 108 | flex: 1; |
| 109 | text-align: right; |
| 110 | } |
| 111 | &-role--default.table-details-row--heading { |
| 112 | font-weight: 600; |
| 113 | } |
| 114 | &--content { |
| 115 | flex: 2; |
| 116 | } |
| 117 | &--actions { |
| 118 | flex: 0.3; |
| 119 | /*border-left: 1px solid #ccc;*/ |
| 120 | } |
| 121 | |
| 122 | h3 { |
| 123 | padding: 0.5em; |
| 124 | border-bottom: 1px solid #aaa; |
| 125 | width: 50%; |
| 126 | margin: 1em auto; |
| 127 | text-align: center; |
| 128 | color: #aaa; |
| 129 | font-weight: 400; |
| 130 | } |
| 131 | } |
| 132 | </style> |