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): update component to v3 #14715

Closed
wants to merge 12 commits into from
Closed

feat(VTreeview): update component to v3 #14715

wants to merge 12 commits into from

Conversation

nekosaur
Copy link
Member

@nekosaur nekosaur commented Feb 13, 2022

Description

Update v-treeview to v3

BREAKING CHANGES

  • no longer supports "active" state. activatable, active, active-class, multiple-active props are gone
  • color renamed to selected-color
  • dense removed. use density
  • filter prop removed. use props from filter composable
  • hover renamed to hoverable
  • load-children removed. use events like click:open to dynamically load children
  • open-all renamed to open-on-mount. takes strings all and root instead of boolean
  • selectable renamed to showSelect
  • shaped removed

Motivation and Context

How Has This Been Tested?

Markup:

<template>
  <v-app full-height>
    <v-list :items="items" />

    <v-divider class="my-10" />

    <v-treeview :items="items" />

    <v-divider class="my-10" />
    compact

    <v-treeview :items="items" density="compact" @click:expand="foo" />

    <v-divider class="my-10" />

    comfortable

    <v-treeview :items="items" density="comfortable" />

    <v-divider class="my-10" />

    <v-treeview select-on-click>
      <v-treeview-group>
        <template #activator="{ props }">
          <v-treeview-item v-bind="props" title="Parent" />
        </template>
        <v-treeview-item title="Child #1" />
        <v-treeview-item title="Child #2" />
        <v-treeview-group>
          <template #activator="{ props }">
            <v-treeview-item v-bind="props" title="Child #3" />
          </template>
          <v-treeview-item title="Child #3-1" />
        </v-treeview-group>
      </v-treeview-group>
    </v-treeview>
  </v-app>
</template>

<script>
  import { ref } from 'vue'

  export default {
    setup () {
      const items = ref([
        {
          value: 'parent',
          title: 'Parent',
          $children: [
            {
              value: 'child_1',
              title: 'Child #1',
            },
            {
              value: 'child_2',
              title: 'Child #2',
              prependIcon: 'mdi-home',
            },
            {
              value: 'child_3',
              title: 'Child #3',
              $children: [],
            },
          ],
        },
      ])

      const getItem = path => {
        let arr = items.value

        for (const p of path) {
          const item = arr.find(v => v.value === p)

          if (!item) throw new Error('foo')

          if (item.value === path[path.length - 1]) return item

          if (!item.$children) throw new Error('foo')

          arr = item.$children
        }
      }

      return {
        foo: ({ id, value, path }) => {
          const item = getItem(path)

          if (item.$children.length > 0) return

          item.loading = true

          setTimeout(() => {
            item.loading = false

            item.$children = [
              {
                value: 'child_3_1',
                title: 'Child #3-1',
              },
            ]
          }, 1000)
        },
        items,
      }
    },
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

@nekosaur nekosaur changed the base branch from master to next February 13, 2022 13:04
@nekosaur nekosaur changed the title Feat/v3 treeview feat/v3-treeview Feb 13, 2022
@nekosaur nekosaur force-pushed the feat/v3-treeview branch 4 times, most recently from 6f5940c to 00baf1a Compare April 9, 2022 17:23
@nekosaur nekosaur changed the title feat/v3-treeview feat(VTreeview): update component to v3 Apr 17, 2022
@KaelWD KaelWD mentioned this pull request Jun 2, 2022
87 tasks
@KaelWD KaelWD force-pushed the next branch 3 times, most recently from bd54e69 to 6c34ccb Compare June 6, 2022 19:13
@KaelWD KaelWD added this to the v3.1.0 milestone Aug 10, 2022
@KaelWD KaelWD mentioned this pull request Aug 10, 2022
@buzzhr
Copy link

buzzhr commented Nov 27, 2022

Is it possible release VTreeView with in 2 weeks? It is really a very common component.

@abumalekFayed
Copy link

What about this component is it will released in in 3.3 version?

@KaelWD KaelWD modified the milestones: v3.2.x, v3.3.x May 16, 2023
@MajesticPotatoe MajesticPotatoe added T: feature A new feature C: VTreeview VTreeview labels Aug 14, 2023
@KaelWD KaelWD modified the milestones: v3.3.x, v3.x.x Nov 3, 2023
@johnleider johnleider closed this Jan 24, 2024
@johnleider johnleider removed this from the v3.x.x milestone Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VTreeview VTreeview T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants