diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-09-24 12:41:05 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-09-24 12:42:48 +0200 |
commit | 1f5bf15ffdf6d11e0c48e78fee563f4bca77c202 (patch) | |
tree | 95916623af7b7c19dbec49af55f24c848ea24383 | |
parent | 5921f49346953731e32200935a1efb7e6b1a3218 (diff) | |
download | kvision-1f5bf15ffdf6d11e0c48e78fee563f4bca77c202.tar.gz kvision-1f5bf15ffdf6d11e0c48e78fee563f4bca77c202.tar.bz2 kvision-1f5bf15ffdf6d11e0c48e78fee563f4bca77c202.zip |
Upgrade Tabulator to 4.4.1 (#87)
4 files changed, 55 insertions, 4 deletions
diff --git a/kvision-modules/kvision-tabulator/build.gradle b/kvision-modules/kvision-tabulator/build.gradle index 6959fec5..19da0553 100644 --- a/kvision-modules/kvision-tabulator/build.gradle +++ b/kvision-modules/kvision-tabulator/build.gradle @@ -7,7 +7,7 @@ dependencies { kotlinFrontend { npm { - dependency("tabulator-tables", "4.2.7") + dependency("tabulator-tables", "4.4.1") 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 416148e3..27911e52 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 @@ -88,7 +88,8 @@ enum class Formatter(internal val formatter: String) { BUTTONTICK("buttonTick"), BUTTONCROSS("buttonCross"), ROWNUM("rownum"), - HANDLE("handle") + HANDLE("handle"), + ROWSELECTION("rowSelection") } /** @@ -336,6 +337,8 @@ data class ColumnDefinition<T : Any>( val headerFilterFunc: Filter? = null, val headerFilterFuncParams: dynamic = null, val headerFilterLiveFilter: Boolean? = null, + val htmlOutput: Boolean? = null, + val print: Boolean? = null, val cellClick: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null, val cellDblClick: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null, val cellContext: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null, @@ -492,6 +495,8 @@ fun <T : Any> ColumnDefinition<T>.toJs( if (headerFilterFunc != null) this.headerFilterFunc = headerFilterFunc.filter if (headerFilterFuncParams != null) this.headerFilterFuncParams = headerFilterFuncParams if (headerFilterLiveFilter != null) this.headerFilterLiveFilter = headerFilterLiveFilter + if (htmlOutput != null) this.htmlOutput = htmlOutput + if (print != null) this.print = print if (cellClick != null) this.cellClick = cellClick if (cellDblClick != null) this.cellDblClick = cellDblClick if (cellContext != null) this.cellContext = cellContext @@ -596,6 +601,19 @@ data class TabulatorOptions<T : Any>( val locale: String? = null, var langs: dynamic = null, val localized: ((locale: String, lang: dynamic) -> Unit)? = null, + val headerVisible: Boolean? = null, + val htmlOutputConfig: dynamic = null, + val printAsHtml: Boolean? = null, + val printConfig: dynamic = null, + val printCopyStyle: Boolean? = null, + val printVisibleRows: Boolean? = null, + val printHeader: String? = null, + val printFooter: String? = null, + val printFormatter: ((tableHolder: dynamic, table: dynamic) -> Unit)? = null, + val tabEndNewRow: dynamic = null, + val headerSort: Boolean? = null, + val headerSortTristate: Boolean? = null, + val invalidOptionWarnings: Boolean? = null, val dataTree: Boolean? = null, val dataTreeChildField: String? = null, val dataTreeCollapseElement: dynamic = null, @@ -782,6 +800,19 @@ fun <T : Any> TabulatorOptions<T>.toJs( if (locale != null) this.locale = locale if (langs != null) this.langs = langs if (localized != null) this.localized = localized + if (headerVisible != null) this.headerVisible = headerVisible + if (htmlOutputConfig != null) this.htmlOutputConfig = htmlOutputConfig + if (printAsHtml != null) this.printAsHtml = printAsHtml + if (printConfig != null) this.printConfig = printConfig + if (printCopyStyle != null) this.printCopyStyle = printCopyStyle + if (printVisibleRows != null) this.printVisibleRows = printVisibleRows + if (printHeader != null) this.printHeader = printHeader + if (printFooter != null) this.printFooter = printFooter + if (printFormatter != null) this.printFormatter = printFormatter + if (tabEndNewRow != null) this.tabEndNewRow = tabEndNewRow + if (headerSort != null) this.headerSort = headerSort + if (headerSortTristate != null) this.headerSortTristate = headerSortTristate + if (invalidOptionWarnings != null) this.invalidOptionWarnings = invalidOptionWarnings if (dataTree != null) this.dataTree = dataTree if (dataTreeChildField != null) this.dataTreeChildField = dataTreeChildField if (dataTreeCollapseElement != null) this.dataTreeCollapseElement = dataTreeCollapseElement 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 290f9f39..054bd9ee 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 @@ -324,9 +324,27 @@ open class Tabulator<T : Any>( /** * Get the HTML code of the table. * @param activeOnly include only visible rows + * @param isStyled return styled output + * @param htmlOutputConfig override output configuration * @return the HTML code of the table */ - open fun getHtml(activeOnly: Boolean = false): String? = jsTabulator?.getHtml(activeOnly) + open fun getHtml( + activeOnly: Boolean = false, + isStyled: Boolean = false, + htmlOutputConfig: dynamic = null + ): String? = jsTabulator?.getHtml(activeOnly, isStyled, htmlOutputConfig) + + /** + * Print the table. + * @param activeOnly include only visible rows + * @param isStyled styled output + * @param printConfig override print configuration + */ + open fun print( + activeOnly: Boolean = false, + isStyled: Boolean = false, + printConfig: dynamic = null + ): Unit? = jsTabulator?.print(activeOnly, isStyled, printConfig) /** * Scroll to the row given by id. diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/js/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/js/Tabulator.kt index 11e37266..ea7c917f 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/js/Tabulator.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/js/Tabulator.kt @@ -66,7 +66,9 @@ open external class Tabulator { ): Array<Any> = definedExternally - open fun getHtml(activeOnly: Boolean? /*= null*/): String = definedExternally + open fun getHtml(activeOnly: Boolean? /*= null*/, isStyled: Boolean?, htmlOutputConfig: dynamic): String = definedExternally + open fun print(activeOnly: Boolean?, isStyled: Boolean?, printConfig: dynamic): Unit = definedExternally + open fun getAjaxUrl(): String = definedExternally open fun replaceData( data: dynamic /* String | Array<Any?> */ /*= null*/, |