|
18 | 18 | >Vuetify</a> documentation.
|
19 | 19 | </v-col>
|
20 | 20 |
|
21 |
| - <!-- <v-col cols="12"> |
| 21 | + <v-col cols="12"> |
22 | 22 | <v-card>
|
23 |
| - <v-data-table |
24 |
| - :headers="headers" |
| 23 | + <v-table |
| 24 | + class="slots-table" |
25 | 25 | hide-default-footer
|
26 |
| - :items="items" |
27 | 26 | >
|
28 |
| - <template #item="{ item }"> |
| 27 | + <thead> |
29 | 28 | <tr>
|
| 29 | + <th width="20%">Name</th> |
| 30 | + <th>Description</th> |
| 31 | + </tr> |
| 32 | + </thead> |
| 33 | + <tbody> |
| 34 | + <!-- display.append slot --> |
| 35 | + <tr |
| 36 | + id="slots-display-append" |
| 37 | + :class="rowClass" |
| 38 | + > |
30 | 39 | <td>
|
31 |
| - <span |
32 |
| - :id="`events-${item.raw.name}`" |
33 |
| - class="name-item text-mono ml-n2" |
34 |
| - > |
| 40 | + <span class="name-item text-mono ml-n2"> |
35 | 41 | <span class="text-primary">#</span>
|
36 | 42 | <a
|
37 | 43 | class="text-primary"
|
38 | 44 | :class="classes.appLink"
|
39 |
| - :href="`#events-${item.raw.name}`" |
40 |
| - > |
41 |
| - {{ item.raw.name }} |
42 |
| - </a> |
| 45 | + href="#slots-display-append" |
| 46 | + >display.append</a> |
43 | 47 | </span>
|
44 | 48 | </td>
|
| 49 | + <td> |
| 50 | + Slot that is appended to the displayed value |
| 51 | + </td> |
| 52 | + </tr> |
| 53 | + <tr> |
| 54 | + <td colspan="2"> |
| 55 | + <CodeBlock |
| 56 | + :code="displaySlotsCode" |
| 57 | + :highlightjs="codeBlockSettings.plugin === 'highlightjs'" |
| 58 | + lang="typescript" |
| 59 | + :prismjs="codeBlockSettings.plugin === 'prismjs'" |
| 60 | + :theme="codeBlockSettings.theme" |
| 61 | + /> |
| 62 | + </td> |
| 63 | + </tr> |
45 | 64 |
|
46 |
| - <td>{{ item.raw.desc }}</td> |
| 65 | + <!-- display.appendInner slot --> |
| 66 | + <tr |
| 67 | + id="slots-display-append-inner" |
| 68 | + :class="rowClass" |
| 69 | + > |
| 70 | + <td> |
| 71 | + <span class="name-item text-mono ml-n2"> |
| 72 | + <span class="text-primary">#</span> |
| 73 | + <a |
| 74 | + class="text-primary" |
| 75 | + :class="classes.appLink" |
| 76 | + href="#slots-display-append-inner" |
| 77 | + >display.appendInner</a> |
| 78 | + </span> |
| 79 | + </td> |
| 80 | + <td> |
| 81 | + Slot that is appended inside the displayed value |
| 82 | + </td> |
| 83 | + </tr> |
| 84 | + <tr> |
| 85 | + <td colspan="2"> |
| 86 | + <CodeBlock |
| 87 | + :code="displaySlotsCode" |
| 88 | + :highlightjs="codeBlockSettings.plugin === 'highlightjs'" |
| 89 | + lang="typescript" |
| 90 | + :prismjs="codeBlockSettings.plugin === 'prismjs'" |
| 91 | + :theme="codeBlockSettings.theme" |
| 92 | + /> |
| 93 | + </td> |
| 94 | + </tr> |
| 95 | + |
| 96 | + <!-- display.prepend slot --> |
| 97 | + <tr |
| 98 | + id="slots-display-prepend" |
| 99 | + :class="rowClass" |
| 100 | + > |
| 101 | + <td> |
| 102 | + <span class="name-item text-mono ml-n2"> |
| 103 | + <span class="text-primary">#</span> |
| 104 | + <a |
| 105 | + class="text-primary" |
| 106 | + :class="classes.appLink" |
| 107 | + href="#slots-display-prepend" |
| 108 | + >display.prepend</a> |
| 109 | + </span> |
| 110 | + </td> |
| 111 | + <td> |
| 112 | + Slot that is prepended to the displayed value |
| 113 | + </td> |
| 114 | + </tr> |
| 115 | + <tr> |
| 116 | + <td colspan="2"> |
| 117 | + <CodeBlock |
| 118 | + :code="displaySlotsCode" |
| 119 | + :highlightjs="codeBlockSettings.plugin === 'highlightjs'" |
| 120 | + lang="typescript" |
| 121 | + :prismjs="codeBlockSettings.plugin === 'prismjs'" |
| 122 | + :theme="codeBlockSettings.theme" |
| 123 | + /> |
| 124 | + </td> |
47 | 125 | </tr>
|
48 |
| - </template> |
49 |
| - </v-data-table> |
50 |
| - </v-card> |
51 |
| - </v-col> --> |
52 | 126 |
|
| 127 | + <!-- display.prependInner slot --> |
| 128 | + <tr |
| 129 | + id="slots-display-prepend-inner" |
| 130 | + :class="rowClass" |
| 131 | + > |
| 132 | + <td> |
| 133 | + <span class="name-item text-mono ml-n2"> |
| 134 | + <span class="text-primary">#</span> |
| 135 | + <a |
| 136 | + class="text-primary" |
| 137 | + :class="classes.appLink" |
| 138 | + href="#slots-display-prepend-inner" |
| 139 | + >display.prependInner</a> |
| 140 | + </span> |
| 141 | + </td> |
| 142 | + <td> |
| 143 | + Slot that is prepended inside the displayed value |
| 144 | + </td> |
| 145 | + </tr> |
| 146 | + <tr> |
| 147 | + <td colspan="2"> |
| 148 | + <CodeBlock |
| 149 | + :code="displaySlotsCode" |
| 150 | + :highlightjs="codeBlockSettings.plugin === 'highlightjs'" |
| 151 | + lang="typescript" |
| 152 | + :prismjs="codeBlockSettings.plugin === 'prismjs'" |
| 153 | + :theme="codeBlockSettings.theme" |
| 154 | + /> |
| 155 | + </td> |
| 156 | + </tr> |
| 157 | + |
| 158 | + </tbody> |
| 159 | + </v-table> |
| 160 | + </v-card> |
| 161 | + </v-col> |
53 | 162 | </v-row>
|
54 | 163 | </template>
|
55 | 164 |
|
56 | 165 | <script setup>
|
57 | 166 | import { inject } from 'vue';
|
58 | 167 | import { useCoreStore } from '@/stores/index';
|
59 | 168 |
|
| 169 | +const props = defineProps({ |
| 170 | + codeBlockOptions: { |
| 171 | + required: true, |
| 172 | + type: Object, |
| 173 | + }, |
| 174 | +}); |
60 | 175 |
|
61 |
| -const classes = inject('classes'); |
| 176 | +const codeBlockSettings = computed(() => props.codeBlockOptions); |
62 | 177 | const store = useCoreStore();
|
| 178 | +const classes = inject('classes'); |
| 179 | +const theme = useTheme(); |
| 180 | +const isDark = ref(true); |
| 181 | +
|
| 182 | +
|
| 183 | +watch(() => theme.global.current.value.dark, (val) => { |
| 184 | + isDark.value = val; |
| 185 | +}); |
| 186 | +
|
| 187 | +const rowClass = computed(() => { |
| 188 | + return isDark.value ? 'bg-grey-darken-3' : 'bg-grey-lighten-3'; |
| 189 | +}); |
| 190 | +
|
| 191 | +const displaySlotsCode = `{ |
| 192 | + displayValue: any, |
| 193 | + empty: boolean, |
| 194 | + error: boolean | undefined, |
| 195 | +}`; |
| 196 | +
|
63 | 197 |
|
64 |
| -// const headers = [ |
65 |
| -// { |
66 |
| -// align: 'start', |
67 |
| -// filterable: true, |
68 |
| -// key: 'name', |
69 |
| -// sortable: false, |
70 |
| -// title: 'Name', |
71 |
| -// width: '15%', |
72 |
| -// }, |
73 |
| -// { |
74 |
| -// align: 'start', |
75 |
| -// filterable: false, |
76 |
| -// key: 'desc', |
77 |
| -// sortable: false, |
78 |
| -// title: 'Description', |
79 |
| -// }, |
80 |
| -// ]; |
81 |
| -// const items = [ |
82 |
| -// { |
83 |
| -// desc: 'TBD', |
84 |
| -// name: 'TBD', |
85 |
| -// }, |
86 |
| -// ]; |
87 | 198 | </script>
|
88 | 199 |
|
| 200 | +<style lang="scss"> |
| 201 | +.slots-table { |
| 202 | + td { |
| 203 | + line-height: 2rem !important; |
| 204 | +
|
| 205 | + > div { |
| 206 | + padding: 0.5rem 0 !important; |
| 207 | + } |
| 208 | + } |
| 209 | +} |
| 210 | +</style> |
0 commit comments