Migration - KVision
source link: https://kvision.gitbook.io/kvision-guide/part-1-fundamentals/migration
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Migration
This is the list of incompatibilities you may encounter when migrating your application to KVision 3.13.x:
Due to changes in the Kotlin/JS gradle plugin for Kotlin 1.4.0 it is necessary to fix your
build.gradle.kts
file andwebpack.config.d/webpack.js
file. You can apply the following patch forbuild.gradle.kts
file and just copy new version ofwebpack.js
from the current template project (standard or fullstack, respectively).
Kotlinx.serialization
library 1.0.0 contains a lot of incompatible changes, so you have to migrate your code if you are using this library directly.Jed
was replaced bygettext.js
library. You can safely deletewebpack.config.d/jed.js
file. You need to make sure your*.po
files contain bothLanguage
andPlural forms
headers.All flexbox and grid CSS properties and enums have been moved to the
StyledComponent
and the core package. Deprecated type aliases for refactored enums were added. Follow deprecation messages to remove deprecated types from your code.If you are using fullstack configuration with Spring Boot add
extra["kotlin.version"] = "1.4.0"
to yourbuild.gradle.kts
file.
This is the list of incompatibilities you may encounter when migrating your application to KVision 3.5.x:
Due to changes in the Kotlin/JS gradle plugin it is necessary to fix your
build.gradle.kts
file andwebpack.config.d/webpack.js
file. Carefully analyze these changes for frontend projects and these changes for fullstack projects.Kotlinx.serialization
library 0.20.0 contains also some incompatible changes, so you have to migrate your code if you are using this library directly.
This is the list of incompatibilities you may encounter when migrating your application to KVision 3:
The
setEventListener()
method and theonEvent()
extension function return now anInt
instead of aWidget
. The returned value can be used withremoveEventListener(id: Int)
method.The old, deprecated
setEventListener()
method without type parameter has been removed. UseonEvent
instead.Problematic overloaded constructors for all css styling classes in the
core
package -Color
,Border
,Background
,TextDecoration and
TextShadow
has been removed. Each class has only one, primary constructor.There are two new factory extension functions for the
Color
class.Color.hex()
allows you to create aColor
object from a hexadecimalInt
literal.Color.name()
allows you to create aColor
object with anCol
enum value.The dependency on the Pac4J library has been removed. The
p.t.k.remote.Profile
class has been removed as well. You can add Pac4J to your own project if you still want to use it.Jooby has been updated to version 2.x. You need to upgrade your application if you are using Jooby integration. See upgrade docs.
This is the list of incompatibilities you may encounter when migrating your application to KVision 2:
All DSL builder functions have been moved out of the companion objects to allow better auto-completion in IntelliJ IDEA. This change is incompatible with KVision 1 code. To migrate you should just remove code based on this regular expression:
[^\.]+\.Companion\.
from all your frontend code imports (Kotlin compiler will help you easily find all possible errors afterwards).The default font size in Bootstrap 4 is larger. You may have to adjust your application layout manually or use a custom CSS theme.
The direct child of the
Root
component is no longer 100% wide. Usewidth = 100.perc
if you want it to be.The modules names have changed (the API of the components, package names, class names, methods and properties are mostly the same, with the differences described in details below).
KVision 1 module name | KVision 2+ module name |
kvision-select | kvision-bootstrap-select |
kvision-select-remote | kvision-bootstrap-select-remote |
kvision-datetime | kvision-bootstrap-datetime |
kvision-spinner | kvision-bootstrap-spinner |
kvision-upload | kvision-bootstrap-upload |
kvision-dialog | kvision-bootstrap-dialog |
Two new modules:
kvision-bootstrap-css
andkvision-fontawesome
were extracted from thekvision-bootstrap
module.The Glyphicons support is dropped. Use Font Awesome icons instead.
The Font Awesome icon names require a style prefix (
fas
,far
orfab
).Components like dropdown, context menu, modal, window, progressbar, navbar, toolbar, responsive grid, tab panel, tooltip and popover were moved into
kvision-bootstrap
module.ButtonStyle.DEFAULT
was removed. TheButtonStyle.PRIMARY
value is the new default. NewButtonStyle.SECONDARY
value is also available.RadioStyle.DEFAULT
andCheckBoxStyle.DEFAULT
were removed and are no longer necessary.The deprecated
Label
component was removed. UseSpan
component instead.TableType.CONDENSED
was removed. Use newTableType.SMALL
value instead.ButtonGroupStyle.JUSTIFIED
was removed. Use a different approach.The
responsive
property of theTable
component was removed. UseresponsiveType
property with a chosen enum value instead.The
dropup
property of theDropDown
component was removed. Use thedirection
property with aDirection.DROPUP
value instead.The
withCaret
parameter of theDropDown
component constructor was removed. No replacement at the moment.NavbarType.STATICTOP
was removed. UseNavbarType.STICKYTOP
instead.Do not use
Tag(TAG.LI)
components when creating links insideNav
component. UseLink
withnav-item
andnav-link
classes (or usenavLink
DSL builder function).When adding links to the
DropDown
orContextMenu
useLink
with adropdown-item
class (or useddLink
andcmLink
DSL builder functions respectively).GridSize.XS
was removed from theResponsiveGridPanel
component.The
buttonsType
is no longer a var property in theSpinner
and theSpinnerInput
components (changing its value didn't work anyway ;-)The
DateTime
andDateTimeInput
components are based on a new version of bootstrap-datetimepicker. Theweekstart
,todayhighlight
andshowmeridian
properties were removed. ThetodayBtn
andclearBtn
properties were renamed toshowTodayButton
andshowClear
respectively.The
ObservableList
class was moved frompl.treksoft.kvision.utils
topl.treksoft.kvision.state
package.The
StateBinding
component was moved frompl.treksoft.kvision.redux
topl.treksoft.kvision.state
package and is available in the main KVision module. It also can be used with any data source implementingObservableState
interface (e.g.ReduxStore
orObservableList
).The mapping of date and time classes between the client and the server code was significantly changed. The
pl.treksoft.kvision.types.Date
class is deprecated and not supported anymore. You should useLocalDateTime
,LocalDate
,LocalTime
,OffsetDateTime
andOffsetTime
frompl.treksoft.kvision.types
package instead. All of these classes are mapped tokotlin.js.Date
on the client side, but to the correspondingjava.time.*
class on the server side. This way you can easily use new Java types in your server side applications.The
pl.treksoft.kvision.hmr
package was removed and is not needed anymore. All KVision applications should now extendpl.treksoft.kvision.Application
class and are executed with newstartApplication()
function.ReduxStore.subscribe()
method calls the callback function once immediately right after the registration.Service functions for
SelectRemote
/TabulatorRemote
were changed to suspending. The function forSelectRemote
component takes additionalstate: String?
parameter.You are strongly encouraged to migrate your server-side interfaces common and frontend code with the help of the new KVision compiler plugin.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK