-
Notifications
You must be signed in to change notification settings - Fork 820
feat(Tree): flat item structure #4552
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
Conversation
@benjamincanac So the implementation of this sounds easy, but there is one thing I'm not sure we will be able to keep and that is the nested level indication (border on the |
@J-Michalek I'm aware, this is why I implemented it this way π |
I think we have to choose which way to go from here, I for one am for functionality (DnD, virtualization) over design, but many people might feel different and sudden change could be annoying. There is also an option to support both structures, but I feel like it would complicate the component and make maintenance harder, thoughts? |
+1 for support DnD and virtualization. About the borders, could we calculate each itemβs level in the flat list (so virtualization still works) and adding a Something like this: .tree-item {
padding-left: calc(var(--indent) * var(--level));
position: relative;
}
.tree-item::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: calc((var(--indent) * var(--level)) - 1px);
border-left: 1px solid var(--ui-border);
} |
@caiotarifa Sadly it does not work when there are multiple nested levels as the border will break at some point:
We would have to do some nasty stuff with auxiliary elements to match the borders of each level, but that would be a nightmare to maintain and not a very good thing to do in general. |
@J-Michalek Got it. I'm not proud of this suggestion, but we could try using https://codepen.io/caio/pen/myePREV <ul>
<li data-level="1">Level 1</li>
<li data-level="2">Level 2</li>
<li data-level="3">Level 3</li>
<li data-level="2">Level 2</li>
</ul> :root {
--indent: 16px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
padding-left: calc(var(--indent) * var(--level));
position: relative;
}
li::before {
background-image: repeating-linear-gradient(
to right,
#ccc 0,
#ccc 1px,
transparent 1px,
transparent var(--indent)
);
background-repeat: repeat-y;
top: 0;
left: 0;
bottom: 0;
content: '';
position: absolute;
width: calc(var(--indent) * var(--level));
}
/* Replace by Vue. */
li[data-level="1"] { --level: 1; }
li[data-level="2"] { --level: 2; }
li[data-level="3"] { --level: 3; } |
Hi, i`m already working this issue like 1 week ago but i forget to push it. #4583, feel free to discus @J-Michalek |
@rdjanuar Looks promising, I think we need to know, if the functionality should be preserved or not. Also I saw that you are using a CSS class to make this work, but I don't think that is something we want to do, would you be able to implement it using Tailwind? |
@J-Michalek Yes i can, i already update the code |
I'm gonna close this PR as @rdjanuar has made more progress on this feature already. |
π Linked issue
Resolves: #4508
β Type of change
Render Tree items in inline structure without any nesting allowing for drag and drop and virtualization implementation.
π Description
π Checklist