diff --git a/foundation/api/foundation.api b/foundation/api/foundation.api index 9e1343262..bf28b1b9a 100644 --- a/foundation/api/foundation.api +++ b/foundation/api/foundation.api @@ -81,6 +81,10 @@ public final class org/jetbrains/jewel/foundation/OutlineColors { public final class org/jetbrains/jewel/foundation/OutlineColors$Companion { } +public final class org/jetbrains/jewel/foundation/OverflowBoxKt { + public static final fun OverflowBox (Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Alignment;FLkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V +} + public abstract class org/jetbrains/jewel/foundation/Stroke { public static final field $stable I } @@ -334,6 +338,245 @@ public final class org/jetbrains/jewel/foundation/lazy/SelectionMode : java/lang public static fun values ()[Lorg/jetbrains/jewel/foundation/lazy/SelectionMode; } +public final class org/jetbrains/jewel/foundation/lazy/draggable/DraggableKt { + public static final fun draggableItem (Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState;Ljava/lang/Object;ZLandroidx/compose/foundation/gestures/Orientation;)Landroidx/compose/ui/Modifier; + public static synthetic fun draggableItem$default (Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState;Ljava/lang/Object;ZLandroidx/compose/foundation/gestures/Orientation;ILjava/lang/Object;)Landroidx/compose/ui/Modifier; + public static final fun draggableLayout (Landroidx/compose/ui/Modifier;)Landroidx/compose/ui/Modifier; +} + +public abstract class org/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState { + public static final field $stable I + public fun ()V + public final fun getDraggingItemKey ()Ljava/lang/Object; + public final fun getDraggingItemOffsetTransformX ()F + public final fun getDraggingItemOffsetTransformY ()F + public final fun getDraggingOffset-F1C5BW0 ()J + public abstract fun getIndex (Ljava/lang/Object;)I + public final fun getInitialOffset-F1C5BW0 ()J + public abstract fun getItemAt-k-4lQ0M (J)Ljava/lang/Object; + public abstract fun getItemWithKey (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun getKey (Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun getOffset-tuRUvjQ (Ljava/lang/Object;)J + public abstract fun getSize-7Ah8Wj8 (Ljava/lang/Object;)J + public abstract fun moveItem (II)V + public final fun onDrag-k-4lQ0M (J)V + public final fun onDragInterrupted ()V + public final fun onDragStart-Uv8p0NA (Ljava/lang/Object;J)V + public final fun setDraggingItemKey (Ljava/lang/Object;)V + public final fun setDraggingItemOffsetTransformX (F)V + public final fun setDraggingItemOffsetTransformY (F)V + public final fun setDraggingOffset-k-4lQ0M (J)V + public final fun setInitialOffset-k-4lQ0M (J)V +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize { + public static final field Companion Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion; + public abstract fun columnConstraints-xF2OJ5Q (Landroidx/compose/ui/unit/Density;IIII)J + public abstract fun rowConstraints-xF2OJ5Q (Landroidx/compose/ui/unit/Density;IIII)J +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion { +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableCellSizeKt { + public static final fun fixed-73KfpEQ (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion;FFLandroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize; + public static final fun fixedHeight-hFKHopI (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion;FFFLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize; + public static final fun responsive-qDBjuR0 (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion;FFFF)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize; + public static synthetic fun responsive-qDBjuR0$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize$Companion;FFFFILjava/lang/Object;)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableCellState { + public abstract fun getColumn ()I + public abstract fun getRow ()I + public abstract fun getSelected ()Z +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableCells { + public abstract fun content (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemScope;Ljava/lang/Object;Ljava/lang/Object;Landroidx/compose/runtime/Composer;I)V + public abstract fun type (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableColumnDraggingState : org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState { + public static final field $stable I + public fun (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Lkotlin/jvm/functions/Function2;)V + public synthetic fun getIndex (Ljava/lang/Object;)I + public fun getIndex (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)I + public synthetic fun getItemWithKey (Ljava/lang/Object;)Ljava/lang/Object; + public fun getItemWithKey (Ljava/lang/Object;)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo; + public synthetic fun getKey (Ljava/lang/Object;)Ljava/lang/Object; + public fun getKey (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)Ljava/lang/Object; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableColumnScope { + public abstract fun row (ILkotlin/jvm/functions/Function3;)V +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableContent { + public abstract fun Item (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemScope;ILandroidx/compose/runtime/Composer;I)V + public abstract fun getColumnCount ()I + public abstract fun getContentType (I)Ljava/lang/Object; + public abstract fun getContentType--gyyYBs (J)Ljava/lang/Object; + public abstract fun getIndex--gyyYBs (J)I + public abstract fun getKey (I)Lkotlin/Pair; + public abstract fun getKey--gyyYBs (J)Lkotlin/Pair; + public abstract fun getPosition-Bjo55l4 (I)J + public abstract fun getRowCount ()I +} + +public abstract class org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState : org/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState { + public static final field $stable I + public fun (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Lkotlin/jvm/functions/Function2;)V + public synthetic fun getItemAt-k-4lQ0M (J)Ljava/lang/Object; + public fun getItemAt-k-4lQ0M (J)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo; + public synthetic fun getOffset-tuRUvjQ (Ljava/lang/Object;)J + public fun getOffset-tuRUvjQ (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)J + public final fun getOnMove ()Lkotlin/jvm/functions/Function2; + public synthetic fun getSize-7Ah8Wj8 (Ljava/lang/Object;)J + public fun getSize-7Ah8Wj8 (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)J + public final fun getTableState ()Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState; + public fun moveItem (II)V +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableStateKt { + public static final fun rememberLazyTableColumnDraggingState (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableColumnDraggingState; + public static final fun rememberLazyTableRowDraggingState (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableRowDraggingState; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo { + public abstract fun getColumn ()I + public abstract fun getContentType ()Ljava/lang/Object; + public abstract fun getIndex ()I + public abstract fun getKey ()Ljava/lang/Object; + public abstract fun getOffset-nOcc-ac ()J + public abstract fun getRow ()I + public abstract fun getSize-YbymL2g ()J +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo$DefaultImpls { + public static fun getContentType (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)Ljava/lang/Object; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableItemScope { + public abstract fun animateItemPlacement (Landroidx/compose/ui/Modifier;Landroidx/compose/animation/core/FiniteAnimationSpec;)Landroidx/compose/ui/Modifier; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableItemScope$DefaultImpls { + public static synthetic fun animateItemPlacement$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemScope;Landroidx/compose/ui/Modifier;Landroidx/compose/animation/core/FiniteAnimationSpec;ILjava/lang/Object;)Landroidx/compose/ui/Modifier; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableKt { + public static final fun LazyTable (Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCellSize;Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;IILandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/gestures/FlingBehavior;ZILandroidx/compose/foundation/layout/Arrangement$Horizontal;Landroidx/compose/foundation/layout/Arrangement$Vertical;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;III)V +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo { + public abstract fun getColumns ()I + public abstract fun getFloatingItemsInfo ()Ljava/util/List; + public abstract fun getHorizontalSpacing ()I + public abstract fun getPinnedColumns ()I + public abstract fun getPinnedColumnsInfo ()Ljava/util/List; + public abstract fun getPinnedColumnsWidth ()I + public abstract fun getPinnedItemsInfo ()Ljava/util/List; + public abstract fun getPinnedRows ()I + public abstract fun getPinnedRowsHeight ()I + public abstract fun getPinnedRowsInfo ()Ljava/util/List; + public abstract fun getRows ()I + public abstract fun getTotalItemsCount ()I + public abstract fun getVerticalSpacing ()I + public abstract fun getViewportCellSize-YbymL2g ()J + public abstract fun getViewportEndOffset-nOcc-ac ()J + public abstract fun getViewportSize-YbymL2g ()J + public abstract fun getViewportStartOffset-nOcc-ac ()J +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo$DefaultImpls { + public static fun getHorizontalSpacing (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo;)I + public static fun getTotalItemsCount (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo;)I + public static fun getVerticalSpacing (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo;)I + public static fun getViewportCellSize-YbymL2g (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo;)J + public static fun getViewportSize-YbymL2g (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo;)J +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableRowDraggingState : org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState { + public static final field $stable I + public fun (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Lkotlin/jvm/functions/Function2;)V + public synthetic fun getIndex (Ljava/lang/Object;)I + public fun getIndex (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)I + public synthetic fun getItemWithKey (Ljava/lang/Object;)Ljava/lang/Object; + public fun getItemWithKey (Ljava/lang/Object;)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo; + public synthetic fun getKey (Ljava/lang/Object;)Ljava/lang/Object; + public fun getKey (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableItemInfo;)Ljava/lang/Object; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableRowScope { + public abstract fun column (ILkotlin/jvm/functions/Function3;)V +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/LazyTableScope { + public abstract fun cells (Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function5;)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCells; + public abstract fun columnDefinitions (ILkotlin/jvm/functions/Function1;)V + public abstract fun rowDefinitions (ILkotlin/jvm/functions/Function1;)V +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableScope$DefaultImpls { + public static synthetic fun cells$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function5;ILjava/lang/Object;)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableCells; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableScopeKt { + public static final fun columnDefinition (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableScope;Ljava/lang/Object;)V + public static final fun rowDefinition (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableScope;Ljava/lang/Object;)V +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableScrollbarAdapterKt { + public static final fun rememberTableHorizontalScrollbarAdapter (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Landroidx/compose/runtime/Composer;I)Landroidx/compose/foundation/v2/ScrollbarAdapter; + public static final fun rememberTableVerticalScrollbarAdapter (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Landroidx/compose/runtime/Composer;I)Landroidx/compose/foundation/v2/ScrollbarAdapter; + public static final fun tableHorizontalScrollbarAdapter (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;)Landroidx/compose/foundation/v2/ScrollbarAdapter; + public static final fun tableVerticalScrollbarAdapter (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;)Landroidx/compose/foundation/v2/ScrollbarAdapter; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableState { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState$Companion; + public fun ()V + public fun (IIII)V + public synthetic fun (IIIIILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun animateScrollToColumn (IILkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun animateScrollToColumn$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;IILkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun animateScrollToRow (IILkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun animateScrollToRow$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;IILkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun getCanHorizontalScrollBackward ()Z + public final fun getCanHorizontalScrollForward ()Z + public final fun getCanVerticalScrollBackward ()Z + public final fun getCanVerticalScrollForward ()Z + public final fun getFirstVisibleColumnIndex ()I + public final fun getFirstVisibleItemHorizontalScrollOffset ()I + public final fun getFirstVisibleItemVerticalScrollOffset ()I + public final fun getFirstVisibleRowIndex ()I + public final fun getHorizontalScrollableState ()Landroidx/compose/foundation/gestures/ScrollableState; + public final fun getLayoutInfo ()Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableLayoutInfo; + public final fun getVerticalScrollableState ()Landroidx/compose/foundation/gestures/ScrollableState; + public final fun horizontalScroll (Landroidx/compose/foundation/MutatePriority;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun horizontalScroll$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Landroidx/compose/foundation/MutatePriority;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun isScrollInProgress ()Z + public final fun scrollToColumn (IILkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun scrollToColumn$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;IILkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun scrollToRow (IILkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun scrollToRow$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;IILkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun verticalScroll (Landroidx/compose/foundation/MutatePriority;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun verticalScroll$default (Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState;Landroidx/compose/foundation/MutatePriority;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableState$Companion { + public final fun getSaver ()Landroidx/compose/runtime/saveable/Saver; +} + +public final class org/jetbrains/jewel/foundation/lazy/table/LazyTableStateKt { + public static final fun rememberLazyTableState (IIIILandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/lazy/table/LazyTableState; +} + +public abstract interface class org/jetbrains/jewel/foundation/lazy/table/TableScrollScope { + public abstract fun scrollBy-E7KxVPU (J)J +} + public final class org/jetbrains/jewel/foundation/lazy/tree/BasicLazyTreeKt { public static final fun BasicLazyTree-orM9XXQ (Lorg/jetbrains/jewel/foundation/lazy/tree/Tree;Lorg/jetbrains/jewel/foundation/lazy/SelectionMode;Lkotlin/jvm/functions/Function1;JJJFLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;FFLorg/jetbrains/jewel/foundation/lazy/tree/TreeState;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;JLorg/jetbrains/jewel/foundation/lazy/tree/KeyActions;Lorg/jetbrains/jewel/foundation/lazy/tree/PointerEventActions;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;IIII)V } @@ -845,6 +1088,7 @@ public final class org/jetbrains/jewel/foundation/theme/ThemeIconData$Companion } public final class org/jetbrains/jewel/foundation/util/DebugKt { + public static final fun debugLog (Lkotlin/jvm/functions/Function0;)V public static final fun getInDebugMode ()Z } diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/OverflowBox.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/OverflowBox.kt index 1d5c5ef23..5de36211b 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/OverflowBox.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/OverflowBox.kt @@ -51,6 +51,6 @@ public fun OverflowBox( showOverflow = it }.then(modifier), contentAlignment = contentAlignment, - content = content + content = content, ) -} \ No newline at end of file +} diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/Draggable.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/Draggable.kt new file mode 100644 index 000000000..39ab1aa25 --- /dev/null +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/Draggable.kt @@ -0,0 +1,87 @@ +package org.jetbrains.jewel.foundation.lazy.draggable + +import androidx.compose.foundation.gestures.Orientation +import androidx.compose.foundation.gestures.detectDragGestures +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.composed +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.positionInRoot +import androidx.compose.ui.modifier.modifierLocalConsumer +import androidx.compose.ui.modifier.modifierLocalOf +import androidx.compose.ui.modifier.modifierLocalProvider +import androidx.compose.ui.zIndex + +internal val ModifierLocalDraggableLayoutOffset = modifierLocalOf { Offset.Zero } + +public fun Modifier.draggableLayout(): Modifier = composed { + var offset by remember { mutableStateOf(Offset.Zero) } + + this.onGloballyPositioned { + offset = it.positionInRoot() + }.modifierLocalProvider(ModifierLocalDraggableLayoutOffset) { + offset + } +} + +public fun Modifier.draggableItem( + state: LazyLayoutDraggableState<*>, + key: Any, + draggable: Boolean = true, + orientation: Orientation? = null, +): Modifier { + return if (draggable) { + this.draggingItem(state, key, orientation).draggableItemHandle(state, key) + } else { + this.draggingItem(state, key, orientation) + } +} + +private fun Modifier.draggableItemHandle( + state: LazyLayoutDraggableState<*>, + key: Any, +): Modifier = composed { + var itemOffset by remember { mutableStateOf(Offset.Zero) } + var layoutOffset by remember { mutableStateOf(Offset.Zero) } + + onGloballyPositioned { + itemOffset = it.positionInRoot() + }.modifierLocalConsumer { + layoutOffset = ModifierLocalDraggableLayoutOffset.current + }.pointerInput(Unit) { + detectDragGestures(onDrag = { change, offset -> + change.consume() + state.onDrag(offset) + }, onDragStart = { + state.onDragStart(key, it + itemOffset - layoutOffset) + }, onDragEnd = { + state.onDragInterrupted() + }, onDragCancel = { + state.onDragInterrupted() + }) + } +} + +private fun Modifier.draggingItem( + state: LazyLayoutDraggableState<*>, + key: Any, + orientation: Orientation? = null, +): Modifier = composed { + val dragging = state.draggingItemKey == key + if (dragging) { + this.then( + Modifier.zIndex(2f).graphicsLayer( + translationX = if (orientation == Orientation.Vertical) 0f else state.draggingItemOffsetTransformX.toFloat(), + translationY = if (orientation == Orientation.Horizontal) 0f else state.draggingItemOffsetTransformY.toFloat(), + ), + ) + } else { + this + } +} diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState.kt new file mode 100644 index 000000000..3a67bb809 --- /dev/null +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/draggable/LazyLayoutDraggableState.kt @@ -0,0 +1,68 @@ +package org.jetbrains.jewel.foundation.lazy.draggable + +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Size + +public abstract class LazyLayoutDraggableState { + + public var draggingItemOffsetTransformX: Float by mutableStateOf(0f) + + public var draggingItemOffsetTransformY: Float by mutableStateOf(0f) + + public var draggingItemKey: Any? by mutableStateOf(null) + + public var initialOffset: Offset = Offset.Zero + + public var draggingOffset: Offset = Offset.Zero + + internal val interactionSource: MutableInteractionSource = MutableInteractionSource() + + public fun onDragStart(key: Any?, offset: Offset) { + draggingItemKey = key + initialOffset = offset + } + + public fun onDrag(offset: Offset) { + draggingItemOffsetTransformX += offset.x + draggingItemOffsetTransformY += offset.y + draggingOffset += offset + + val draggingItem = getItemWithKey(draggingItemKey ?: return) ?: return + val hoverItem = getItemAt(initialOffset + draggingOffset) + + if (hoverItem != null && draggingItem != hoverItem) { + val changedOffset = draggingItem.offset - hoverItem.offset + + draggingItemOffsetTransformX += changedOffset.x + draggingItemOffsetTransformY += changedOffset.y + + moveItem(draggingItem.index, hoverItem.index) + } + } + + public fun onDragInterrupted() { + draggingItemKey = null + initialOffset = Offset.Zero + draggingOffset = Offset.Zero + draggingItemOffsetTransformX = 0f + draggingItemOffsetTransformY = 0f + } + + public abstract fun moveItem(from: Int, to: Int) + + public abstract fun getItemAt(offset: Offset): T? + + public abstract fun getItemWithKey(key: Any): T? + + public abstract val T.offset: Offset + + public abstract val T.size: Size + + public abstract val T.index: Int + + public abstract val T.key: Any? +} diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTable.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTable.kt index 37029be75..f397bca95 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTable.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTable.kt @@ -43,12 +43,12 @@ public fun LazyTable( beyondBoundsItemCount: Int = 0, horizontalArrangement: Arrangement.Horizontal? = null, verticalArrangement: Arrangement.Vertical? = null, - content: LazyTableScope.() -> Unit, + content: LazyTableScope.() -> LazyTableCells, ) { - val itemProvider = rememberLazyTableItemProvider(state, pinnedColumns, pinnedRows, content) + val itemProviderLambda = rememberLazyTableItemProviderLambda(state, pinnedColumns, pinnedRows, content) val measurePolicy = rememberLazyTabletMeasurePolicy( - itemProvider = itemProvider, + itemProviderLambda = itemProviderLambda, cellSize = cellSize, state = state, pinnedColumns = pinnedColumns, @@ -94,13 +94,13 @@ public fun LazyTable( .clip(RectangleShape), prefetchState = state.prefetchState, measurePolicy = measurePolicy, - itemProvider = itemProvider, + itemProvider = itemProviderLambda, ) } @Composable private fun rememberLazyTabletMeasurePolicy( - itemProvider: LazyTableItemProvider, + itemProviderLambda: () -> LazyTableItemProvider, cellSize: LazyTableCellSize, state: LazyTableState, pinnedColumns: Int, @@ -111,7 +111,6 @@ private fun rememberLazyTabletMeasurePolicy( verticalArrangement: Arrangement.Vertical? = null, ): LazyLayoutMeasureScope.(Constraints) -> MeasureResult = remember MeasureResult>( - itemProvider, state, pinnedColumns, pinnedRows, @@ -146,6 +145,7 @@ private fun rememberLazyTabletMeasurePolicy( val horizontalSpacing = horizontalArrangement?.spacing?.roundToPx() ?: 0 val verticalSpacing = verticalArrangement?.spacing?.roundToPx() ?: 0 + val itemProvider = itemProviderLambda() val measuredItemProvider = object : LazyTableMeasuredItemProvider( availableSize = availableSize, rows = itemProvider.rowCount, @@ -155,7 +155,7 @@ private fun rememberLazyTabletMeasurePolicy( verticalSpacing = verticalSpacing, itemProvider = itemProvider, measureScope = this, - density = this + density = this, ) { override fun createItem( column: Int, diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableAnimateScroll.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableAnimateScroll.kt index b27c56143..0e0a26d32 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableAnimateScroll.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableAnimateScroll.kt @@ -8,8 +8,9 @@ import androidx.compose.foundation.gestures.ScrollScope import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach +import androidx.compose.ui.util.fastMaxOfOrNull import androidx.compose.ui.util.fastSumBy -import org.jetbrains.jewel.foundation.utils.debugLog +import org.jetbrains.jewel.foundation.util.debugLog import kotlin.coroutines.cancellation.CancellationException import kotlin.math.abs @@ -27,6 +28,8 @@ internal interface LazyTableAnimateScrollScope { fun getTargetLineOffset(index: Int): Int? + fun getStartLineOffset(): Int + fun ScrollScope.snapToLine(index: Int, scrollOffset: Int) fun expectedDistanceTo(index: Int, targetScrollOffset: Int): Float @@ -206,7 +209,7 @@ internal suspend fun LazyTableAnimateScrollScope.animateScrollToItem( // We found it, animate to it // Bring to the requested position - will be automatically stopped if not possible val anim = itemFound.previousAnimation.copy(value = 0f) - val target = (itemFound.lineOffset + scrollOffset).toFloat() + val target = (itemFound.lineOffset + scrollOffset - getStartLineOffset()).toFloat() var prevValue = 0f debugLog { "Seeking by $target at velocity ${itemFound.previousAnimation.velocity}" @@ -275,6 +278,14 @@ internal class LazyTableAnimateHorizontalScrollScope( return null } + override fun getStartLineOffset(): Int { + return ( + state.layoutInfo.pinnedItemsInfo.fastMaxOfOrNull { + it.offset.x + it.size.width + } ?: 0 + ) + state.layoutInfo.horizontalSpacing + } + override fun ScrollScope.snapToLine(index: Int, scrollOffset: Int) { state.snapToColumnInternal(index, scrollOffset) } @@ -325,6 +336,14 @@ internal class LazyTableAnimateVerticalScrollScope( return null } + override fun getStartLineOffset(): Int { + return ( + state.layoutInfo.pinnedItemsInfo.fastMaxOfOrNull { + it.offset.y + it.size.height + } ?: 0 + ) + state.layoutInfo.verticalSpacing + } + override fun ScrollScope.snapToLine(index: Int, scrollOffset: Int) { state.snapToRowInternal(index, scrollOffset) } diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState.kt new file mode 100644 index 000000000..4dfd4f83e --- /dev/null +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableDraggableState.kt @@ -0,0 +1,101 @@ +package org.jetbrains.jewel.foundation.lazy.table + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Rect +import androidx.compose.ui.geometry.Size +import androidx.compose.ui.unit.toOffset +import androidx.compose.ui.unit.toSize +import androidx.compose.ui.util.fastFirstOrNull +import org.jetbrains.jewel.foundation.lazy.draggable.LazyLayoutDraggableState + +@Composable +public fun rememberLazyTableRowDraggingState( + tableState: LazyTableState = rememberLazyTableState(), + onMove: (Int, Int) -> Unit, +): LazyTableRowDraggingState { + return remember(tableState, onMove) { + LazyTableRowDraggingState(tableState, onMove) + } +} + +@Composable +public fun rememberLazyTableColumnDraggingState( + tableState: LazyTableState = rememberLazyTableState(), + onMove: (Int, Int) -> Unit, +): LazyTableColumnDraggingState { + return remember(tableState, onMove) { + LazyTableColumnDraggingState(tableState, onMove) + } +} + +public abstract class LazyTableDraggableState( + public val tableState: LazyTableState, + public val onMove: (Int, Int) -> Unit, +) : LazyLayoutDraggableState() { + + override fun getItemAt(offset: Offset): LazyTableItemInfo? { + return tableState.layoutInfo.pinnedColumnsInfo.fastFirstOrNull { + offset in Rect(it.offset.toOffset(), it.size.toSize()) + } ?: tableState.layoutInfo.pinnedRowsInfo.fastFirstOrNull { + offset in Rect(it.offset.toOffset(), it.size.toSize()) + } ?: tableState.layoutInfo.pinnedItemsInfo.fastFirstOrNull { + offset in Rect(it.offset.toOffset(), it.size.toSize()) + } + } + + override val LazyTableItemInfo.size: Size + get() = this.size.toSize() + + override val LazyTableItemInfo.offset: Offset + get() = this.offset.toOffset() + + override fun moveItem(from: Int, to: Int) { + onMove(from, to) + } +} + +public class LazyTableRowDraggingState( + tableState: LazyTableState, + onMove: (Int, Int) -> Unit, +) : LazyTableDraggableState(tableState, onMove) { + + override val LazyTableItemInfo.index: Int + get() = this.row + + override val LazyTableItemInfo.key: Any? + get() = (this.key as Pair?)?.second + + override fun getItemWithKey(key: Any): LazyTableItemInfo? { + return tableState.layoutInfo.pinnedColumnsInfo.fastFirstOrNull { + (it.key as Pair?)?.second == key + } ?: tableState.layoutInfo.pinnedRowsInfo.fastFirstOrNull { + (it.key as Pair?)?.second == key + } ?: tableState.layoutInfo.pinnedItemsInfo.fastFirstOrNull { + (it.key as Pair?)?.second == key + } + } +} + +public class LazyTableColumnDraggingState( + tableState: LazyTableState, + onMove: (Int, Int) -> Unit, +) : LazyTableDraggableState(tableState, onMove) { + + override val LazyTableItemInfo.index: Int + get() = this.column + + override val LazyTableItemInfo.key: Any? + get() = (this.key as Pair?)?.first + + override fun getItemWithKey(key: Any): LazyTableItemInfo? { + return tableState.layoutInfo.pinnedColumnsInfo.fastFirstOrNull { + (it.key as Pair?)?.first == key + } ?: tableState.layoutInfo.pinnedRowsInfo.fastFirstOrNull { + (it.key as Pair?)?.first == key + } ?: tableState.layoutInfo.pinnedItemsInfo.fastFirstOrNull { + (it.key as Pair?)?.first == key + } + } +} diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableIntervalContent.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableIntervalContent.kt index 06745c786..8062ac880 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableIntervalContent.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableIntervalContent.kt @@ -6,22 +6,13 @@ import androidx.compose.foundation.lazy.layout.getDefaultLazyLayoutKey import androidx.compose.runtime.Composable import androidx.compose.ui.unit.IntOffset -internal class LazyTableIntervalContent(content: LazyTableScope.() -> Unit) : LazyTableScope, LazyTableContent { +internal class LazyTableIntervalContent(content: LazyTableScope.() -> LazyTableCells) : LazyTableScope, LazyTableContent { private val columnIntervals: MutableIntervalList = MutableIntervalList() private val rowIntervals: MutableIntervalList = MutableIntervalList() - private var type: (columnKey: Any, rowKey: Any) -> Any? = { _, _ -> - null - } - - private var content: @Composable LazyTableItemScope.(columnKey: Any, rowKey: Any) -> Any? = { _, _ -> - } - - init { - content() - } + private val cells: LazyTableCells = content() override val columnCount: Int get() = columnIntervals.size @@ -49,9 +40,15 @@ internal class LazyTableIntervalContent(content: LazyTableScope.() -> Unit) : La override fun cells( type: (columnKey: Any, rowKey: Any) -> Any?, content: @Composable LazyTableItemScope.(columnKey: Any, rowKey: Any) -> Unit, - ) { - this.type = type - this.content = content + ): LazyTableCells { + return object : LazyTableCells { + override fun type(columnKey: Any, rowKey: Any): Any? = type(columnKey, rowKey) + + @Composable + override fun LazyTableItemScope.content(columnKey: Any, rowKey: Any) { + content(columnKey, rowKey) + } + } } override fun getKey(position: IntOffset): Pair { @@ -70,13 +67,13 @@ internal class LazyTableIntervalContent(content: LazyTableScope.() -> Unit) : La override fun getContentType(position: IntOffset): Any? { val (columnKey, rowKey) = getKey(position) - return type(columnKey, rowKey) + return cells.type(columnKey, rowKey) } override fun getContentType(index: Int): Any? { val (columnKey, rowKey) = getKey(index) - return type(columnKey, rowKey) + return cells.type(columnKey, rowKey) } override fun getPosition(index: Int): IntOffset { @@ -90,6 +87,8 @@ internal class LazyTableIntervalContent(content: LazyTableScope.() -> Unit) : La @Composable override fun Item(scope: LazyTableItemScope, index: Int) { val (columnKey, rowKey) = getKey(index) - content(scope, columnKey, rowKey) + with(cells) { + scope.content(columnKey, rowKey) + } } } diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableItemProvider.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableItemProvider.kt index 1404a1df8..be6f453a3 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableItemProvider.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableItemProvider.kt @@ -26,21 +26,22 @@ internal interface LazyTableItemProvider : LazyLayoutItemProvider { } @Composable -internal fun rememberLazyTableItemProvider( +internal fun rememberLazyTableItemProviderLambda( state: LazyTableState, pinnedColumns: Int, pinnedRows: Int, - content: LazyTableScope.() -> Unit, -): LazyTableItemProvider { + content: LazyTableScope.() -> LazyTableCells, +): () -> LazyTableItemProvider { val latestContent = rememberUpdatedState(content) - val itemProvider = remember(state, pinnedColumns, pinnedRows) { + + return remember(state, pinnedColumns, pinnedRows) { val scope = LazyTableItemScopeImpl() val intervalContentState = derivedStateOf(referentialEqualityPolicy()) { LazyTableIntervalContent(latestContent.value) } - derivedStateOf(referentialEqualityPolicy()) { + val itemProvider = derivedStateOf(referentialEqualityPolicy()) { val intervalContent = intervalContentState.value val map = NearestRangeKeyPositionMap( @@ -57,9 +58,8 @@ internal fun rememberLazyTableItemProvider( keyPositionMap = map, ) } + itemProvider::value } - - return itemProvider.value } private class LazyTableItemProviderImpl( diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasure.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasure.kt index 2a6475c36..8b4816bcc 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasure.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasure.kt @@ -94,12 +94,12 @@ internal fun measureLazyTable( if (currentFirstFloatingColumn == pinnedColumns && currentFirstFloatingColumnScrollOffset < 0) { scrollDeltaX += currentFirstFloatingColumnScrollOffset - currentFirstFloatingColumnScrollOffset = pinnedColumns + currentFirstFloatingColumnScrollOffset = 0 } if (currentFirstFloatingRow == pinnedRows && currentFirstFloatingRowScrollOffset < 0) { scrollDeltaY += currentFirstFloatingRowScrollOffset - currentFirstFloatingRowScrollOffset = pinnedRows + currentFirstFloatingRowScrollOffset = 0 } // measuredItemProvider.getAndMeasure(0, 0) @@ -172,7 +172,7 @@ internal fun measureLazyTable( currentCellAxisOffsetX += columnWidth + horizontalSpacing currentLastFloatingColumn++ - if (currentCellAxisOffsetX <= minOffsetX && currentLastFloatingColumn != columns - 1) { + if (currentCellAxisOffsetX <= minOffsetX && currentLastFloatingColumn < columns - 1) { currentFirstFloatingColumn = currentLastFloatingColumn currentFirstFloatingColumnScrollOffset -= (columnWidth + horizontalSpacing) } @@ -183,7 +183,7 @@ internal fun measureLazyTable( currentCellAxisOffsetY += rowHeight + verticalSpacing currentLastFloatingRow++ - if (currentCellAxisOffsetY <= minOffsetY && currentLastFloatingRow != rows - 1) { + if (currentCellAxisOffsetY <= minOffsetY && currentLastFloatingRow < rows - 1) { currentFirstFloatingRow = currentLastFloatingRow currentFirstFloatingRowScrollOffset -= (rowHeight + verticalSpacing) } @@ -317,7 +317,7 @@ internal fun measureLazyTable( firstVisibleCellPosition = IntOffset(currentFirstFloatingColumn, currentFirstFloatingRow), cellsScrollOffset = IntOffset( -currentFirstFloatingColumnScrollOffset, - -currentFirstFloatingRowScrollOffset + -currentFirstFloatingRowScrollOffset, ), pinnedColumns = pinnedColumns, pinnedRows = pinnedRows, @@ -330,10 +330,10 @@ internal fun measureLazyTable( ) return LazyTableMeasureResult( - firstFloatingCell = measuredItemProvider.getAndMeasure(currentFirstFloatingColumn, currentFirstFloatingRow), + firstFloatingCell = measuredItemProvider.getAndMeasureOrNull(currentFirstFloatingColumn, currentFirstFloatingRow), firstFloatingCellScrollOffset = IntOffset( currentFirstFloatingColumnScrollOffset, - currentFirstFloatingRowScrollOffset + currentFirstFloatingRowScrollOffset, ), canVerticalScrollForward = currentLastFloatingRow < rows || currentCellAxisOffsetY > maxOffsetY, canVerticalScrollBackward = currentFirstFloatingRowScrollOffset > 0 || currentFirstFloatingRow > 0, diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasuredItemProvider.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasuredItemProvider.kt index cb6134bed..2052c9e48 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasuredItemProvider.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableMeasuredItemProvider.kt @@ -84,6 +84,14 @@ internal abstract class LazyTableMeasuredItemProvider( } } + fun getAndMeasureOrNull(column: Int, row: Int): LazyTableMeasuredItem? { + if (column >= columns - 1 || row >= rows - 1) { + return null + } + + return getAndMeasure(column, row) + } + fun getRowHeight(row: Int): Int = getAndMeasure(0, row).size.height fun getColumnWidth(column: Int): Int = getAndMeasure(column, 0).size.width diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableScope.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableScope.kt index d32e6780c..070f2dddc 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableScope.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/table/LazyTableScope.kt @@ -13,7 +13,15 @@ public interface LazyTableScope { public fun cells( type: (columnKey: Any, rowKey: Any) -> Any? = { _, _ -> null }, content: @Composable LazyTableItemScope.(columnKey: Any, rowKey: Any) -> Unit, - ) + ): LazyTableCells +} + +public interface LazyTableCells { + + public fun type(columnKey: Any, rowKey: Any): Any? + + @Composable + public fun LazyTableItemScope.content(columnKey: Any, rowKey: Any) } public fun LazyTableScope.columnDefinition(key: Any) { diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt index d27b083a4..039ad798e 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt @@ -69,6 +69,9 @@ import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.IconButtonColors import org.jetbrains.jewel.ui.component.styling.IconButtonMetrics import org.jetbrains.jewel.ui.component.styling.IconButtonStyle +import org.jetbrains.jewel.ui.component.styling.LazyTableColors +import org.jetbrains.jewel.ui.component.styling.LazyTableMetrics +import org.jetbrains.jewel.ui.component.styling.LazyTableStyle import org.jetbrains.jewel.ui.component.styling.LazyTreeColors import org.jetbrains.jewel.ui.component.styling.LazyTreeIcons import org.jetbrains.jewel.ui.component.styling.LazyTreeMetrics @@ -189,6 +192,7 @@ internal fun createBridgeComponentStyling( textAreaStyle = readTextAreaStyle(textAreaTextStyle, textFieldStyle.metrics), textFieldStyle = textFieldStyle, tooltipStyle = readTooltipStyle(), + lazyTableStyle = readLazyTableStyle(), undecoratedDropdownStyle = readUndecoratedDropdownStyle(menuStyle, dropdownTextStyle), ) } @@ -1020,6 +1024,24 @@ private fun readTooltipStyle() = ), ) +private fun readLazyTableStyle() = + LazyTableStyle( + colors = LazyTableColors( + background = retrieveColorOrUnspecified("Table.background"), + backgroundSelected = retrieveColorOrUnspecified("Table.selectionBackground"), + backgroundInactiveSelected = retrieveColorOrUnspecified("Table.inactiveSelectionBackground"), + foreground = retrieveColorOrUnspecified("Table.foreground"), + foregroundSelected = retrieveColorOrUnspecified("Table.selectionForeground"), + foregroundInactiveSelected = retrieveColorOrUnspecified("Table.inactiveSelectionForeground"), + gridColor = retrieveColorOrUnspecified("Table.gridColor"), + stripeColor = retrieveColorOrUnspecified("Table.stripeColor"), + headerBackground = retrieveColorOrUnspecified("TableHeader.background"), + headerForeground = retrieveColorOrUnspecified("TableHeader.foreground"), + headerSeparatorColor = retrieveColorOrUnspecified("TableHeader.separatorColor"), + ), + metrics = LazyTableMetrics(), + ) + private fun readIconButtonStyle(): IconButtonStyle = IconButtonStyle( metrics = IconButtonMetrics( diff --git a/int-ui/int-ui-standalone/api/int-ui-standalone.api b/int-ui/int-ui-standalone/api/int-ui-standalone.api index e5a47847d..53041f494 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -177,6 +177,14 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonS public static final fun light-8v1krLo (Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors$Companion;JJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTableStylingKt { + public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle; + public static final fun dark-Zw1t1dA (Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors$Companion;JJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LazyTableMetrics$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LazyTableMetrics; + public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle; + public static final fun light-Zw1t1dA (Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors$Companion;JJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStylingKt { public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; public static final fun dark-v1fvUNM (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors$Companion;JJJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors; @@ -334,10 +342,10 @@ public final class org/jetbrains/jewel/intui/standalone/theme/IntUiThemeKt { public static final fun IntUiTheme (Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition;Lorg/jetbrains/jewel/ui/ComponentStyling;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V public static final fun IntUiTheme (ZZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V public static final fun createDefaultTextStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;)Landroidx/compose/ui/text/TextStyle; - public static final fun dark (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; + public static final fun dark (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun darkThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; public static final fun default (Lorg/jetbrains/jewel/ui/ComponentStyling;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/ComponentStyling; - public static final fun light (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; + public static final fun light (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun lightThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTableStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTableStyling.kt index 01e21f1b5..546320fee 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTableStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTableStyling.kt @@ -7,8 +7,6 @@ import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.ui.component.styling.LazyTableColors import org.jetbrains.jewel.ui.component.styling.LazyTableMetrics import org.jetbrains.jewel.ui.component.styling.LazyTableStyle -import kotlin.math.max -import kotlin.math.min @Composable public fun LazyTableStyle.Companion.light(): LazyTableStyle = diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/reflection/Views.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/reflection/Views.kt index 808003428..71da22d06 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/reflection/Views.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/reflection/Views.kt @@ -9,13 +9,14 @@ import java.nio.file.Files import java.nio.file.Paths import kotlin.io.path.absolutePathString import kotlin.io.path.name +import kotlin.reflect.jvm.javaMethod import kotlin.reflect.jvm.kotlinFunction internal fun findViews(packageName: String): List { - val path = "/" + packageName.replace('.', '/').removePrefix("/") + val path = packageName.replace('.', '/').removePrefix("/") - val uri = Class.forName("org.jetbrains.jewel.samples.standalone.reflection.ViewsKt") - .getResource(path)?.toURI() ?: return emptyList() + val uri = ::findViews.javaMethod?.declaringClass?.classLoader?.getResource(path)?.toURI() + ?: return emptyList() val directory = if (uri.scheme == "jar") { val fileSystem = try { diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tables.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tables.kt index 8ce786ee8..ac3cf1e20 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tables.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tables.kt @@ -1,5 +1,6 @@ package org.jetbrains.jewel.samples.standalone.view.component +import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row @@ -8,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope @@ -16,9 +18,13 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import kotlinx.coroutines.launch +import org.jetbrains.jewel.foundation.lazy.draggable.draggableItem +import org.jetbrains.jewel.foundation.lazy.draggable.draggableLayout import org.jetbrains.jewel.foundation.lazy.table.LazyTable import org.jetbrains.jewel.foundation.lazy.table.LazyTableCellSize import org.jetbrains.jewel.foundation.lazy.table.fixedHeight +import org.jetbrains.jewel.foundation.lazy.table.rememberLazyTableColumnDraggingState +import org.jetbrains.jewel.foundation.lazy.table.rememberLazyTableRowDraggingState import org.jetbrains.jewel.foundation.lazy.table.rememberLazyTableState import org.jetbrains.jewel.foundation.lazy.table.rememberTableHorizontalScrollbarAdapter import org.jetbrains.jewel.foundation.lazy.table.rememberTableVerticalScrollbarAdapter @@ -31,31 +37,74 @@ import org.jetbrains.jewel.ui.component.Text import org.jetbrains.jewel.ui.component.TextField import org.jetbrains.jewel.ui.component.VerticalScrollbar +data class RowKey(val row: Int) { + + override fun toString(): String { + return row.toString() + } + + override fun equals(other: Any?): Boolean { + return other is RowKey && other.row == row + } +} + +data class ColumnKey(val column: Int) { + + override fun toString(): String { + return column.toString() + } + + override fun equals(other: Any?): Boolean { + return other is ColumnKey && other.column == column + } +} + @Composable @View(title = "Tables", position = 12, icon = "icons/dataTables.svg") fun Tables() { - var columns by remember { mutableStateOf(1000) } - var rows by remember { mutableStateOf(1000) } + var columns = remember { + mutableStateListOf().apply { + repeat(1000) { add(it) } + } + } + var rows = remember { + mutableStateListOf().apply { + repeat(1000) { add(it) } + } + } + val state = rememberLazyTableState() + val draggableColumnState = rememberLazyTableColumnDraggingState( + state, + onMove = { from, to -> + columns.add(to, columns.removeAt(from)) + }, + ) + val draggableRowState = rememberLazyTableRowDraggingState( + state, + onMove = { from, to -> + rows.add(to, rows.removeAt(from)) + }, + ) Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.CenterVertically, ) { - OutlinedButton(onClick = { columns++ }) { + OutlinedButton(onClick = { columns.add(columns.size) }) { Text("Add column") } - OutlinedButton(onClick = { if (columns > 0) columns-- }) { + OutlinedButton(onClick = { if (columns.isNotEmpty()) columns.removeLast() }) { Text("Remove column") } - OutlinedButton(onClick = { rows++ }) { + OutlinedButton(onClick = { rows.add(rows.size) }) { Text("Add row") } - OutlinedButton(onClick = { if (rows > 0) rows-- }) { + OutlinedButton(onClick = { if (rows.isNotEmpty()) rows.removeLast() }) { Text("Remove row") } } @@ -66,15 +115,19 @@ fun Tables() { verticalAlignment = Alignment.CenterVertically, ) { OutlinedButton(onClick = { - rows = 0 - columns = 0 + rows.clear() + columns.clear() }) { Text("Clear") } OutlinedButton(onClick = { - rows = 1000 - columns = 1000 + rows.clear() + columns.clear() + repeat(1000) { + rows.add(it) + columns.add(it) + } }) { Text("Init") } @@ -121,7 +174,7 @@ fun Tables() { Box(Modifier.fillMaxSize()) { LazyTable( - modifier = Modifier, + modifier = Modifier.draggableLayout(), state = state, cellSize = LazyTableCellSize.fixedHeight(24.dp, minWidth = 24.dp), verticalArrangement = Arrangement.spacedBy(1.dp), @@ -129,24 +182,64 @@ fun Tables() { pinnedColumns = 1, pinnedRows = 1, ) { - columnDefinitions(columns) { - it + columnDefinitions(columns.size) { + ColumnKey(columns[it]) } - rowDefinitions(rows) { - it + rowDefinitions(rows.size) { + RowKey(rows[it]) } cells { columnKey, rowKey -> - val column = columnKey as? Int ?: return@cells - val row = rowKey as? Int ?: return@cells + val column = columnKey as? ColumnKey ?: return@cells + val row = rowKey as? RowKey ?: return@cells - if (column == 1 || row == 1) { - LazyTableHeader { - Text("$column, $row", Modifier.align(Alignment.CenterStart), maxLines = 1) + if (column.column == columns.first() || row.row == rows.first()) { + if (column.column == columns.first() && row.row != rows.first()) { + LazyTableHeader( + modifier = Modifier.draggableItem( + state = draggableColumnState, + key = column, + draggable = false, + orientation = Orientation.Horizontal, + ).draggableItem( + state = draggableRowState, + key = row, + orientation = Orientation.Vertical, + ), + ) { + Text("$column, $row", Modifier.align(Alignment.CenterStart), maxLines = 1) + } + } else { + LazyTableHeader( + modifier = Modifier.draggableItem( + state = draggableColumnState, + key = column, + orientation = Orientation.Horizontal, + ).draggableItem( + state = draggableRowState, + key = row, + draggable = false, + orientation = Orientation.Vertical, + ), + ) { + Text("$column, $row", Modifier.align(Alignment.CenterStart), maxLines = 1) + } } } else { - LazyTableCell { + LazyTableCell( + modifier = Modifier.draggableItem( + state = draggableColumnState, + key = column, + draggable = false, + orientation = Orientation.Horizontal, + ).draggableItem( + state = draggableRowState, + key = row, + draggable = false, + orientation = Orientation.Vertical, + ), + ) { Text("$column, $row", Modifier.align(Alignment.CenterStart), maxLines = 1) } } diff --git a/ui/api/ui.api b/ui/api/ui.api index 858533397..fff9caa83 100644 --- a/ui/api/ui.api +++ b/ui/api/ui.api @@ -25,7 +25,7 @@ public final class org/jetbrains/jewel/ui/ComponentStyling$DefaultImpls { public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrains/jewel/ui/ComponentStyling { public static final field $stable I - public fun (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;)V + public fun (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;)V public fun equals (Ljava/lang/Object;)Z public final fun getCheckboxStyle ()Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle; public final fun getChipStyle ()Lorg/jetbrains/jewel/ui/component/styling/ChipStyle; @@ -38,6 +38,7 @@ public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrain public final fun getGroupHeaderStyle ()Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle; public final fun getHorizontalProgressBarStyle ()Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle; public final fun getIconButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle; + public final fun getLazyTableStyle ()Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle; public final fun getLazyTreeStyle ()Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; public final fun getLinkStyle ()Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; public final fun getMenuStyle ()Lorg/jetbrains/jewel/ui/component/styling/MenuStyle; @@ -380,6 +381,11 @@ public final class org/jetbrains/jewel/ui/component/InputFieldState$Companion { public static synthetic fun of-raUdB0Y$default (Lorg/jetbrains/jewel/ui/component/InputFieldState$Companion;ZZZZZILjava/lang/Object;)J } +public final class org/jetbrains/jewel/ui/component/LazyTableKt { + public static final fun LazyTableCell (Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Alignment;Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun LazyTableHeader (Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Alignment;Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V +} + public final class org/jetbrains/jewel/ui/component/LazyTreeKt { public static final fun LazyTree (Lorg/jetbrains/jewel/foundation/lazy/tree/Tree;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/foundation/lazy/tree/TreeState;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/foundation/lazy/tree/KeyActions;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V } @@ -1316,6 +1322,52 @@ public abstract interface class org/jetbrains/jewel/ui/component/styling/InputFi public abstract fun getTextStyle ()Landroidx/compose/ui/text/TextStyle; } +public final class org/jetbrains/jewel/ui/component/styling/LazyTableColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors$Companion; + public synthetic fun (JJJJJJJJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getBackground-0d7_KjU ()J + public final fun getBackgroundInactiveSelected-0d7_KjU ()J + public final fun getBackgroundSelected-0d7_KjU ()J + public final fun getForeground-0d7_KjU ()J + public final fun getForegroundInactiveSelected-0d7_KjU ()J + public final fun getForegroundSelected-0d7_KjU ()J + public final fun getGridColor-0d7_KjU ()J + public final fun getHeaderBackground-0d7_KjU ()J + public final fun getHeaderForeground-0d7_KjU ()J + public final fun getHeaderSeparatorColor-0d7_KjU ()J + public final fun getStripeColor-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/LazyTableColors$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/LazyTableMetrics { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTableMetrics$Companion; + public fun ()V +} + +public final class org/jetbrains/jewel/ui/component/styling/LazyTableMetrics$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/LazyTableStyle { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle$Companion; + public fun (Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors;Lorg/jetbrains/jewel/ui/component/styling/LazyTableMetrics;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getColors ()Lorg/jetbrains/jewel/ui/component/styling/LazyTableColors; + public final fun getMetrics ()Lorg/jetbrains/jewel/ui/component/styling/LazyTableMetrics; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/LazyTableStyle$Companion { +} + public final class org/jetbrains/jewel/ui/component/styling/LazyTreeColors { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors$Companion; @@ -2364,6 +2416,7 @@ public final class org/jetbrains/jewel/ui/theme/JewelThemeKt { public static final fun getRadioButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle; public static final fun getScrollbarStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle; public static final fun getSliderStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/SliderStyle; + public static final fun getTableStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LazyTableStyle; public static final fun getTextAreaStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle; public static final fun getTextFieldStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle; public static final fun getTooltipStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle; diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTable.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTable.kt index 2327d4d1f..cc146c8e3 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTable.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTable.kt @@ -31,7 +31,7 @@ public fun LazyTableHeader( width = 1.dp, color = style.colors.headerSeparatorColor, ), - contentAlignment = contentAlignment + contentAlignment = contentAlignment, ) { CompositionLocalProvider( LocalContentColor provides style.colors.headerForeground, @@ -57,7 +57,7 @@ public fun LazyTableCell( width = 1.dp, color = style.colors.gridColor, ), - contentAlignment = contentAlignment + contentAlignment = contentAlignment, ) { CompositionLocalProvider( LocalContentColor provides style.colors.foreground,