mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-01 04:37:57 +01:00
feat(Table): handle rowClass property in columns (#1632)
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
This commit is contained in:
@@ -29,6 +29,7 @@ Use the `columns` prop to configure which columns to display. It's an array of o
|
|||||||
- `sortable` - Whether the column is sortable. Defaults to `false`.
|
- `sortable` - Whether the column is sortable. Defaults to `false`.
|
||||||
- `direction` - The sort direction to use on first click. Defaults to `asc`.
|
- `direction` - The sort direction to use on first click. Defaults to `asc`.
|
||||||
- `class` - The class to apply to the column cells.
|
- `class` - The class to apply to the column cells.
|
||||||
|
- `rowClass` - The class to apply to the data column cells.
|
||||||
- `sort` - Pass your own `sort` function. Defaults to a simple _greater than_ / _less than_ comparison.
|
- `sort` - Pass your own `sort` function. Defaults to a simple _greater than_ / _less than_ comparison.
|
||||||
|
|
||||||
::component-example{class="grid"}
|
::component-example{class="grid"}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
|
<UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, row[column.key]?.class]">
|
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class]">
|
||||||
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
|
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
|
||||||
{{ getRowData(row, column.key) }}
|
{{ getRowData(row, column.key) }}
|
||||||
</slot>
|
</slot>
|
||||||
@@ -121,6 +121,7 @@ interface Column {
|
|||||||
sort?: (a: any, b: any, direction: 'asc' | 'desc') => number
|
sort?: (a: any, b: any, direction: 'asc' | 'desc') => number
|
||||||
direction?: 'asc' | 'desc'
|
direction?: 'asc' | 'desc'
|
||||||
class?: string
|
class?: string
|
||||||
|
rowClass?: string
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user