Skip to content

Commit 7bb573a

Browse files
Update docs
1 parent 9d7d2d2 commit 7bb573a

File tree

6 files changed

+83
-157
lines changed

6 files changed

+83
-157
lines changed

src/documentation/DocsPage.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ provide('classes', classes);
141141
</script>
142142

143143
<style lang="scss" scoped>
144+
:deep(pre),
144145
:deep(code) {
146+
&.ic,
145147
&.inline-code {
146148
background-color: rgba(255, 255, 255, 0.1) !important;
147149
border-radius: 3px;
@@ -154,7 +156,9 @@ provide('classes', classes);
154156

155157
<style lang="scss">
156158
.v-theme--light {
159+
pre,
157160
code {
161+
&.ic,
158162
&.inline-code {
159163
background-color: rgba(0, 0, 0, 0.1) !important;
160164
}

src/documentation/components/examples/ClientTable.vue

Lines changed: 5 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
</h3>
1313
</v-col>
1414

15+
16+
17+
1518
<v-col cols="12">
1619
<VDrilldownTable
17-
:colors="tableSettings.colors"
20+
:default-colors="tableSettings?.defaultColors ?? {}"
1821
:density="tableSettings.density"
1922
:drilldown-key="tableSettings.drilldownKey"
2023
:elevation="tableSettings.elevation"
@@ -67,10 +70,6 @@ import tableDefaults from '@/playground/configs/templates/tableDefaults';
6770
6871
6972
const props = defineProps({
70-
colors: {
71-
default: () => { },
72-
type: Object,
73-
},
7473
sectionId: {
7574
default: 'example-data-table',
7675
type: String,
@@ -87,8 +86,7 @@ const props = defineProps({
8786
8887
8988
const classes = inject('classes');
90-
const colorsProp = ref(props.colors);
91-
const tableSettings = ref({ ...props.settings, ...props.colors });
89+
const tableSettings = ref({ ...props.settings });
9290
9391
const headers = {
9492
comments: [
@@ -180,89 +178,6 @@ const headers = {
180178
},
181179
],
182180
};
183-
const footers = {
184-
comments: [
185-
{
186-
align: 'start',
187-
key: '',
188-
title: '',
189-
width: 100,
190-
},
191-
{
192-
align: 'start',
193-
key: 'postId',
194-
title: 'Post ID',
195-
width: 100,
196-
},
197-
{
198-
align: 'start',
199-
key: 'id',
200-
title: 'Comment ID',
201-
width: 150,
202-
},
203-
{
204-
align: 'start',
205-
key: 'name',
206-
title: 'Comment',
207-
},
208-
{
209-
key: 'data-table-expand',
210-
title: '',
211-
},
212-
],
213-
posts: [
214-
{
215-
align: 'start',
216-
key: 'userId',
217-
title: 'User ID',
218-
width: 100,
219-
},
220-
{
221-
align: 'start',
222-
key: 'id',
223-
title: 'Post ID',
224-
width: 250,
225-
},
226-
{
227-
align: 'start',
228-
key: 'title',
229-
title: 'Post',
230-
},
231-
{
232-
key: 'data-table-expand',
233-
title: '',
234-
},
235-
],
236-
users: [
237-
// {
238-
// key: 'data-table-select',
239-
// title: '',
240-
// },
241-
{
242-
align: 'start',
243-
key: 'id',
244-
renderFooter() {
245-
return '&nbsp;';
246-
},
247-
title: 'User ID',
248-
width: 350,
249-
},
250-
{
251-
align: 'start',
252-
key: 'name',
253-
title: 'Name',
254-
},
255-
{
256-
align: 'start',
257-
key: 'email',
258-
title: 'Email',
259-
},
260-
{
261-
key: 'data-table-expand',
262-
title: '',
263-
},
264-
],
265-
};
266181
267182
268183
onMounted(() => {
@@ -300,9 +215,7 @@ function fetchClientData(drilldown = null) {
300215
user.child = {};
301216
user.child = {
302217
...tableDefaults,
303-
...colorsProp.value,
304218
drilldownKey: 'id',
305-
footers: footers.posts,
306219
headers: headers.posts,
307220
level: 2,
308221
loading: true,
@@ -328,9 +241,7 @@ function fetchClientData(drilldown = null) {
328241
post.child = {};
329242
post.child = {
330243
...tableDefaults,
331-
...colorsProp.value,
332244
drilldownKey: 'id',
333-
footers: footers.comments,
334245
headers: headers.comments,
335246
itemsPerPage: tableSettings.value.itemsPerPage,
336247
level: 3,

src/documentation/components/examples/ServerTable.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
<v-col cols="12">
2222
<VDrilldownTable
23-
:colors="tableSettings.colors"
2423
:density="tableSettings.density"
2524
:drilldown-key="tableSettings.drilldownKey"
2625
:elevation="tableSettings.elevation"
@@ -334,7 +333,6 @@ function getUserPosts(drilldown = null, updateCurrentLevel = false) {
334333
user.child = Object.assign({}, {
335334
...user.child,
336335
...{
337-
colors: null,
338336
drilldownKey: 'id',
339337
footers: footers.posts,
340338
headers: headers.posts,
@@ -394,7 +392,6 @@ function getPostComments(drilldown = null, updateCurrentLevel = false) {
394392
post.child = Object.assign({}, {
395393
...post.child,
396394
...{
397-
colors: null,
398395
drilldownKey: 'id',
399396
footers: footers.comments,
400397
headers: headers.comments,

src/documentation/sections/DrilldownEventSection.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ const drilldownEventObject = `{
184184
"value": -1
185185
}
186186
],
187-
"colors": null,
188187
"density": "compact",
189188
"drilldownKey": "id",
190189
"elevation": 5,

src/documentation/sections/ExampleSection.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525

2626
<ClientTable
27-
:colors="{ colors: null }"
2827
:settings="tableSettings"
2928
title="Client Side Data Table"
3029
/>
@@ -43,7 +42,7 @@ import {
4342
4443
4544
const classes = inject('classes');
46-
const tableSettings = ref({ ...tableDefaults, ...{ colors: null } });
47-
const tableSettingsServer = ref({ ...tableDefaults, ...{ colors: null, server: true } });
45+
const tableSettings = ref({ ...tableDefaults });
46+
const tableSettingsServer = ref({ ...tableDefaults, ...{ server: true } });
4847
4948
</script>

src/documentation/sections/subSections/ColorsProp.vue

Lines changed: 72 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,22 @@
88
:class="classes.headerA"
99
href="#props-colors"
1010
>#</a>
11-
Colors Prop
11+
Color Props
1212
</h3>
1313
</v-col>
1414

1515
<v-col cols="12">
16-
To make things easier for the user to distinguish the different levels of a table, there is the
17-
<a href="#props-all-colors"><code class="inline-code">colors</code></a> prop. While the main
18-
<a href="#examples">examples</a> are a base configuration with no colors, it is suggested to add the colors to the
19-
table to make it easier on the end user's readability.
16+
To make things easier for the user to distinguish the different levels of a table, there are a few color props that
17+
can be utilized. While the main <a href="#examples">examples</a> are a base configuration with no colors, it is
18+
suggested to add the colors to the table to make it easier on the end user's readability.
2019
</v-col>
2120

2221
<v-col cols="12">
23-
With these settings you can adjust the percentage change of the header row <code class="inline-code">colors</code>
24-
as you drilldown to deeper levels. This helps each level to stand out from the previous level. You can also set the
25-
percentage change to 0 to keep the same color for each level. Each level has the capability to have it's own <code
26-
class="inline-code"
27-
>colors</code> settings as well, you just have to adjust the settings being passed into the specific level inside of
28-
the <code class="inline-code">child</code> object of the item being drilled down into.
22+
With these settings you can adjust the percentage change of the header and footer row colors, as well as the bottom
23+
border color as you drilldown to deeper levels. This helps each level to stand out from the previous level. You can
24+
also set the percentage change to 0 to keep the same color for each level. Each level has the capability to have it's
25+
own <code class="inline-code">colors</code> settings as well, you just have to adjust the settings being passed into
26+
the specific level inside of the <code class="inline-code">child</code> object of the item being drilled down into.
2927
</v-col>
3028

3129
<v-col cols="12">
@@ -36,18 +34,17 @@
3634
</v-col>
3735

3836
<v-col cols="12">
39-
If you opt not to utilize the <a href="#props-all-colors"><code class="inline-code">colors</code></a> prop but still
40-
wish to customize the table's appearance, you can take advantage of various CSS classes embedded within the tables.
41-
These classes are designed with different levels, allowing you to selectively target specific elements within the
42-
tables for styling purposes.
37+
If you opt not to utilize the color props but still wish to customize the table's appearance, you can take advantage
38+
of various CSS classes embedded within the tables. These classes are designed with different levels, allowing you to
39+
selectively target specific elements within the tables for styling purposes.
4340
</v-col>
4441

4542
<v-col cols="12">
4643
Each of the color settings accept Vuetify theme color names or variables, HEX, RGB, HSL, and CSS color names.
4744
</v-col>
4845

4946
<v-col cols="12">
50-
The follow settings are the recommended settings to start with:
47+
The following <code class="ic">default-colors</code> prop setting is recommended to start with:
5148
</v-col>
5249

5350
<v-col cols="12">
@@ -60,12 +57,39 @@
6057
/>
6158
</v-col>
6259

63-
<ClientTable
64-
:colors="colorsProp"
65-
section-id="props-colors-example"
66-
:settings="tableSettings"
67-
title="Table with Colors Example"
68-
/>
60+
<v-col
61+
id="props-colors-example"
62+
cols="12"
63+
>
64+
<h3 :class="classes.h3">
65+
<a
66+
:class="classes.headerA"
67+
href="#props-colors-example"
68+
>#</a>
69+
Table with Colors Example
70+
</h3>
71+
</v-col>
72+
73+
<v-col cols="12">
74+
<v-btn-toggle
75+
v-model="selectedColor"
76+
density="compact"
77+
>
78+
<v-btn
79+
v-for="color in colors"
80+
:key="color"
81+
:active="headerBackgroundColor === color"
82+
:color="headerBackgroundColor === color ? color : ''"
83+
size="small"
84+
:value="color"
85+
@click="updateColor(color)"
86+
>
87+
{{ color }}
88+
</v-btn>
89+
</v-btn-toggle>
90+
</v-col>
91+
92+
<ClientTable :settings="tableSettings" />
6993
</template>
7094

7195

@@ -83,41 +107,33 @@ const props = defineProps({
83107
84108
const classes = inject('classes');
85109
const codeBlockSettings = computed(() => props.codeBlockOptions);
86-
87-
const colorsProp = {
88-
colors: {
89-
footer: {
90-
background: '--v-theme-surface',
91-
color: '--v-theme-on-surface',
92-
},
93-
header: {
94-
background: 'primary',
95-
color: 'on-primary',
96-
},
97-
percentageChange: 25,
98-
percentageDirection: 'desc',
99-
table: {
100-
bottomBorder: 'primary',
101-
},
102-
}
110+
const colors = ref(['primary', 'secondary', 'success', 'info', 'warning', 'error']);
111+
const headerBackgroundColor = ref('primary');
112+
const selectedColor = ref('primary');
113+
114+
const defaultColors = {
115+
background: 'primary',
116+
border: 'primary',
117+
color: 'on-primary',
103118
};
104119
105-
const tableSettings = ref({ ...tableDefaults, ...{ colors: colorsProp } });
106-
107-
const colorsPropCode = `colors: {
108-
footer: {
109-
background: '--v-theme-surface',
110-
text: '--v-theme-on-surface',
111-
},
112-
header: {
113-
background: 'primary',
114-
text: 'on-primary',
115-
},
116-
percentageChange: 25,
117-
percentageDirection: 'desc',
118-
table: {
119-
bottomBorder: 'primary',
120-
},
121-
}`;
120+
const tableSettings = ref({ ...tableDefaults, ...{ defaultColors } });
121+
122+
const colorsPropCode = `{
123+
background: 'primary',
124+
border: 'primary',
125+
color: 'on-primary',
126+
}"`;
127+
128+
function updateColor(val) {
129+
tableSettings.value.defaultColors.color = val;
130+
131+
if (val) {
132+
tableSettings.value.defaultColors.color = `on-${val}`;
133+
}
122134
135+
headerBackgroundColor.value = val;
136+
tableSettings.value.defaultColors.background = val;
137+
tableSettings.value.defaultColors.border = val ?? 'accent';
138+
}
123139
</script>

0 commit comments

Comments
 (0)