Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
995cea4b0d | |||
440d2782a1 | |||
![]() |
7b677a6589 | ||
![]() |
a21f4b8adf | ||
![]() |
5b2fea32ad | ||
![]() |
347a927e90 | ||
![]() |
0f04f7edba |
@@ -1,2 +0,0 @@
|
|||||||
extends:
|
|
||||||
- "@commitlint/config-conventional"
|
|
23
.gitignore
vendored
23
.gitignore
vendored
@@ -21,3 +21,26 @@ yarn-error.log*
|
|||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
coverage
|
coverage
|
||||||
|
|
||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/yarn
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=yarn
|
||||||
|
|
||||||
|
### yarn ###
|
||||||
|
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
|
||||||
|
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
# if you are NOT using Zero-installs, then:
|
||||||
|
# comment the following lines
|
||||||
|
#!.yarn/cache
|
||||||
|
|
||||||
|
# and uncomment the following lines
|
||||||
|
.pnp.*
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/yarn
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
hooks:
|
|
||||||
pre-commit: npm run lint-staged
|
|
||||||
commit-msg: commitlint -E HUSKY_GIT_PARAMS
|
|
546
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
546
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
785
.yarn/releases/yarn-3.2.0.cjs
vendored
Executable file
785
.yarn/releases/yarn-3.2.0.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
7
.yarnrc.yml
Normal file
7
.yarnrc.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-3.2.0.cjs
|
15112
package-lock.json
generated
15112
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-tree-list",
|
"name": "vue-tree-list",
|
||||||
"version": "1.4.6",
|
"version": "1.5.0",
|
||||||
"description": "A vue component for tree structure. Support adding treenode/leafnode, editing node's name and dragging.",
|
"description": "A vue component for tree structure. Support adding treenode/leafnode, editing node's name and dragging.",
|
||||||
"author": "ayou",
|
"author": "ayou",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -10,11 +10,9 @@
|
|||||||
"test:coverage": "vue-cli-service test:unit --coverage",
|
"test:coverage": "vue-cli-service test:unit --coverage",
|
||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
"lint-staged": "lint-staged",
|
"lint-staged": "lint-staged",
|
||||||
"commit": "npx git-cz",
|
|
||||||
"prepublish": "npm run build"
|
"prepublish": "npm run build"
|
||||||
},
|
},
|
||||||
"main": "dist/vue-tree-list.umd.min.js",
|
"main": "dist/vue-tree-list.umd.min.js",
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "^4.1.0",
|
"@vue/cli-plugin-babel": "^4.1.0",
|
||||||
"@vue/cli-plugin-eslint": "^4.1.0",
|
"@vue/cli-plugin-eslint": "^4.1.0",
|
||||||
@@ -27,7 +25,6 @@
|
|||||||
"eslint-config-prettier": "^6.10.0",
|
"eslint-config-prettier": "^6.10.0",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-vue": "^5.0.0",
|
"eslint-plugin-vue": "^5.0.0",
|
||||||
"husky": "^4.2.1",
|
|
||||||
"jest-serializer-vue": "^2.0.2",
|
"jest-serializer-vue": "^2.0.2",
|
||||||
"less": "^3.10.3",
|
"less": "^3.10.3",
|
||||||
"less-loader": "^5.0.0",
|
"less-loader": "^5.0.0",
|
||||||
@@ -58,5 +55,6 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/ParadeTo/vue-tree-list.git"
|
"url": "git+https://github.com/ParadeTo/vue-tree-list.git"
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@3.2.0"
|
||||||
}
|
}
|
||||||
|
@@ -219,7 +219,7 @@ Or just register locally like the example below.
|
|||||||
|
|
||||||
| name | params | description |
|
| name | params | description |
|
||||||
| :---------: | :--------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
| :---------: | :--------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
||||||
| click | TreeNode | Trigger when clicking a tree node |
|
| click | TreeNode | Trigger when clicking a tree node. You can call `toggle` of `TreeNode` to toggle the folder node. |
|
||||||
| change-name | {'id', 'oldName', 'newName'} | Trigger after changing a node's name |
|
| change-name | {'id', 'oldName', 'newName'} | Trigger after changing a node's name |
|
||||||
| delete-node | TreeNode | Trigger when clicking `delNode` button. You can call `remove` of `TreeNode` to remove the node. |
|
| delete-node | TreeNode | Trigger when clicking `delNode` button. You can call `remove` of `TreeNode` to remove the node. |
|
||||||
| add-node | TreeNode | Trigger after adding a new node |
|
| add-node | TreeNode | Trigger after adding a new node |
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
/>
|
/>
|
||||||
<div class="vtl-operation" v-show="isHover">
|
<div class="vtl-operation" v-show="isHover">
|
||||||
<span
|
<span
|
||||||
title="add tree node"
|
:title="defaultAddTreeNodeTitle"
|
||||||
@click.stop.prevent="addChild(false)"
|
@click.stop.prevent="addChild(false)"
|
||||||
v-if="!model.isLeaf && !model.addTreeNodeDisabled"
|
v-if="!model.isLeaf && !model.addTreeNodeDisabled"
|
||||||
>
|
>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
title="add leaf node"
|
:title="defaultAddLeafNodeTitle"
|
||||||
@click.stop.prevent="addChild(true)"
|
@click.stop.prevent="addChild(true)"
|
||||||
v-if="!model.isLeaf && !model.addLeafNodeDisabled"
|
v-if="!model.isLeaf && !model.addLeafNodeDisabled"
|
||||||
>
|
>
|
||||||
@@ -162,11 +162,19 @@ export default {
|
|||||||
},
|
},
|
||||||
defaultLeafNodeName: {
|
defaultLeafNodeName: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'New leaf node'
|
default: 'Leaf Node'
|
||||||
},
|
},
|
||||||
defaultTreeNodeName: {
|
defaultTreeNodeName: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'New tree node'
|
default: 'Tree Node'
|
||||||
|
},
|
||||||
|
defaultAddTreeNodeTitle: {
|
||||||
|
type: String,
|
||||||
|
default: 'Add Tree Node'
|
||||||
|
},
|
||||||
|
defaultAddLeafNodeTitle: {
|
||||||
|
type: String,
|
||||||
|
default: 'Add Leaf Node'
|
||||||
},
|
},
|
||||||
defaultExpanded: {
|
defaultExpanded: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -272,7 +280,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
this.rootNode.$emit('click', this.model)
|
this.rootNode.$emit('click', {
|
||||||
|
toggle: this.toggle,
|
||||||
|
...this.model
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
addChild(isLeaf) {
|
addChild(isLeaf) {
|
||||||
|
@@ -47,7 +47,7 @@ exports[`Render render correctly 1`] = `
|
|||||||
<div class="vtl-node-content">
|
<div class="vtl-node-content">
|
||||||
Node 2
|
Node 2
|
||||||
</div>
|
</div>
|
||||||
<div class="vtl-operation" style="display: none;"><span title="add tree node"><i class="vtl-icon vtl-icon-folder-plus-e"></i></span> <span title="add leaf node"><i class="vtl-icon vtl-icon-plus"></i></span> <span title="edit"><i class="vtl-icon vtl-icon-edit"></i></span> <span title="delete"><i class="vtl-icon vtl-icon-trash"></i></span></div>
|
<div class="vtl-operation" style="display: none;"><span title="Add Tree Node"><i class="vtl-icon vtl-icon-folder-plus-e"></i></span> <span title="Add Leaf Node"><i class="vtl-icon vtl-icon-plus"></i></span> <span title="edit"><i class="vtl-icon vtl-icon-edit"></i></span> <span title="delete"><i class="vtl-icon vtl-icon-trash"></i></span></div>
|
||||||
</div>
|
</div>
|
||||||
<!---->
|
<!---->
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +61,7 @@ exports[`Render render correctly 1`] = `
|
|||||||
<div class="vtl-node-content">
|
<div class="vtl-node-content">
|
||||||
Node 3
|
Node 3
|
||||||
</div>
|
</div>
|
||||||
<div class="vtl-operation" style="display: none;"><span title="add tree node"><i class="vtl-icon vtl-icon-folder-plus-e"></i></span> <span title="add leaf node"><i class="vtl-icon vtl-icon-plus"></i></span> <span title="edit"><i class="vtl-icon vtl-icon-edit"></i></span> <span title="delete"><i class="vtl-icon vtl-icon-trash"></i></span></div>
|
<div class="vtl-operation" style="display: none;"><span title="Add Tree Node"><i class="vtl-icon vtl-icon-folder-plus-e"></i></span> <span title="Add Leaf Node"><i class="vtl-icon vtl-icon-plus"></i></span> <span title="edit"><i class="vtl-icon vtl-icon-edit"></i></span> <span title="delete"><i class="vtl-icon vtl-icon-trash"></i></span></div>
|
||||||
</div>
|
</div>
|
||||||
<!---->
|
<!---->
|
||||||
</div>
|
</div>
|
||||||
|
@@ -11,7 +11,7 @@ exports[`Slot render slot correctly 1`] = `
|
|||||||
<div class="vtl-node-content">
|
<div class="vtl-node-content">
|
||||||
Node 1
|
Node 1
|
||||||
</div>
|
</div>
|
||||||
<div class="vtl-operation" style="display: none;"><span title="add tree node"><span class="add-tree-node-icon">📂</span></span> <span title="add leaf node"><span class="icon">+</span></span> <span title="edit"><span class="icon">📃</span></span> <span title="delete"><span></span></span></div>
|
<div class="vtl-operation" style="display: none;"><span title="Add Tree Node"><span class="add-tree-node-icon">📂</span></span> <span title="Add Leaf Node"><span class="icon">+</span></span> <span title="edit"><span class="icon">📃</span></span> <span title="delete"><span></span></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vtl-border vtl-bottom"></div>
|
<div class="vtl-border vtl-bottom"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,7 +42,7 @@ exports[`Slot render slot correctly 1`] = `
|
|||||||
<div class="vtl-node-content">
|
<div class="vtl-node-content">
|
||||||
Node 2
|
Node 2
|
||||||
</div>
|
</div>
|
||||||
<div class="vtl-operation" style="display: none;"><span title="add tree node"><span class="add-tree-node-icon">📂</span></span> <span title="add leaf node"><span class="icon">+</span></span> <span title="edit"><span class="icon">📃</span></span> <span title="delete"><span class="del-node-icon">✂️</span></span></div>
|
<div class="vtl-operation" style="display: none;"><span title="Add Tree Node"><span class="add-tree-node-icon">📂</span></span> <span title="Add Leaf Node"><span class="icon">+</span></span> <span title="edit"><span class="icon">📃</span></span> <span title="delete"><span class="del-node-icon">✂️</span></span></div>
|
||||||
</div>
|
</div>
|
||||||
<!---->
|
<!---->
|
||||||
</div>
|
</div>
|
||||||
|
@@ -51,7 +51,7 @@ describe('Operation', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('add leaf node', done => {
|
it('add leaf node', done => {
|
||||||
const $node1AddLeafNode = wrapper.find('#t1 [title="add leaf node"]')
|
const $node1AddLeafNode = wrapper.find('#t1 [title="Add Leaf Node"]')
|
||||||
$node1AddLeafNode.trigger('click')
|
$node1AddLeafNode.trigger('click')
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(wrapper.findAll('.vtl-leaf-node').length).toBe(2)
|
expect(wrapper.findAll('.vtl-leaf-node').length).toBe(2)
|
||||||
@@ -60,7 +60,7 @@ describe('Operation', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('add tree node', done => {
|
it('add tree node', done => {
|
||||||
const $node1AddTreeNode = wrapper.find('#t1 [title="add tree node"]')
|
const $node1AddTreeNode = wrapper.find('#t1 [title="Add Tree Node"]')
|
||||||
$node1AddTreeNode.trigger('click')
|
$node1AddTreeNode.trigger('click')
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(wrapper.findAll('.vtl-tree-node').length).toBe(3)
|
expect(wrapper.findAll('.vtl-tree-node').length).toBe(3)
|
||||||
|
Reference in New Issue
Block a user