From b0d1215a6e32ff2274965bedb320d86441e25df8 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Sat, 19 Oct 2024 23:42:04 +1100 Subject: [PATCH 01/12] fix(VTreeviewChildren): return-object mess up ListGroup id --- packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx index 89a88fdfc7c..100944f134a 100644 --- a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx +++ b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx @@ -128,7 +128,7 @@ export const VTreeviewChildren = genericComponent {{ activator: ({ props: activatorProps }) => { From 6759576857a3c2146be2a4f9e068bfbf3d101151 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Sun, 20 Oct 2024 16:26:55 +1100 Subject: [PATCH 02/12] fix(VListGroup): support return-object --- packages/vuetify/src/components/VList/VListChildren.tsx | 3 ++- packages/vuetify/src/components/VList/VListGroup.tsx | 3 ++- packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/vuetify/src/components/VList/VListChildren.tsx b/packages/vuetify/src/components/VList/VListChildren.tsx index 9f817579f14..0c0b102e9fe 100644 --- a/packages/vuetify/src/components/VList/VListChildren.tsx +++ b/packages/vuetify/src/components/VList/VListChildren.tsx @@ -67,8 +67,9 @@ export const VListChildren = genericComponent( return children ? ( {{ activator: ({ props: activatorProps }) => { diff --git a/packages/vuetify/src/components/VList/VListGroup.tsx b/packages/vuetify/src/components/VList/VListGroup.tsx index 2d94ce78e31..26ccb65d7b9 100644 --- a/packages/vuetify/src/components/VList/VListGroup.tsx +++ b/packages/vuetify/src/components/VList/VListGroup.tsx @@ -43,6 +43,7 @@ export const makeVListGroupProps = propsFactory({ type: IconValue, default: '$expand', }, + id: String, prependIcon: IconValue, appendIcon: IconValue, fluid: Boolean, @@ -61,7 +62,7 @@ export const VListGroup = genericComponent()({ setup (props, { slots }) { const { isOpen, open, id: _id } = useNestedItem(toRef(props, 'value'), true) - const id = computed(() => `v-list-group--id-${String(_id.value)}`) + const id = computed(() => `v-list-group--id-${String(props.id ?? _id.value)}`) const list = useList() const { isBooted } = useSsrBoot() diff --git a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx index 100944f134a..89a88fdfc7c 100644 --- a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx +++ b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx @@ -128,7 +128,7 @@ export const VTreeviewChildren = genericComponent {{ activator: ({ props: activatorProps }) => { From 63511f7aa110f91d2e271b79112c517ec4ac5f77 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Mon, 21 Oct 2024 22:26:04 +1100 Subject: [PATCH 03/12] chore(VListGroup): replace cypress with vitest --- .../__tests__/VListGroup.spec.browser.tsx | 112 +++++++++++++++ .../VList/__tests__/VListGroup.spec.cy.tsx | 129 ------------------ 2 files changed, 112 insertions(+), 129 deletions(-) create mode 100644 packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx delete mode 100644 packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx diff --git a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx new file mode 100644 index 00000000000..1300d2f1180 --- /dev/null +++ b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx @@ -0,0 +1,112 @@ +import { VListGroup } from '../VListGroup' +import { VListItem } from '../VListItem' +import { VList } from '../VList' + +// Components +import { VBtn } from '@/components/VBtn' + +// Utilities +import { render, screen } from '@test' +import { userEvent } from '@vitest/browser/context' +import { ref } from 'vue' +// Types +import type { Ref } from 'vue' + +describe('VListGroup', () => { + it('supports header slot', () => { + render(() => ( + + + {{ activator: props => }} + + + )) + + expect(screen.getByCSS('.v-list-item-title')).toHaveTextContent('Group') + }) + + it('supports children', () => { + render(() => ( + + + {{ + activator: props => , + default: () => ( + <> + + + + ), + }} + + + )) + + expect(screen.getAllByCSS('.v-list-item-title')[0]).toHaveTextContent('Group') + }) + + // it.only('should not remove opened when unmounted', () => { + // const visible = ref(true) + // const opened = ref(['Users']) + // render(() => ( + // + // { + // visible.value && ( + // + // {{ + // default: () => ( + // <> + // + // + // + // ), + // }} + // + // ) + // } + // + // )) + + // expect(screen.getByCSS('.v-list')).toContainElement(screen.getByCSS('.v-list-group')) + // expect(screen.getByCSS('.v-list-group__items')).toBeVisible() + // // wrapper.get('.v-list .v-list-group').should('exist') + // // .get('.v-list-group__items').should('be.visible') + // // .then(() => { + // // visible.value = false + // // }) + // // .get('.v-list.v-list-group').should('not.exist') + // // .then(() => { + // // visible.value = true + // // }) + // // .get('.v-list-group').should('exist') + // // .get('.v-list-group__items').should('be.visible') + // }) + + // https://github.com/vuetifyjs/vuetify/issues/20354 + it('should support programmatically expand group via open model', async () => { + const opened: Ref = ref([]) + + const { container } = render(() => ( + <> + { opened.value.push('Users') } }>Click me + + + {{ + activator: ({ props }) => , + default: () => ( + <> + + + + ), + }} + + + + )) + + await userEvent.click(container.querySelector('button')!) + expect(opened.value).toStrictEqual(['Users']) + expect(screen.getByCSS('.v-list-group__items')).toBeVisible() + }) +}) diff --git a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx deleted file mode 100644 index c86d5b57f20..00000000000 --- a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.cy.tsx +++ /dev/null @@ -1,129 +0,0 @@ -/// - -import { CenteredGrid } from '@/../cypress/templates' -import { VListGroup } from '../VListGroup' -import { VListItem } from '../VListItem' -import { VList } from '../VList' - -// Components -import { VBtn } from '@/components/VBtn' - -// Utilities -import { ref } from 'vue' -// Types -import type { Ref } from 'vue' - -describe('VListGroup', () => { - function mountFunction (content: JSX.Element) { - return cy.mount(() => content) - } - - it('supports header slot', () => { - const wrapper = mountFunction(( - -

ListGroup

- - - - {{ activator: props => }} - - -
- )) - - wrapper.get('.v-list-item-title').contains('Group') - }) - - it('supports children', () => { - const wrapper = mountFunction(( - -

ListGroup

- - - - {{ - activator: props => , - default: () => ( - <> - - - - ), - }} - - -
- )) - - wrapper.get('.v-list-item-title').contains('Group') - }) - - it('should not remove opened when unmounted', () => { - const visible = ref(true) - const opened = ref(['Users']) - const wrapper = mountFunction(( - -

ListGroup

- - - { - visible.value && ( - - {{ - default: () => ( - <> - - - - ), - }} - - ) - } - -
- )) - - wrapper.get('.v-list .v-list-group').should('exist') - .get('.v-list-group__items').should('be.visible') - .then(() => { - visible.value = false - }) - .get('.v-list.v-list-group').should('not.exist') - .then(() => { - visible.value = true - }) - .get('.v-list-group').should('exist') - .get('.v-list-group__items').should('be.visible') - }) - - // https://github.com/vuetifyjs/vuetify/issues/20354 - it('should support programmatically expand group via open model', () => { - const opened: Ref = ref([]) - - cy.mount(() => ( - <> - { opened.value.push('Users') } }>Click me - - - {{ - activator: ({ props }) => , - default: () => ( - <> - - - - ), - }} - - - - )) - - cy.get('button').click() - .then(_ => { - expect(opened.value).to.deep.equal(['Users']) - }) - .get('.v-list-group__items').should('be.visible') - }) -}) From 56bae8ead88291847dcc4361c2a4f66efad2914a Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Tue, 22 Oct 2024 21:22:49 +1100 Subject: [PATCH 04/12] chore: finish migrating VListGroup to vitest --- .../__tests__/VListGroup.spec.browser.tsx | 68 +++++++++---------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx index 1300d2f1180..7ad9107b5ce 100644 --- a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx +++ b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx @@ -7,7 +7,7 @@ import { VBtn } from '@/components/VBtn' // Utilities import { render, screen } from '@test' -import { userEvent } from '@vitest/browser/context' +import { commands, userEvent } from '@vitest/browser/context' import { ref } from 'vue' // Types import type { Ref } from 'vue' @@ -45,42 +45,38 @@ describe('VListGroup', () => { expect(screen.getAllByCSS('.v-list-item-title')[0]).toHaveTextContent('Group') }) - // it.only('should not remove opened when unmounted', () => { - // const visible = ref(true) - // const opened = ref(['Users']) - // render(() => ( - // - // { - // visible.value && ( - // - // {{ - // default: () => ( - // <> - // - // - // - // ), - // }} - // - // ) - // } - // - // )) + it('should not remove opened when unmounted', async () => { + const visible = ref(true) + const opened = ref(['Users']) + render(() => ( + + { + visible.value && ( + + {{ + default: () => ( + <> + + + + ), + }} + + ) + } + + )) - // expect(screen.getByCSS('.v-list')).toContainElement(screen.getByCSS('.v-list-group')) - // expect(screen.getByCSS('.v-list-group__items')).toBeVisible() - // // wrapper.get('.v-list .v-list-group').should('exist') - // // .get('.v-list-group__items').should('be.visible') - // // .then(() => { - // // visible.value = false - // // }) - // // .get('.v-list.v-list-group').should('not.exist') - // // .then(() => { - // // visible.value = true - // // }) - // // .get('.v-list-group').should('exist') - // // .get('.v-list-group__items').should('be.visible') - // }) + expect(screen.queryByRole('group')).not.toBeNull() + expect(screen.getByCSS('.v-list-group__items')).toBeVisible() + visible.value = false + await commands.waitStable('.v-list') + expect(screen.queryByRole('group')).toBeNull() + visible.value = true + await commands.waitStable('.v-list') + expect(screen.queryByRole('group')).not.toBeNull() + expect(screen.getByCSS('.v-list-group__items')).toBeVisible() + }) // https://github.com/vuetifyjs/vuetify/issues/20354 it('should support programmatically expand group via open model', async () => { From 4f5b8979521f79e39d8fb50e744aa84430ebc4fd Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Tue, 22 Oct 2024 21:56:59 +1100 Subject: [PATCH 05/12] chore: add browser test for return-object --- .../src/components/VList/VListGroup.tsx | 2 +- .../__tests__/VListGroup.spec.browser.tsx | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/packages/vuetify/src/components/VList/VListGroup.tsx b/packages/vuetify/src/components/VList/VListGroup.tsx index 26ccb65d7b9..702ea2334e3 100644 --- a/packages/vuetify/src/components/VList/VListGroup.tsx +++ b/packages/vuetify/src/components/VList/VListGroup.tsx @@ -43,7 +43,7 @@ export const makeVListGroupProps = propsFactory({ type: IconValue, default: '$expand', }, - id: String, + id: [String, Number], prependIcon: IconValue, appendIcon: IconValue, fluid: Boolean, diff --git a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx index 7ad9107b5ce..d552cb597bb 100644 --- a/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx +++ b/packages/vuetify/src/components/VList/__tests__/VListGroup.spec.browser.tsx @@ -105,4 +105,52 @@ describe('VListGroup', () => { expect(opened.value).toStrictEqual(['Users']) expect(screen.getByCSS('.v-list-group__items')).toBeVisible() }) + + it('should correctly set v-model:opened when return-object is applied', async () => { + const opened: Ref = ref([]) + const items: Ref = ref([ + { + title: 'Item #1', + newValue: 1, + children: [ + { + title: 'Child 1', + newValue: 100, + }, + ], + }, + { + title: 'Item #2', + newValue: 2, + }, + { + title: 'Item #3', + newValue: 3, + }, + ]) + render(() => ( + + + )) + + expect(opened.value).toStrictEqual([]) + + await userEvent.click(screen.getByCSS('.v-list-group__header')) + + expect(opened.value).toStrictEqual([{ + title: 'Item #1', + newValue: 1, + children: [ + { + title: 'Child 1', + newValue: 100, + }, + ], + }]) + }) }) From ce97843ddf1d418ac40136c99e3898299293c42c Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 23 Oct 2024 22:07:47 +1100 Subject: [PATCH 06/12] chore: refactor solution --- packages/api-generator/src/locale/en/VListGroup.json | 1 + packages/vuetify/src/components/VList/VListChildren.tsx | 2 +- packages/vuetify/src/components/VList/VListGroup.tsx | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/api-generator/src/locale/en/VListGroup.json b/packages/api-generator/src/locale/en/VListGroup.json index 798eb02ee5a..2eba5483c54 100644 --- a/packages/api-generator/src/locale/en/VListGroup.json +++ b/packages/api-generator/src/locale/en/VListGroup.json @@ -6,6 +6,7 @@ "group": "Assign a route namespace. Accepts a string or regexp for determining active state.", "noAction": "Removes left padding assigned for action icons from group items.", "prependIcon": "Prepends an icon to the component, uses the same syntax as `v-icon`.", + "rawId": "Defines the root element's id attribute in the component. If it is provided, the id attribute will be dynamically generated in the format: \"v-list-group--id-[rawId]\".", "subgroup": "Designate the component as nested list group.", "value": "Expands / Collapse the list-group." }, diff --git a/packages/vuetify/src/components/VList/VListChildren.tsx b/packages/vuetify/src/components/VList/VListChildren.tsx index 0c0b102e9fe..86019f58ccd 100644 --- a/packages/vuetify/src/components/VList/VListChildren.tsx +++ b/packages/vuetify/src/components/VList/VListChildren.tsx @@ -69,7 +69,7 @@ export const VListChildren = genericComponent( {{ activator: ({ props: activatorProps }) => { diff --git a/packages/vuetify/src/components/VList/VListGroup.tsx b/packages/vuetify/src/components/VList/VListGroup.tsx index 702ea2334e3..048be4634ee 100644 --- a/packages/vuetify/src/components/VList/VListGroup.tsx +++ b/packages/vuetify/src/components/VList/VListGroup.tsx @@ -43,7 +43,7 @@ export const makeVListGroupProps = propsFactory({ type: IconValue, default: '$expand', }, - id: [String, Number], + rawId: [String, Number], prependIcon: IconValue, appendIcon: IconValue, fluid: Boolean, @@ -62,7 +62,7 @@ export const VListGroup = genericComponent()({ setup (props, { slots }) { const { isOpen, open, id: _id } = useNestedItem(toRef(props, 'value'), true) - const id = computed(() => `v-list-group--id-${String(props.id ?? _id.value)}`) + const id = computed(() => `v-list-group--id-${String(props.rawId ?? _id.value)}`) const list = useList() const { isBooted } = useSsrBoot() From b643e89cbf55aedd4b648e63b6bc624a5754c513 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 23 Oct 2024 22:19:18 +1100 Subject: [PATCH 07/12] chore: apply to treeview --- packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx index 89a88fdfc7c..8ed0f58fc53 100644 --- a/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx +++ b/packages/vuetify/src/labs/VTreeview/VTreeviewChildren.tsx @@ -129,6 +129,7 @@ export const VTreeviewChildren = genericComponent {{ activator: ({ props: activatorProps }) => { From 6528d3b077da4e0070699e5814eb1102bb3dd78e Mon Sep 17 00:00:00 2001 From: Kael Date: Wed, 22 Jan 2025 20:25:28 +1100 Subject: [PATCH 08/12] docs: no more nazi shit --- packages/docs/src/components/about/TeamMember.vue | 9 --------- packages/docs/src/components/app/bar/EcosystemMenu.vue | 5 ----- packages/docs/src/components/home/Footer.vue | 5 ----- packages/docs/src/data/team.json | 7 ------- packages/docs/src/i18n/messages/en.json | 4 +--- packages/docs/src/stores/team.ts | 1 - 6 files changed, 1 insertion(+), 30 deletions(-) diff --git a/packages/docs/src/components/about/TeamMember.vue b/packages/docs/src/components/about/TeamMember.vue index 2884e44a483..1a06a7c93aa 100644 --- a/packages/docs/src/components/about/TeamMember.vue +++ b/packages/docs/src/components/about/TeamMember.vue @@ -169,15 +169,6 @@ const links = computed(() => { const links = [] - if (props.member.twitter) { - links.push({ - color: '#212121', - href: `https://x.com/${props.member.twitter}`, - icon: '$x', - tooltip: 'Xitter', - }) - } - if (props.member.github) { links.push({ color: '#24292E', diff --git a/packages/docs/src/components/app/bar/EcosystemMenu.vue b/packages/docs/src/components/app/bar/EcosystemMenu.vue index 5f46fd9d7ae..eb6eab7d40e 100644 --- a/packages/docs/src/components/app/bar/EcosystemMenu.vue +++ b/packages/docs/src/components/app/bar/EcosystemMenu.vue @@ -16,11 +16,6 @@ const { t } = useI18n() const items = computed(() => ([ { subheader: t('social') }, - { - title: 'X', - href: 'https://x.com/vuetifyjs', - appendIcon: '$x', - }, { title: 'Discord', href: 'https://community.vuetifyjs.com/', diff --git a/packages/docs/src/components/home/Footer.vue b/packages/docs/src/components/home/Footer.vue index 6701cceb749..e8b3c601649 100644 --- a/packages/docs/src/components/home/Footer.vue +++ b/packages/docs/src/components/home/Footer.vue @@ -109,11 +109,6 @@ href: 'https://github.com/vuetifyjs/vuetify', title: 'github', }, - { - icon: '$x', - href: 'https://x.com/vuetifyjs', - title: 'x', - }, { icon: 'mdi-discord', href: 'https://community.vuetifyjs.com', diff --git a/packages/docs/src/data/team.json b/packages/docs/src/data/team.json index 294163b331d..ba6bfeaf6a4 100644 --- a/packages/docs/src/data/team.json +++ b/packages/docs/src/data/team.json @@ -16,7 +16,6 @@ "location": "Keller, TX, USA", "name": "John Leider", "team": "company", - "twitter": "zeroskillz", "work": "Engineer @ Vuetify", "joined": "Jun 2016" }, @@ -31,7 +30,6 @@ "location": "Keller, TX, USA", "name": "Heather Leider", "team": "company", - "twitter": "grneyedgrl01", "work": "COO @ Vuetify", "joined": "Nov 2019" }, @@ -83,7 +81,6 @@ "location": "Rochester, NY, USA", "name": "Andrew Henry", "team": "core", - "twitter": "SeeMWhyK", "joined": "Dec 2018" }, "blalan05": { @@ -127,7 +124,6 @@ ], "location": "Madrid, Spain", "name": "Joaquín Sánchez", - "twitter": "userquin", "team": "core", "joined": "Mar 2024" }, @@ -148,7 +144,6 @@ "location": "California, US", "name": "Ken Kieu", "team": "core", - "twitter": "kieuminhcanh", "joined": "April 2024" }, "MatthewAry": { @@ -161,7 +156,6 @@ ], "location": "Spokane, WA, USA", "name": "Matthew Ary", - "twitter": "MatthewAry", "linkedin": "matthewary", "work": "Director of Product Development at Symplsoft Inc.", "team": "core", @@ -244,7 +238,6 @@ "English", "Persian" ], - "twitter": "yooneskh", "linkedin": "yooneskh ", "location": "Iran", "name": "Yoones Khoshghadam", diff --git a/packages/docs/src/i18n/messages/en.json b/packages/docs/src/i18n/messages/en.json index 045129a726d..901cfd53b1a 100644 --- a/packages/docs/src/i18n/messages/en.json +++ b/packages/docs/src/i18n/messages/en.json @@ -343,7 +343,6 @@ "translations": "Translations", "type": "Type | Types", "types": "Types", - "twitter": "Twitter", "ui-components": "UI Components", "ui-kits": "UI Kits", "ui": "UI", @@ -358,6 +357,5 @@ "view-in-github": "View on GitHub", "view-source": "View source", "viewport": "Viewport", - "vuetify": "Vuetify", - "x": "Xitter" + "vuetify": "Vuetify" } diff --git a/packages/docs/src/stores/team.ts b/packages/docs/src/stores/team.ts index 68f9d879fd4..4d848b98c94 100644 --- a/packages/docs/src/stores/team.ts +++ b/packages/docs/src/stores/team.ts @@ -16,7 +16,6 @@ export type Member = { avatar?: string github?: string team: string - twitter?: string joined?: string } From 3aadd4a09fd5819a72136fdca1c3e0319951a693 Mon Sep 17 00:00:00 2001 From: SonTT19 <49301480+SonTT19@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:58:04 +0700 Subject: [PATCH 09/12] docs(dates): fix usage example (#20907) fixes #20216 --- packages/docs/src/pages/en/features/dates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/pages/en/features/dates.md b/packages/docs/src/pages/en/features/dates.md index 41e95852a3e..46db9186c0c 100644 --- a/packages/docs/src/pages/en/features/dates.md +++ b/packages/docs/src/pages/en/features/dates.md @@ -37,7 +37,7 @@ Within your application, import the **useDate** function and use it to access th const date = useDate() - console.log(date.getMonth(new Date('March 1, 2021'))) // 3 + console.log(date.getMonth(new Date('March 1, 2021'))) // 2 ``` From bceadbea7e6db0c284c3c7a6733f9e08e8e47a56 Mon Sep 17 00:00:00 2001 From: PHorwat Date: Thu, 23 Jan 2025 07:07:31 +0100 Subject: [PATCH 10/12] docs(VRating): remove onClick from v-rating item slot props (#20901) --- packages/docs/src/examples/v-rating/slot-item.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/docs/src/examples/v-rating/slot-item.vue b/packages/docs/src/examples/v-rating/slot-item.vue index 5f18e056170..7607eb9aa90 100644 --- a/packages/docs/src/examples/v-rating/slot-item.vue +++ b/packages/docs/src/examples/v-rating/slot-item.vue @@ -5,7 +5,6 @@ {{ props.isFilled ? 'mdi-star-circle' : 'mdi-star-circle-outline' }} From 117423b00b25f81dfd480fdaa0777a55b884fd50 Mon Sep 17 00:00:00 2001 From: Kael Date: Thu, 23 Jan 2025 20:37:08 +1100 Subject: [PATCH 11/12] fix(VDataTable): apply fixed-header when sticky prop is set fixes #20903 --- .../src/locale/en/VDataTableHeaders.json | 3 ++- .../vuetify/src/components/VDataTable/VDataTable.tsx | 1 + .../src/components/VDataTable/VDataTableHeaders.tsx | 11 +++++++---- .../src/components/VDataTable/VDataTableServer.tsx | 2 +- .../src/components/VDataTable/VDataTableVirtual.tsx | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/api-generator/src/locale/en/VDataTableHeaders.json b/packages/api-generator/src/locale/en/VDataTableHeaders.json index 1ee8ca567be..8abf879cf07 100644 --- a/packages/api-generator/src/locale/en/VDataTableHeaders.json +++ b/packages/api-generator/src/locale/en/VDataTableHeaders.json @@ -3,7 +3,8 @@ "disableSort": "Toggles rendering of sort button.", "sortAscIcon": "Icon used for ascending sort button.", "sortDescIcon": "Icon used for descending sort button.", - "sticky": "Sticks the header to the top of the table." + "sticky": "Deprecated, use `fixed-header` instead.", + "fixedHeader": "Sticks the header to the top of the table." }, "slots": { "[`column.${string}`]": "Slot for custom rendering of a column.", diff --git a/packages/vuetify/src/components/VDataTable/VDataTable.tsx b/packages/vuetify/src/components/VDataTable/VDataTable.tsx index 7bc7b28a138..b7e3b5763ac 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTable.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTable.tsx @@ -238,6 +238,7 @@ export const VDataTable = genericComponent( ]} style={ props.style } { ...tableProps } + fixedHeader={ props.fixedHeader || props.sticky } > {{ top: () => slots.top?.(slotProps.value), diff --git a/packages/vuetify/src/components/VDataTable/VDataTableHeaders.tsx b/packages/vuetify/src/components/VDataTable/VDataTableHeaders.tsx index 0702a348976..d985b97b43d 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTableHeaders.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTableHeaders.tsx @@ -59,8 +59,8 @@ export type VDataTableHeadersSlots = { export const makeVDataTableHeadersProps = propsFactory({ color: String, - sticky: Boolean, disableSort: Boolean, + fixedHeader: Boolean, multiSort: Boolean, sortAscIcon: { type: IconValue, @@ -74,6 +74,9 @@ export const makeVDataTableHeadersProps = propsFactory({ type: Object as PropType>, }, + /** @deprecated */ + sticky: Boolean, + ...makeDisplayProps(), ...makeLoaderProps(), }, 'VDataTableHeaders') @@ -91,12 +94,12 @@ export const VDataTableHeaders = genericComponent()({ const { loaderClasses } = useLoader(props) function getFixedStyles (column: InternalDataTableHeader, y: number): CSSProperties | undefined { - if (!props.sticky && !column.fixed) return undefined + if (!(props.sticky || props.fixedHeader) && !column.fixed) return undefined return { position: 'sticky', left: column.fixed ? convertToUnit(column.fixedOffset) : undefined, - top: props.sticky ? `calc(var(--v-table-header-height) * ${y})` : undefined, + top: (props.sticky || props.fixedHeader) ? `calc(var(--v-table-header-height) * ${y})` : undefined, } } @@ -127,7 +130,7 @@ export const VDataTableHeaders = genericComponent()({ const headerCellClasses = computed(() => ([ 'v-data-table__th', { - 'v-data-table__th--sticky': props.sticky, + 'v-data-table__th--sticky': (props.sticky || props.fixedHeader), }, displayClasses.value, loaderClasses.value, diff --git a/packages/vuetify/src/components/VDataTable/VDataTableServer.tsx b/packages/vuetify/src/components/VDataTable/VDataTableServer.tsx index 13005194dc3..9774a021304 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTableServer.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTableServer.tsx @@ -160,6 +160,7 @@ export const VDataTableServer = genericComponent {{ top: () => slots.top?.(slotProps.value), @@ -170,7 +171,6 @@ export const VDataTableServer = genericComponent diff --git a/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx b/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx index b2714f7b0d7..58b47b23731 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx @@ -189,6 +189,7 @@ export const VDataTableVirtual = genericComponent {{ top: () => slots.top?.(slotProps.value), @@ -208,7 +209,6 @@ export const VDataTableVirtual = genericComponent From 5b4788ba0473dc27bb83755087885f191e854d78 Mon Sep 17 00:00:00 2001 From: Kael Date: Thu, 23 Jan 2025 21:04:15 +1100 Subject: [PATCH 12/12] fix(VSlider): update value before focusing thumb fixes #20912 --- packages/vuetify/src/components/VSlider/slider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vuetify/src/components/VSlider/slider.ts b/packages/vuetify/src/components/VSlider/slider.ts index 56418e727a5..cc5133f1943 100644 --- a/packages/vuetify/src/components/VSlider/slider.ts +++ b/packages/vuetify/src/components/VSlider/slider.ts @@ -5,7 +5,7 @@ import { useRtl } from '@/composables/locale' import { makeRoundedProps } from '@/composables/rounded' // Utilities -import { computed, provide, ref, shallowRef, toRef } from 'vue' +import { computed, nextTick, provide, ref, shallowRef, toRef } from 'vue' import { clamp, createRange, getDecimals, propsFactory } from '@/util' // Types @@ -237,7 +237,6 @@ export const useSlider = ({ if (!activeThumbRef.value) return - activeThumbRef.value.focus() mousePressed.value = true if (activeThumbRef.value.contains(e.target as Node)) { @@ -248,6 +247,7 @@ export const useSlider = ({ } onSliderStart({ value: parseMouseMove(e) }) + nextTick(() => activeThumbRef.value?.focus()) } const moveListenerOptions = { passive: true, capture: true }