-
Notifications
You must be signed in to change notification settings - Fork 40
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
Selectable Lazy Column, Tree #42
Conversation
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/tree/SelectableColumnOnKeyEvent.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/tree/SelectableColumnOnKeyEvent.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I am the owner of LazyColumn in Google. Jim asked to take a look on this commit so I left a few comments
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableListState.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/VerticalScrollerForLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/VerticalScrollerForLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/VerticalScrollerForLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyColumn.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/FocusableListState.kt
Outdated
Show resolved
Hide resolved
96b4eea
to
ccf4106
Compare
The model and its implementation have been revised following the received feedback. in details:
|
@andkulikov @ralstondasilva could you take another look to see if this is good to go? |
@andkulikov @ralstondasilva ping, this is blocking folks at JetBrains 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, left a few comments
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyListScope.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyListState.kt
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyListScope.kt
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyListState.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/tree/TreeView.kt
Outdated
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/tree/TreeView.kt
Show resolved
Hide resolved
foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyColumn.kt
Show resolved
Hide resolved
key for item can not be null LaunchedEffect switched to DisposableEffect when possible PointerInput handling is now bound to a significant key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can always come back for further changes later if we get more feedback but we can at least unblock this
OBSOLETE: SCROLL TO NEXT COMMENT
New components (
SelectableLazyColumn
,Tree
) can be found in thefoundation
package.Those elements have a default implementation of
KeyBindingScopedActions
, and support focus and selection.Standalone Int UI sample
org/jetbrains/jewel/samples/standalone/expui/Main.kt
has been updated to show a tree.Tree Element Definition
For better usability, we decided to split the element into nodes and leaves, obv a leaf cannot have children.
Tree APIs for ID
Commonly we expect an ID of type
Any
for elements, but nothing binds an element to a tree, so we decide to create an ID strategy where the functionidPath()
can identify an element inside a specificTree
(useful to support persistence interactions, if needed)As we expect Tree has no cognition about it is represented, this duty will be done by the
TreeState
, in detail in our implementation we decided to represent the Tree as an ordered list of elements, where the kinship is represented graphically with the depth of every single element... the pair <position, depth> can explain without any doubt the Tree structure.TreeState
The TreeState defines all APIs that are strictly bonded to a Tree interaction and delegates the other generic action to the subComponentState like selection->SelectableState and focus->FocusState
SubComponent: SelectableLazyList
It is made to hold and manage the concept of selection, every Item in the list should be provided with an id (ANY) and the specification that is Selectable or NotSelectable.
Note the focus interaction is Delegate to FocusableLazyColumnState
This indication will be used in the SelectableLazyListState for all selection interactions like mouse/tap events and keybinding events
The binding/refresh from state and list elements will be done by the component via
attachKeys()
:The mapping of the items will be done with the same pattern as
LazyColumn
, withSelectableLazyListScope
that forward this mapping downside toFocusableLazyColumn
:SubComponent: FocusableLazyColumn
The last layer between Selection and the LazyColumn is made by FocusableLazyList and his state holder FocusableLazyListState,
Like selectableLazyColumn, we are mapping the item that will be forwarded to LazyColumnScope, for every item a FocusRequester will be associated once!