Giter Site home page Giter Site logo

oleksandrbalan / lazytable Goto Github PK

View Code? Open in Web Editor NEW
251.0 251.0 11.0 217 KB

Lazy layout to display columns and rows of data on the two directional plane.

License: Apache License 2.0

Kotlin 95.64% Shell 0.80% Ruby 0.33% Swift 1.99% HTML 1.25%

lazytable's Introduction

Hi there ๐Ÿ‘‹

My name is Alex, I am an Android developer, working at Etnetera Flow in Prague, Czech Republic.

Passionate about Kotlin and Compose ๐Ÿ˜ป

GitHub stats

linkedin twitter twitter

lazytable's People

Contributors

goooler avatar joshafeinberg avatar mattgraham1 avatar oleksandrbalan avatar wooodenleg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lazytable's Issues

Support for `contentPadding`

In my use case the table is full screen but as I've transparent navigation bars the table is displayed under the system bar. Would be nice if support for contentPadding: PaddingValues could be added so it can scroll from edge to edge.

Crash on snap/animate to cell

Good day,

I am using code very similar what is shown in here but I get a crash when I call the snapToCell (or animateToCell) method, like so:

kotlin.UninitializedPropertyAccessException: lateinit property positionProvider has not been initialized at eu.wewox.minabox.MinaBoxState.getPositionProvider(MinaBoxState.kt:53) at eu.wewox.lazytable.LazyTableState.getPositionProvider(LazyTableState.kt:53) at eu.wewox.lazytable.LazyTableState.getCellOffset-xEiAX8E(LazyTableState.kt:105) at eu.wewox.lazytable.LazyTableState.animateToCell(LazyTableState.kt:74) at eu.wewox.lazytable.LazyTableState.animateToCell$default(LazyTableState.kt:67) at com.salonbiz.library.views.FindTimesViewKt$FindTimesView$3$1.invokeSuspend(FindTimesView.kt:66)

I am unsure if I missing something, but it appears it should be creating the minabox.positionProvider, but it is not, hence the crash.

Any and all help appreciated. Thank you!

Using LazyTable 1.8.0 with Compose multi-platform 1.6.1.

LazyTable Can't be empty

You have to register some form of items() on creation otherwise the IntervalsList crashes. While it makes sense on the face of it, probably should not make that a hard requirement.

Table appears in the middle when using pinned config

Hi, I am trying to display the pinned table and hide the pin configuration it is not visible in the screen but the table is coming in the middle of the screen

