diff options
3 files changed, 13 insertions, 1 deletions
diff --git a/kvision-modules/kvision-tabulator/build.gradle b/kvision-modules/kvision-tabulator/build.gradle index 5ea97e50..b74ef2d4 100644 --- a/kvision-modules/kvision-tabulator/build.gradle +++ b/kvision-modules/kvision-tabulator/build.gradle @@ -8,7 +8,7 @@ dependencies { kotlinFrontend { npm { - dependency("tabulator-tables", "4.2.5") + dependency("tabulator-tables", "4.2.7") devDependency("karma", "3.1.4") devDependency("karma-chrome-launcher", "2.2.0") devDependency("karma-webpack", "3.0.5") diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt index 906b0c82..7a9ef0ed 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt @@ -355,6 +355,7 @@ data class ColumnDefinition<T : Any>( internal object EditorRoot { internal var root: Root? = null + internal var cancel: ((value: dynamic) -> Unit)? = null internal var disposeTimer: Int? = null } @@ -379,6 +380,7 @@ fun <T : Any> ColumnDefinition<T>.toJs( root?.dispose() disposeTimer = null root = null + EditorRoot.cancel = null }, 500) }, cancel, data) val rootElement = document.createElement("div") as HTMLElement @@ -388,6 +390,7 @@ fun <T : Any> ColumnDefinition<T>.toJs( root?.dispose() } root = Root(element = rootElement) + EditorRoot.cancel = cancel @Suppress("UnsafeCastFromDynamic") root?.add(component) (component as? FormControl)?.focus() diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt index ed803109..c609a400 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt @@ -37,6 +37,8 @@ import pl.treksoft.kvision.utils.JSON import pl.treksoft.kvision.utils.createInstance import pl.treksoft.kvision.utils.obj import pl.treksoft.kvision.utils.syncWithList +import redux.RAction +import kotlin.browser.window import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator import redux.RAction import pl.treksoft.kvision.redux.* @@ -528,6 +530,13 @@ open class Tabulator<T : Any>( jsTabulator?.navigateDown() } + internal fun removeCustomEditors() { + EditorRoot.cancel?.invoke(null) + EditorRoot.disposeTimer?.let { window.clearTimeout(it) } + EditorRoot.root?.dispose() + EditorRoot.root = null + } + companion object { internal var counter = 0 |