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

Add babel and IE11 support #30

Merged
merged 1 commit into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,16 @@ interface ICursorPosition<TDataType> {
| draginfo | SlVueTree | Slot that follows the mouse cursor while dragging. By default shows the dragging nodes count. |
| empty-node | ISlTreeNode | Slot for (optional) message when folder is open, but empty |

# IE 11 support

## Example:
You must add a [babel-polifyl](https://babeljs.io/docs/en/babel-polyfill) for correct work in IE11
[See IE11 example]([demo](https://holiber.github.io/sl-vue-tree/demo/ie11test.html))

add a folder or item icon via `title` slot

# Examples


## Add a folder or item icon via `title` slot
````html
<sl-vue-tree v-model="nodes">
<template slot="title" slot-scope="{ node }">
Expand All @@ -172,18 +178,15 @@ add a folder or item icon via `title` slot

````

## Example:
select all nodes
## Select all nodes

```javascript
slVueTree.traverse((node, nodeModel, path) => {
Vue.set(nodeModel, 'isSelected', true);
})
```

## Example:

handle keydow and keyup events via `getNextNode` and `getPrevNode` methods
## Handle keydow and keyup events via `getNextNode` and `getPrevNode` methods

[demo](https://holiber.github.io/sl-vue-tree/demo/keyboardcontrol)

Expand Down
2 changes: 1 addition & 1 deletion demo/dark-theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,4 @@ <h2> Sl-vue-tree - custom dark theme and events handlers</h2>
</style>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion demo/externaldrag.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ <h2> Sl-vue-tree - drag external elements</h2>
</style>

</body>
</html>
</html>
118 changes: 118 additions & 0 deletions demo/ie11test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>sl-vue-tree</title>
<link rel="stylesheet" href="../dist/sl-vue-tree-dark.css">
<link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
<script src="./polyfill.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="../dist/sl-vue-tree.js"></script>
</head>
<body>

<div id="app"
>

<h2> Sl-vue-tree - IE11-friendly code</h2>


<div class="row">
<div class="tree-container">
<sl-vue-tree
v-model="nodes"
ref="slVueTree"
>
</sl-vue-tree>
</div>


<div class="json-preview">
<pre>{{ JSON.stringify(nodes, null, 4)}}</pre>
</div>

</div>


</div>

<script>

var nodes = [
{title: 'Item1', isLeaf: true},
{title: 'Item2', isLeaf: true},
{
title: 'Folder1', isExpanded: false, children: [
{title: 'Item3', isLeaf: true},
{title: 'Item4', isLeaf: true},
{
title: 'Folder2', children: [
{title: 'Item5', isLeaf: true}
]
}
]
},
{title: 'Item6', isLeaf: true}
];

new Vue({
el: '#app',
components: { SlVueTree: SlVueTree },
data: function () {
return {
nodes: nodes
}
},


})
</script>

<style>

body {
background: #050d12;
font-family: Arial;
color: rgba(255, 255, 255, 0.5);
}

a {
color: #bbb;
}

.row {
display: flex;
margin-bottom: 10px;
}

.tree-container {
flex-grow: 1;
}

.sl-vue-tree.sl-vue-tree-root {
flex-grow: 1;
overflow-x: hidden;
overflow-y: auto;
height: 300px;
}


.json-preview {
flex-grow: 1;
margin-left: 10px;
background-color: #13242d;
border: 1px solid black;
padding: 10px;
}

.item-icon {
display: inline-block;
text-align: left;
width: 20px;
}


</style>

</body>
</html>
Loading