Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VTreeview): port open-on-click prop to v3 & enhancement #20038

Merged
merged 14 commits into from
Jul 9, 2024
Merged
Prev Previous commit
Next Next commit
chore: refactor & comprehensive cy tests
  • Loading branch information
yuwu9145 committed Jul 5, 2024
commit a720033fac099dd3a063b9478fb8e0dc229c6f3d
6 changes: 3 additions & 3 deletions packages/vuetify/src/composables/nested/nested.ts
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ export const useNested = (props: NestedProps) => {
const children = ref(new Map<unknown, unknown[]>())
const parents = ref(new Map<unknown, unknown>())

const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(toRaw(v)), v => [...v.values()])
const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])

const activeStrategy = computed(() => {
if (typeof props.activeStrategy === 'object') return props.activeStrategy
@@ -307,9 +307,9 @@ export const useNestedItem = (id: Ref<unknown>, isGroup: boolean) => {
const item = {
...parent,
id: computedId,
open: (open: boolean, e: Event) => parent.root.open(toRaw(computedId.value), open, e),
open: (open: boolean, e: Event) => parent.root.open(computedId.value, open, e),
openOnSelect: (open: boolean, e?: Event) => parent.root.openOnSelect(computedId.value, open, e),
isOpen: computed(() => parent.root.opened.value.has(toRaw(computedId.value))),
isOpen: computed(() => parent.root.opened.value.has(computedId.value)),
parent: computed(() => parent.root.parents.value.get(computedId.value)),
activate: (activated: boolean, e?: Event) => parent.root.activate(computedId.value, activated, e),
isActivated: computed(() => parent.root.activated.value.has(toRaw(computedId.value))),
2 changes: 1 addition & 1 deletion packages/vuetify/src/labs/VTreeview/VTreeview.tsx
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ export const makeVTreeviewProps = propsFactory({
collapseIcon: '$treeviewCollapse',
expandIcon: '$treeviewExpand',
slim: true,
}), ['nav']),
}), ['nav', 'openStrategy']),
}, 'VTreeview')

export const VTreeview = genericComponent<new <T>(
Loading