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/tree view improvements #2840

Merged
merged 29 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5333b46
feat: add separate click for node and leaf icon
rustem-nasyrov Nov 14, 2022
b684e8b
feat: add selected node emit
rustem-nasyrov Nov 14, 2022
7132791
feat: add descriptions and translations
rustem-nasyrov Nov 15, 2022
25d580d
refactor: move colored checkboxes to the separate demo
rustem-nasyrov Nov 15, 2022
74f804e
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Nov 30, 2022
d2ff089
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Dec 2, 2022
90cd7e3
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Dec 5, 2022
0ba5b85
feat: add keyboard navigation composable
rustem-nasyrov Dec 5, 2022
8feffc3
feat: integrate keyboard navigation
rustem-nasyrov Dec 5, 2022
a8bc313
refactor: update vertical navigation function
rustem-nasyrov Dec 6, 2022
1259df8
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Jan 2, 2023
443f695
feat: add keyboard navigation demos
rustem-nasyrov Jan 2, 2023
723b07d
feat: update keyboard navigation
rustem-nasyrov Jan 3, 2023
bda4461
refactor: remove rudendant variable
rustem-nasyrov Jan 3, 2023
af50f88
feat: keyboard navigation basic
rustem-nasyrov Jan 4, 2023
8719a8a
feat: keyboard navigation down
rustem-nasyrov Jan 4, 2023
ac2ebd5
feat: keyboard navigation up
rustem-nasyrov Jan 4, 2023
f0ebc9e
refactor: remove unused functions
rustem-nasyrov Jan 4, 2023
d94a8db
feat: add demo variant
rustem-nasyrov Jan 4, 2023
ac8bcfb
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Jan 4, 2023
b573dd9
refactor: add titles
rustem-nasyrov Jan 5, 2023
c5c4f22
feat: add keyboard selection
rustem-nasyrov Jan 5, 2023
41eaeeb
feat: add selection and checkboxes keyboard demos
rustem-nasyrov Jan 5, 2023
5eb6765
feat: support escaping focus
rustem-nasyrov Jan 5, 2023
2c9371f
fix: handle null value
rustem-nasyrov Jan 5, 2023
3060317
Merge branch 'develop' into feat/tree-view-improvements
rustem-nasyrov Jan 10, 2023
1064349
refactor: review suggestions
rustem-nasyrov Jan 10, 2023
b1659aa
refactor: remove curly braces
rustem-nasyrov Jan 10, 2023
4e47911
refactor: review suggestions
rustem-nasyrov Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/docs/src/locales/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,8 @@
"checked": "Array of pre-selected tree nodes.",
"checkedBy": "The key to set the checked field in the tree view model.",
"color": "The checkboxes color.",
"expanded": "Array of pre-expanded tree nodes."
"expanded": "Array of pre-expanded tree nodes.",
"expandNodeBy": "Click target to expand node, can be `node` or `leaf` icon."
},
"slots": {
"notFound": "No matching nodes to the filter message.",
Expand Down Expand Up @@ -4654,7 +4655,8 @@
"title": "Filters"
},
"selectable": {
"title": "Selectable"
"title": "Selectable",
"coloredTitle": "Colored checkboxes"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions packages/docs/src/locales/ru/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,8 @@
"checked": "Массив пред-выбранных элементов дерева.",
"checkedBy": "Ключ для установки поля значения чекбокса в модели компонента.",
"color": "Цвет чекбоксов.",
"expanded": "Массив пред-раскрытых элементов дерева"
"expanded": "Массив пред-раскрытых элементов дерева",
"expandNodeBy": "Место клика, по которому будет раскрываться элемент дерева, может быть `node` или `leaf`."
},
"slots": {
"notFound": "Сообщение о не найденных соответствующих фильтру элементов дерева.",
Expand Down Expand Up @@ -4387,7 +4388,8 @@
"title": "Фильтры"
},
"selectable": {
"title": "Чекбоксы"
"title": "Чекбоксы",
"coloredTitle": "Цветные чекбоксы"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,22 @@
<va-tree-view
v-model:checked="selectedNodes"
:nodes="nodes"
:color="selectedColor"
selectable
expand-all
/>

<p class="mt-4">
Selected nodes: {{ selectedNodes.join(',') || 'none' }}
</p>

<p class="d-flex align-center">
Color:
<va-color-palette
v-model="selectedColor"
class="ml-2"
:palette="colorsPalette"
/>
</p>
</template>

<script>
const COLORS_PALETTE = [
'#4ae387',
'#e34a4a',
'#4ab2e3',
'#db76df',
'#f7cc36',
'#f3f3f3',
'#000',
]

export default {
name: 'Default',

data: () => ({
selectedNodes: [],
colorsPalette: COLORS_PALETTE,
selectedColor: COLORS_PALETTE[0],
nodes: [
{
id: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<template>
<p class="d-flex align-center">
Color:
<va-color-palette
v-model="selectedColor"
class="ml-2"
:palette="colorsPalette"
/>
</p>

<va-tree-view
:nodes="nodes"
v-model:checked="selectedNodes"
:color="selectedColor"
selectable
expand-all
/>
</template>

<script>
const COLORS_PALETTE = [
'#4ae387',
'#e34a4a',
'#4ab2e3',
'#db76df',
'#f7cc36',
'#f3f3f3',
'#000',
]

export default {
name: 'SelectableColored',
data: () => ({
selectedNodes: [1, 2, 3, 4, 5, 6],
colorsPalette: COLORS_PALETTE,
selectedColor: COLORS_PALETTE[0],
nodes: [
{
id: 1,
label: 'Category',
checked: true,
children: [
{
id: 2,
label: 'Subcategory',
children: [
{ id: 3, label: 'Item' },
{ id: 4, label: 'Item' },
],
},
{
id: 5,
label: 'Subcategory',
children: [
{ id: 6, label: 'Item' },
],
},
],
},
{
id: 7,
label: 'Category',
children: [
{ id: 8, label: 'Item' },
],
},
{
id: 9,
label: 'Category',
children: [
{ id: 10, label: 'Item' },
],
},
{
id: 11,
label: 'Item',
},
],
}),
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const config: ApiDocsBlock[] = [
// Selectable
block.subtitle('treeView.examples.selectable.title'),
block.example('Selectable'),
block.subtitle('treeView.examples.selectable.coloredTitle'),
block.example('SelectableColored'),

// API
block.subtitle('api'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<template>
<VbDemo>
<VbCard title="Flat-like navigation">
<va-tree-view :nodes="flat" />
</VbCard>
<VbCard title="Stair-like navigation">
<va-tree-view :nodes="stairs" />
</VbCard>
<VbCard title="Triangle-like navigation">
<va-tree-view :nodes="triangle" />
</VbCard>
<VbCard title="Waves-like navigation">
<va-tree-view :nodes="waves" />
</VbCard>
<VbCard title="Selection">
Selected node: {{selectedNode}}
<br />
<va-tree-view
:nodes="triangle"
@update:selected="onSelectNode"
expand-all
/>
</VbCard>
<VbCard title="Checkboxes selection">
Checked nodes: {{checkedNodes}}
<br />
<va-tree-view
v-model:checked="checkedNodes"
:nodes="triangle"
selectable
expand-all
/>
</VbCard>
</VbDemo>
</template>

<script>
import VaTreeView from './VaTreeView.vue'

export default {
name: 'VaTreeViewKeyboardNavigation.demo',

components: {
VaTreeView,
},

data: () => ({
selectedNode: null,
checkedNodes: [],
flat: [
{
id: 1,
label: 'Item',
},
{
id: 2,
label: 'Item',
},
{
id: 3,
label: 'Item',
},
],
stairs: [
{
id: 1,
label: 'Item',
children: [
{
id: 2,
label: 'Item',
children: [
{
id: 3,
label: 'Item',
children: [
{
id: 4,
label: 'Item',
},
],
},
],
},
],
},
{
id: 5,
label: 'Item',
children: [
{
id: 6,
label: 'Item',
children: [
{
id: 7,
label: 'Item',
children: [
{
id: 8,
label: 'Item',
},
],
},
],
},
],
},
],
triangle: [
{
id: 1,
label: 'Item',
children: [
{
id: 2,
label: 'Item',
children: [
{
id: 3,
label: 'Item',
},
{
id: 4,
label: 'Item',
},
],
},
{
id: 5,
label: 'Item',
},
],
},
{
id: 6,
label: 'Item',
},
],
waves: [
{
id: 1,
label: 'Item',
},
{
id: 2,
label: 'Item',
children: [
{
id: 3,
label: 'Item',
},
],
},
{
id: 4,
label: 'Item',
children: [
{
id: 5,
label: 'Item',
},
],
},
{
id: 6,
label: 'Item',
children: [
{
id: 6,
label: 'Item',
},
],
},
{
id: 7,
label: 'Item',
},
],
}),

methods: {
onSelectNode (node) {
this.selectedNode = node ? `${node.id} ${node.label}` : null
},
},
}
</script>
Loading