From 10aed7a42fa17b9af7d69ada4c45dcf9a9d4cd55 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Fri, 16 Apr 2021 14:09:39 +0200 Subject: [PATCH] update tree layout --- zero.Core/Entities/Tree/TreeItem.cs | 5 ++ zero.Web.UI/App/components/tree/tree-item.vue | 69 ++++++++++++------- zero.Web.UI/App/components/tree/tree.vue | 4 +- zero.Web.UI/Sass/Canvas/_navigation.scss | 2 +- 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/zero.Core/Entities/Tree/TreeItem.cs b/zero.Core/Entities/Tree/TreeItem.cs index 00db6078..fc652869 100644 --- a/zero.Core/Entities/Tree/TreeItem.cs +++ b/zero.Core/Entities/Tree/TreeItem.cs @@ -69,6 +69,11 @@ /// Whether to show actions menu. This will only work when the onActionsRequested cb is implemented in the component /// public bool HasActions { get; set; } + + /// + /// Output an additional count value. + /// + public int? CountOutput { get; set; } } diff --git a/zero.Web.UI/App/components/tree/tree-item.vue b/zero.Web.UI/App/components/tree/tree-item.vue index d79b93d9..bd2b42f7 100644 --- a/zero.Web.UI/App/components/tree/tree-item.vue +++ b/zero.Web.UI/App/components/tree/tree-item.vue @@ -1,11 +1,12 @@  @@ -38,7 +40,11 @@ selected: { type: Boolean, default: false - } + }, + depth: { + type: Number, + default: 0 + }, }, computed: { @@ -76,7 +82,8 @@ // get all classes for a tree item getClasses(item) { - return { + return { + 'has-icon': !!item.icon, 'has-children': item.hasChildren, 'is-inactive': item.isInactive, 'is-open': item.isOpen, @@ -119,10 +126,10 @@ .ui-tree-item { display: grid; - grid-template-columns: 1fr auto; + grid-template-columns: auto 1fr auto auto; align-items: center; font-size: var(--font-size); - padding: 0 var(--padding); + padding: 0 var(--padding) 0 0; height: 54px; color: var(--color-text); position: relative; @@ -131,14 +138,8 @@ &:hover > .ui-tree-item-actions { - transition-delay: 0.2s; opacity: 1; - } - - &.is-open > .ui-tree-item-toggle .ui-tree-item-arrow - { - transform: rotate(180deg); - } + } &.is-disabled { @@ -146,7 +147,7 @@ opacity: .5; } - &.is-active:before, &.is-selected:before + &.is-active:before, &.is-selected:before, &:hover:before { content: ' '; position: absolute; @@ -211,15 +212,13 @@ .ui-tree-item-toggle { - position: absolute; color: var(--color-text-dim); height: 100%; - top: 0; - left: 0; - width: 30px; text-align: right; - padding-right: 5px; + padding-right: 8px; transition: color 0.2s ease; + z-index: 1; + &:hover { color: var(--color-text); @@ -281,13 +280,14 @@ { position: absolute; left: 10px; - bottom: 12px; + bottom: 17px; color: var(--color-text-dim); background: var(--color-tree); border-radius: 50%; - padding: 3px; - width: 18px; - height: 18px; + padding: 2px; + width: 14px; + height: 14px; + transition: color 0.2s ease; .ui-tree-item.is-active &, .ui-tree-item:hover & { @@ -302,7 +302,6 @@ .ui-tree-item-actions { - transition: opacity 0.2s ease 0; opacity: 0; color: var(--color-text-dim); @@ -311,4 +310,22 @@ opacity: 1; } } + + .ui-tree-item-count + { + display: inline-block; + font-size: 11px; + font-weight: 400; + text-transform: uppercase; + background: var(--color-box-nested); + color: var(--color-text); + height: 22px; + line-height: 22px; + padding: 0 10px; + border-radius: 16px; + font-style: normal; + grid-column: 3; + margin-right: -4px; + margin-left: 8px; + } \ No newline at end of file diff --git a/zero.Web.UI/App/components/tree/tree.vue b/zero.Web.UI/App/components/tree/tree.vue index 41b1536f..53e3edb5 100644 --- a/zero.Web.UI/App/components/tree/tree.vue +++ b/zero.Web.UI/App/components/tree/tree.vue @@ -1,12 +1,12 @@