-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rework SelectableLazyColumn Signed-off-by: Ivan Morgillo <[email protected]> * rename to BasicSelectableLazyColumn Signed-off-by: Ivan Morgillo <[email protected]> * add TODO for the next steps Signed-off-by: Ivan Morgillo <[email protected]> * run API dump Signed-off-by: Ivan Morgillo <[email protected]> --------- Signed-off-by: Ivan Morgillo <[email protected]>
- Loading branch information
Showing
8 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
ui/src/main/kotlin/org/jetbrains/jewel/ui/component/SelectableLazyColumn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.jetbrains.jewel.ui.component | ||
|
||
import androidx.compose.foundation.gestures.FlingBehavior | ||
import androidx.compose.foundation.gestures.ScrollableDefaults | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import org.jetbrains.jewel.foundation.lazy.BasicSelectableLazyColumn | ||
import org.jetbrains.jewel.foundation.lazy.SelectableLazyListScope | ||
import org.jetbrains.jewel.foundation.lazy.SelectableLazyListState | ||
import org.jetbrains.jewel.foundation.lazy.SelectionMode | ||
import org.jetbrains.jewel.foundation.lazy.rememberSelectableLazyListState | ||
import org.jetbrains.jewel.foundation.lazy.tree.DefaultSelectableLazyColumnEventAction | ||
import org.jetbrains.jewel.foundation.lazy.tree.DefaultSelectableLazyColumnKeyActions | ||
import org.jetbrains.jewel.foundation.lazy.tree.KeyActions | ||
import org.jetbrains.jewel.foundation.lazy.tree.PointerEventActions | ||
|
||
@Composable | ||
public fun SelectableLazyColumn( | ||
modifier: Modifier = Modifier, | ||
selectionMode: SelectionMode = SelectionMode.Multiple, | ||
state: SelectableLazyListState = rememberSelectableLazyListState(), | ||
contentPadding: PaddingValues = PaddingValues(0.dp), | ||
reverseLayout: Boolean = false, | ||
onSelectedIndexesChanged: (List<Int>) -> Unit = {}, | ||
verticalArrangement: Arrangement.Vertical = if (!reverseLayout) Arrangement.Top else Arrangement.Bottom, | ||
horizontalAlignment: Alignment.Horizontal = Alignment.Start, | ||
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), | ||
keyActions: KeyActions = DefaultSelectableLazyColumnKeyActions, | ||
pointerEventActions: PointerEventActions = DefaultSelectableLazyColumnEventAction(), | ||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, | ||
// TODO: We will add support for styling in the near future | ||
content: SelectableLazyListScope.() -> Unit, | ||
) { | ||
BasicSelectableLazyColumn( | ||
modifier = modifier, | ||
selectionMode = selectionMode, | ||
state = state, | ||
contentPadding = contentPadding, | ||
reverseLayout = reverseLayout, | ||
onSelectedIndexesChanged = onSelectedIndexesChanged, | ||
verticalArrangement = verticalArrangement, | ||
horizontalAlignment = horizontalAlignment, | ||
flingBehavior = flingBehavior, | ||
keyActions = keyActions, | ||
pointerEventActions = pointerEventActions, | ||
interactionSource = interactionSource, | ||
content = content, | ||
) | ||
} |