Skip to content

Commit 4c469fd

Browse files
author
MaazDev
authored
feat(VDataTable): Add checkboxColor prop (#11975)
resolves #8348
1 parent faeb8df commit 4c469fd

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

packages/api-generator/src/locale/en/v-data-table.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"props": {
33
"calculateWidths": "Enables calculation of column widths. `widths` property will be available in select scoped slots",
4+
"checkboxColor": "Set the color of the checkboxes (showSelect must be used)",
45
"customFilter": "Function to filter items",
56
"customGroup": "Function used to group items",
67
"customSort": "Function used to sort items",

packages/api-generator/src/maps/v-data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const DataProps = [
3030
{ name: 'itemsPerPage', source: 'v-data' },
3131
{ name: 'groupBy', source: 'v-data' },
3232
{ name: 'groupDesc', source: 'v-data' },
33+
{ name: 'checkboxColor', source: 'v-data', type: 'string' },
3334
{ name: 'customGroup', source: 'v-data', default: 'gh:groupItems', example: '(items: any[], groupBy: string[], groupDesc: boolean[]) => Record<string, any[]>' },
3435
{ name: 'locale', source: 'v-data' },
3536
{ name: 'disableSort', source: 'v-data' },

packages/vuetify/src/components/VDataTable/VDataTable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default mixins(
8888
default: () => [],
8989
} as PropValidator<DataTableHeader[]>,
9090
showSelect: Boolean,
91+
checkboxColor: String,
9192
showExpand: Boolean,
9293
showGroupBy: Boolean,
9394
// TODO: Fix
@@ -262,6 +263,7 @@ export default mixins(
262263
options: props.options,
263264
mobile: this.isMobile,
264265
showGroupBy: this.showGroupBy,
266+
checkboxColor: this.checkboxColor,
265267
someItems: this.someItems,
266268
everyItem: this.everyItem,
267269
singleSelect: this.singleSelect,
@@ -467,6 +469,7 @@ export default mixins(
467469
props: {
468470
value: data.isSelected,
469471
disabled: !this.isSelectable(item),
472+
color: this.checkboxColor ?? '',
470473
},
471474
on: {
472475
input: (val: boolean) => data.select(val),

packages/vuetify/src/components/VDataTable/mixins/__tests__/__snapshots__/header.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@ exports[`VDataTable/header.ts should generate select 3`] = `
5151
exports[`VDataTable/header.ts should generate select scoped slot 1`] = `
5252
<div>
5353
<div class="test">
54-
{"props":{"value":false,"indeterminate":false},"on":{}}
54+
{"props":{"value":false,"indeterminate":false,"color":""},"on":{}}
5555
</div>
5656
</div>
5757
`;
5858

5959
exports[`VDataTable/header.ts should generate select scoped slot 2`] = `
6060
<div>
6161
<div class="test">
62-
{"props":{"value":true,"indeterminate":false},"on":{}}
62+
{"props":{"value":true,"indeterminate":false,"color":""},"on":{}}
6363
</div>
6464
</div>
6565
`;
6666

6767
exports[`VDataTable/header.ts should generate select scoped slot 3`] = `
6868
<div>
6969
<div class="test">
70-
{"props":{"value":false,"indeterminate":true},"on":{}}
70+
{"props":{"value":false,"indeterminate":true,"color":""},"on":{}}
7171
</div>
7272
</div>
7373
`;

packages/vuetify/src/components/VDataTable/mixins/header.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default mixins<options>().extend({
3838
mustSort: false,
3939
}),
4040
} as PropValidator<DataOptions>,
41+
checkboxColor: String,
4142
sortIcon: {
4243
type: String,
4344
default: '$sort',
@@ -55,6 +56,7 @@ export default mixins<options>().extend({
5556
props: {
5657
value: this.everyItem,
5758
indeterminate: !this.everyItem && this.someItems,
59+
color: this.checkboxColor ?? '',
5860
},
5961
on: {
6062
input: (v: boolean) => this.$emit('toggle-select-all', v),

0 commit comments

Comments
 (0)