Column(
                verticalArrangement = Arrangement.Top,
                horizontalAlignment = Alignment.CenterHorizontally,
                modifier = Modifier
                    .fillMaxSize()
                    .padding(it)
            ) {
                var settings by remember { mutableStateOf(Settings()) }

                if (itemWiseReport.isEmpty()) {
                    Text(text = "No Data Found")
                } else {
//                    Settings(
//                        settings = settings,
//                        onChange = { settings = it },
//                    )
                    LazyTable(
//                        pinConfiguration = pinConfiguration(settings),
//                        dimensions = dimensions(settings),
                        modifier = Modifier.fillMaxSize()

Vertically scroll

hi , have a problem when i try to scroll up or down with LazyTable it get me touch action and make scroll right or left , how can i solve this issue

Oddness of scroll near bottom

Good day,

I am using your LazyTable in an app, and I am getting odd scroll behavior when near the bottom of the table. Either it will not reach the bottom, or it jumps back up slightly when I reach the bottom. I have attached a video attempting to show the issue. Note I have set the background of the LazyTable to gray so you can see where the bounds are.

Note I am using it from shared code, for both Android and iOS using Compose MP 1.6.1. Of course on Android it is using the main latest Google Compose which is 1.6.5 currently.

I have mostly worked around it by adding 3 extra rows at the bottom, for Android. On iOS, this scroll issue does not occur, so in that case I do not add any extra rows.

I know it may be some issue with Compose that your LazyTable is using, but I am putting it here in hopes you have seen it, can reproduce it and/or create a fix in the library.

Note that in the video, the last time slot visible should be 6:30 PM.

screencapture-1712330708381.mp4

Thank you very much for the library and your assistance.

Resize Columns Automatically in LazyTable

Hello,

I'm using LazyTable for displaying value + unit data. However, I've run into a problem of data not fully displayed:

  • Variable Unit Length: Depending on the language, the unit text can sometimes be longer, causing misalignment in the cells.
  • Dealing with Large Values: When the values are large, they don't fit well within the standard cell width, getting cut off.

Is there a way to make the column width adjust automatically based on the content? This would help ensure that both longer unit texts and larger values are presented correctly.

Thanks a lot for your work on this library!

Add overscroll feature

It would be nice to let the user know when it is not possible to scroll on a certain direction and the usual pattern for this use case is the overscroll:

image

Currently there is no indication that the scroll gesture cannot be performed anymore when you reach the of a list on any direction.

LazyTable and androidx.paging:paging-compose

Hi, do you think it is possible to use LazyTable together with the official androidx.paging:paging-compose library?

We already use androidx.paging:paging-compose for normal LazyColumn and it would be great to be able to use it also with LazyTable since some of the table we need to display can have thousands of rows and fetching all the data at once isn't feasible.

Problem with scrollable column

So I have this:

Column(
   modifier = Modifier.verticalScroll(rememberScrollState())
) {
   ...
   LazyTable()
}

And this cause the exception.

When I do:

Column(
   modifier = Modifier.verticalScroll(rememberScrollState())
) {
   ...
   LazyTable(
      scrollDirection = LazyTableScrollDirection.HORIZONTAL
   )
}

It's still cause exception.

How so solve it?

Add ability to define footer row(s)

Hello ๐Ÿ‘‹
This library looks pretty slick, I'd love to use it in my project.

A common use case for tables is to display a footer, for example to show totals or averages:

Example - click to expand
student quiz 1 quiz 2 final exam
Alice 78% 84% 85%
Bob 87% 87% 85%
Carol 92% 87% 78%
Dave 88% 83% 82%
------- ------ ------ ----------
average 86% 85% 82%

Is it feasible to extend this project to allow a fixed footer row, similar to how a fixed header row is can be set?
Perhaps something like this:

Example - click to expand
public fun lazyTablePinConfiguration(
    columns: Int = 0,
    rows: Int = 0,
): LazyTablePinConfiguration { ... }

// could become
public fun lazyTablePinConfiguration(
    columns: Int = 0,
    rows: Int = 0,
    // the count of pinned footer rows
    endRows: Int = 0,
): LazyTablePinConfiguration { ... }

I did see #7, and the snippet provided there could be adapted to achieve this behavior. However showing a footer row is a very common use case for tables, and as such I believe it makes sense to add the capability to this library.

Crash with Compose 1.5.0-beta01

When trying to add a LazyTable the app crashes with:

java.lang.AbstractMethodError: abstract method "void androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider.Item(int, java.lang.Object, androidx.compose.runtime.Composer, int)"
 at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:138)
 at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt$SkippableItem$1.invoke(LazyLayoutItemContentFactory.kt:137)
 at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
 at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
 at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
 at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
 at androidx.compose.foundation.lazy.layout.LazySaveableStateHolder.SaveableStateProvider(LazySaveableStateHolder.kt:84)
 at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt.SkippableItem-JVlU9Rs(LazyLayoutItemContentFactory.kt:137)
 at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactoryKt.access$SkippableItem-JVlU9Rs(LazyLayoutItemContentFactory.kt:1)                                                                                     	

Programatically scroll to a column

Hi,
Thanks foe the great work of that library!

Is it possible to programmatically scroll the table in a direction? let's say Horizontally. where I need to scroll to a specific items or scroll to the very right of the table

UPDATE
Checked the code and managed to figure it out, I will keep it here in case someone needed it!
1.

val lazyTableState: LazyTableState = rememberLazyTableState()
LazyTable(
...
state = lazyTableState
)
 LaunchedEffect(Unit) {
    lazyTableState.snapToCell(column = 6, row = 0)
}

Support wasm JS target

Curious how hard supporting wasm JS target would be? I am currently using this control in Compose MP KMP library, and it is working well. But I would also like to support a wasm target, and since this is not supported in this library, I cannot yet either.

Allow to change the table's content alignment (or use standard TopStart alignment by default)

Right now a LazyTable will align its content to the its center, resulting in situations similar to this, when there are not items big enough to fill its size.

For example in the following screenshot the LazyTable is using .fillMaxSize().background(Color.Green.copy(alpha = 0.2f)) and the single cell has a fixed width and height, smaller than the size of the table:

image

It would be nice to be able to set the content alignment, in a similar way to what the LazyList offer:

    /** The alignment to align items horizontally */
    horizontalAlignment: Alignment.Horizontal? = null,
    /** The alignment to align items vertically */
    verticalAlignment: Alignment.Vertical? = null,

Alternatively, would it be possible to use the same alignment conventions as the LazyColumn and LazyRow, where the content is always aligned to the top start?

This way it will allow to use the .fillMaxSize(), .fillMaxWidth() and .fillMaxHeight() modifiers without having to be sure that the items inside will actually fill the entire size of the table.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.