Revert "start add recycler view"

This reverts commit 347e9c32fe.
This commit is contained in:
InsanusMokrassar 2020-10-28 13:51:24 +06:00
parent 347e9c32fe
commit 0b27b5cc06
5 changed files with 0 additions and 100 deletions

View File

@ -1,15 +0,0 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
}
apply from: "$mppJsProjectPresetPath"
kotlin {
sourceSets {
commonMain {
dependencies {
api internalProject("micro_utils.common")
}
}
}
}

View File

@ -1,38 +0,0 @@
package dev.inmo.micro_utils.front.recycler_view
import dev.inmo.micro_utils.common.isOnScreen
import kotlinx.browser.document
import org.w3c.dom.HTMLDivElement
abstract class RecyclerViewAdapter<T>(
protected val data: List<T>,
protected val drawer: RecyclerViewDrawer,
private val visibleOutsideOfViewportElements: Int = 1
) {
val element: HTMLDivElement = document.createElement("div") as HTMLDivElement
protected val itemsToElements = mutableMapOf<T, RecyclerViewElement>()
abstract fun createViewFactory(element: T): RecyclerViewElement
fun updateVisibleElements() {
var firstVisibleElementIndex = -1
var lastVisibleElementIndex = -1
for ((i, item) in data.withIndex()) {
itemsToElements[item] ?.let {
firstVisibleElementIndex = when {
firstVisibleElementIndex == -1 -> i
it.element.isOnScreen -> minOf(firstVisibleElementIndex, i)
else -> firstVisibleElementIndex
}
lastVisibleElementIndex = when {
lastVisibleElementIndex == -1 -> i
it.element.isOnScreen -> maxOf(lastVisibleElementIndex, i)
else -> lastVisibleElementIndex
}
}
}
}
}

View File

@ -1,8 +0,0 @@
package dev.inmo.micro_utils.front.recycler_view
import org.w3c.dom.HTMLElement
interface RecyclerViewDrawer {
fun drawBefore(what: HTMLElement, before: HTMLElement)
fun drawAfter(what: HTMLElement, after: HTMLElement)
}

View File

@ -1,9 +0,0 @@
package dev.inmo.micro_utils.front.recycler_view
import org.w3c.dom.HTMLElement
interface RecyclerViewElement {
val element: HTMLElement
suspend fun onOutsideOfViewport()
suspend fun onInsideOfViewport()
}

View File

@ -1,30 +0,0 @@
project.version = "$version"
project.group = "$group"
apply from: "$publishGradlePath"
kotlin {
js (BOTH) {
browser()
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
implementation kotlin('test-junit')
}
}
}
}