feat: 🎸 #84, add default title props
This commit is contained in:
@@ -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,
|
||||||
|
@@ -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