Add collapsible prop

pull/41/head
cagataycivici 2019-07-28 16:44:43 +03:00
parent 587124a701
commit 3f6d7f291d
2 changed files with 10 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<td :colspan="colspan">
<div :class="nodeContentClass" @click="onNodeClick">
<OrganizationChartNodeTemplate :node="node" :template="templates[node.type]||templates['default']" />
<a v-if="collapsible && !leaf" tabindex="0" class="p-node-toggler" @click="toggleNode" @keydown.enter="toggleNode">
<a v-if="toggleable" tabindex="0" class="p-node-toggler" @click="toggleNode" @keydown.enter="toggleNode">
<i class="p-node-toggler-icon pi" :class="{'pi-chevron-down': expanded, 'pi-chevron-up': !expanded}"></i>
</a>
</div>
@ -133,6 +133,9 @@ export default {
},
selected() {
return this.selectable && this.selectionKeys && this.selectionKeys[this.node.key] === true;
},
toggleable() {
return this.collapsible && this.node.collapsible !== false && !this.leaf;
}
},
components: {

View File

@ -105,6 +105,12 @@ export default {
<td>true</td>
<td>Whether node is selectable when selection is enabled.</td>
</tr>
<tr>
<td>collapsible</td>
<td>boolean</td>
<td>true</td>
<td>Whether node is collapsible when node expansion is enabled.</td>
</tr>
<tr>
<td>children</td>
<td>array</td>