forked from epicmaxco/vuestic-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
7,166 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ node_modules/ | |
dist/ | ||
npm-debug.log | ||
package-lock.json | ||
/yarn-error.log | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<template> | ||
<div class="sets-list row"> | ||
<div class="col-md-12"> | ||
<div class="row"> | ||
|
||
<div class="small-set col-lg-6"> | ||
<vuestic-widget :headerText="$t('treeView.basic')"> | ||
<div class="set-content"> | ||
<div class="overlay"> | ||
<vuestic-tree-view | ||
:options="treeViewData.basic" | ||
> | ||
</vuestic-tree-view> | ||
</div> | ||
</div> | ||
</vuestic-widget> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import VuesticTreeView | ||
from '../../../vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeView.vue' | ||
import VuesticWidget | ||
from '../../../vuestic-theme/vuestic-components/vuestic-widget/VuesticWidget.vue' | ||
import VuesticTreeNode | ||
from '../../../vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeNode' | ||
import VuesticTreeNodeCategory | ||
from '../../../vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeNodeCategory' | ||
export default { | ||
name: 'tree-view', | ||
components: { | ||
VuesticTreeView, | ||
VuesticWidget | ||
}, | ||
data () { | ||
return { | ||
treeViewData: { | ||
basic: [ | ||
new VuesticTreeNodeCategory({ | ||
data: 'Products', | ||
children: [ | ||
new VuesticTreeNode({ | ||
data: 'Product 1' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Product 2' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Product 3' | ||
}) | ||
] | ||
}), | ||
new VuesticTreeNodeCategory({ | ||
data: 'Electronics', | ||
open: true, | ||
children: [ | ||
new VuesticTreeNode({ | ||
data: 'Cellphones' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Camera Body Kits', | ||
selected: true | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'External HDDs' | ||
}) | ||
] | ||
}), | ||
new VuesticTreeNodeCategory({ | ||
data: 'Apparel', | ||
children: [ | ||
new VuesticTreeNode({ | ||
data: 'Apparel 1' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Apparel 2' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Apparel 3' | ||
}) | ||
] | ||
}), | ||
new VuesticTreeNodeCategory({ | ||
data: 'Furniture', | ||
children: [ | ||
new VuesticTreeNode({ | ||
data: 'Furniture 1' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Furniture 2' | ||
}), | ||
new VuesticTreeNode({ | ||
data: 'Furniture 3' | ||
}) | ||
] | ||
}) | ||
] | ||
}, | ||
treeViewDataSelected: { | ||
basic: [] | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeNode.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default class VuesticTreeNode { | ||
constructor (data) { | ||
/** | ||
* @type string | ||
*/ | ||
this.label = data.label || '' | ||
|
||
/** | ||
* @type boolean | ||
*/ | ||
|
||
this.selected = data.selected || false | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeNodeCategory.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export default class VuesticTreeNodeCategory { | ||
constructor (data) { | ||
/** | ||
* @type any | ||
*/ | ||
this.label = data.label || null | ||
|
||
/** | ||
* @type VuesticTreeNode[] | VuesticTreeNodeCategory[] | ||
*/ | ||
this.children = data.children || [] | ||
|
||
/** | ||
* @type boolean | ||
*/ | ||
this.isOpen = data.isOpen || false | ||
|
||
if (!this.children.length) { | ||
throw new Error('VuesticTreeNodeCategory should have at least one child') | ||
} | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
expand () { | ||
this.isOpen = true | ||
this.children.forEach(node => { | ||
if (node instanceof VuesticTreeNodeCategory) { | ||
node.expand() | ||
} | ||
}) | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
collapse () { | ||
this.isOpen = false | ||
this.children.forEach(node => { | ||
if (node instanceof VuesticTreeNodeCategory) { | ||
node.expand() | ||
} | ||
}) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/vuestic-theme/vuestic-components/vuestic-tree-view/VuesticTreeRoot.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import VuesticTreeNodeCategory from './VuesticTreeNodeCategory' | ||
|
||
export default class VuesticTreeRoot { | ||
constructor (nodes) { | ||
/** | ||
* @type VuesticTreeNode | VuesticTreeNodeCategory | ||
*/ | ||
this.nodes = nodes | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
collapse () { | ||
this.nodes.forEach(node => { | ||
if (node instanceof VuesticTreeNodeCategory) { | ||
node.collapse() | ||
} | ||
}) | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
expand () { | ||
this.nodes.forEach(node => { | ||
if (node instanceof VuesticTreeNodeCategory) { | ||
node.expand() | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.