Skip to content

Commit 5e1d653

Browse files
jcjpjohnleider
andauthored
feat(VDataTable): add new lastFixed property (#21153) (#21168)
Co-authored-by: John Leider <[email protected]>
1 parent 7327866 commit 5e1d653

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/api-generator/src/locale/en/VDataTableHeaders.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"sortAscIcon": "Icon used for ascending sort button.",
55
"sortDescIcon": "Icon used for descending sort button.",
66
"sticky": "Deprecated, use `fixed-header` instead.",
7-
"fixedHeader": "Sticks the header to the top of the table.",
7+
"fixedHeader": "Sticks the header to the top of the table. From the left",
8+
"lastFixed": "Sticks the header to the top of the table. From the right.",
89
"multiSort": "Sort on multiple columns at the same time.",
910
"headerProps": "Additional props to be be passed to the default header"
1011
},

packages/docs/src/data/new-in.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
},
6363
"VDataTable": {
6464
"props": {
65-
"headerProps": "3.5.0"
65+
"headerProps": "3.5.0",
66+
"lastFixed": "3.9.0"
6667
}
6768
},
6869
"VExpansionPanels": {

packages/vuetify/src/components/VDataTable/VDataTableHeaders.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const makeVDataTableHeadersProps = propsFactory({
6161
color: String,
6262
disableSort: Boolean,
6363
fixedHeader: Boolean,
64+
lastFixed: Boolean,
6465
multiSort: Boolean,
6566
sortAscIcon: {
6667
type: IconValue,
@@ -94,11 +95,12 @@ export const VDataTableHeaders = genericComponent<VDataTableHeadersSlots>()({
9495
const { loaderClasses } = useLoader(props)
9596

9697
function getFixedStyles (column: InternalDataTableHeader, y: number): CSSProperties | undefined {
97-
if (!(props.sticky || props.fixedHeader) && !column.fixed) return undefined
98+
if (!(props.sticky || props.fixedHeader) && !(column.fixed || column.lastFixed)) return undefined
9899

99100
return {
100101
position: 'sticky',
101-
left: column.fixed ? convertToUnit(column.fixedOffset) : undefined,
102+
left: column.fixed || column.lastFixed ? convertToUnit(column.fixedOffset) : undefined,
103+
right: column.lastFixed ? convertToUnit(column.fixedOffset ?? 0) : undefined,
102104
top: (props.sticky || props.fixedHeader) ? `calc(var(--v-table-header-height) * ${y})` : undefined,
103105
}
104106
}

0 commit comments

Comments
 (0)