From 0b27b5cc069b231c3f65af1d9f0b3a9b1d81ab1c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 28 Oct 2020 13:51:24 +0600 Subject: [PATCH] Revert "start add recycler view" This reverts commit 347e9c32fe08e629525a01da2e5533368b44af5d. --- front/common/build.gradle | 15 -------- .../recycler_view/RecyclerViewAdapter.kt | 38 ------------------- .../front/recycler_view/RecyclerViewDrawer.kt | 8 ---- .../recycler_view/RecyclerViewElement.kt | 9 ----- mppJsProject | 30 --------------- 5 files changed, 100 deletions(-) delete mode 100644 front/common/build.gradle delete mode 100644 front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewAdapter.kt delete mode 100644 front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewDrawer.kt delete mode 100644 front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewElement.kt delete mode 100644 mppJsProject diff --git a/front/common/build.gradle b/front/common/build.gradle deleted file mode 100644 index ff8e10ce615..00000000000 --- a/front/common/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -plugins { - id "org.jetbrains.kotlin.multiplatform" -} - -apply from: "$mppJsProjectPresetPath" - -kotlin { - sourceSets { - commonMain { - dependencies { - api internalProject("micro_utils.common") - } - } - } -} diff --git a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewAdapter.kt b/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewAdapter.kt deleted file mode 100644 index c739befcd81..00000000000 --- a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewAdapter.kt +++ /dev/null @@ -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( - protected val data: List, - protected val drawer: RecyclerViewDrawer, - private val visibleOutsideOfViewportElements: Int = 1 -) { - val element: HTMLDivElement = document.createElement("div") as HTMLDivElement - protected val itemsToElements = mutableMapOf() - - 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 - } - } - } - - - } -} diff --git a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewDrawer.kt b/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewDrawer.kt deleted file mode 100644 index cd49756833a..00000000000 --- a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewDrawer.kt +++ /dev/null @@ -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) -} diff --git a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewElement.kt b/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewElement.kt deleted file mode 100644 index 2e88db5ff87..00000000000 --- a/front/common/src/jsMain/kotlin/dev/inmo/micro_utils/front/recycler_view/RecyclerViewElement.kt +++ /dev/null @@ -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() -} diff --git a/mppJsProject b/mppJsProject deleted file mode 100644 index 30529169b5d..00000000000 --- a/mppJsProject +++ /dev/null @@ -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') - } - } - } -}