Vaadin Flow 4.0.0.beta1 is a prerelease of the Java Framework targeted to Vaadin 17. To try it out, use the latest 17 prerelease available from the Vaadin prereleases Maven repository.
New features in 4.0
TypeScript API for form binding and validation
The @vaadin/form
package includes the Binder
API to create forms in TypeScript with lit-html templates. It includes helpers to save and load data, bind data to the UI template, update the form state reactively, and run validation (based on Java Bean validation constraints). See more details in the docs.
Live browser reload when using Java hot-swap tools
When using HotswapAgent, Spring Boot Devtools, or JRebel, the browser is now automatically refreshed as soon as the Java changes have been compiled.
Extended URL parameters support
Parameters in the middle of the URL (#2740) and multiple optional parameters (#4213) are now supported.
Add support for Unit in similar fashion to Vaadin 8 (#8533)
When we have been doing migration assessments of various customer projects, we have learned that usage of methods like setWidth(float width, Unit unit)
in Vaadin 8 are rather popular. In order to make migration of such applications easier and support legacy style of setting sizes of components it is useful to have this feature in Flow HasSize
as well.
Basic LitTemplate support based on LitElement for Java UIs (#8041)
Supports @id mapping in the same way as PolymerTemplate. Contrary to PolymerTemplate, contains no special support for template in template, @uses or a template model. For more details see the PR #8041.
Behavior or Incompatible Changes
The PWA install prompt feature was removed because it will not be supported other browsers than Chrome. The parameter enableInstallPrompt
was removed from the @PWA
annotation. See more details from #8038.
New data binding API for components
Component's are now have an API for getting and manipulating of the in-memory data, such as exporting data, traversing between items, add/remove operations, and more (#8074).
Lazy data loading components have now an ability to set only a data fetch callback with no knowledge of item count, as well as an API for lazy loading customisation (#8052).
Support for the paged repositories (#8557).
Data fetching from the paged repositories becomes easier with a page number and page size getters. This information can be obtained from a Query
parameter within the fetch and count callbacks.
New mixin interface for components with label definition (#3241)
HasLabel
mixin interface has been added to provide the Components with a setter and getter for a label definition.
Adding a way to mark the fields as required (#8551)
Made more clear for the developer how to mark a field as required when defining custom field validators in TypeScript Binder
API.
Adding a feature to populate the component with any bean (#7307, #7308)
The methods for setting the whole bean, list or map have been added to Element API
. This allows the developer to get rid of multiple setProperty calls for particular bean fields.
Vaadin Maven Plugin enhancements (#8603, #8603)
Adding a way to specify the node download URL from the Vaadin Maven Plugin
and exposing the settings node.version
and node.download
.
Binder's clear method enhancements (#8619)
Calling Binder::clear()
now resets the default value to 'empty' and clears all validation errors.
@PastOrPresent and @FutureOrPresent validation (#8684)
Broken client-side validation for @PastOrPresent
and @FutureOrPresent
has been removed (in favor of server-side-only validation).
Default validation message in annotations is passed to client (#8385)
Default JSR-380 error messages are now used in client-side validators.
Component::addListener registrations have been made idempotent (#8506)
IllegalArgumentException
is not thrown now when calling remove()
method multiple times on a Registration
returned from Component::addListener
(or its derivates).
Binder's error messaging enhancements (#8631)
Server-side error message now is shown on bound form fields if Binder::submitTo
fails.
Adding a method to retrieve the LocationChangeEvent from an AfterNavigationEvent (#8727)
The AfterNavigationEvent
now has an access to the LocationChangeEvent
so as to easily retrieve the UI
instance.
Add LocalTime type support in Endpoints (#8737)
LocalTime is now a supported type in Endpoint, and <vaadin-time-picker>
can be used in a TypeScript form.
Deprecations and Incompatible Changes since 3.1
A new API for Binding Items to Components:
HasDataProvider
andHasItems
are now replaced by newHasListDataView
,HasLazyDataView
andHasDataView
interfaces inGrid
,Select
andCheckBoxGroup
. It will be also gradually replaced in other components which have an items binding.setDataProvider()
is now deprecated and overloadedsetItems
methods are recommended to use.setItems
methods now have a return type instead of void.HasItemsAndComponents
interface has been replaced byHasItemComponents
in order to support the Data View API in in-memory binding components.HasHierarchicalDataProvider
no longer hassetItems
overloads forCollection
,Stream
andArray
.
URL parameters template feature:
BeforeEvent
has a bunch of new methods for forwarding, rerouting and getting the parameters. Some methods are now deprecated or removed.RouteRegistry
,SessionRouteRegistry
interfaces are now supplemented with new methods and deprecate getters for route layouts.com.vaadin.flow.server.startup.RouteTarget
has been completely removed. This class was internal and should not have been used by anyone. In case you have been using it, please create an issue describing what you needed it for.
PWA install popup feature removed:
The HTML API beforeinstallprompt
that is a basis for this feature, has been removed from the spec w3c/manifest#835 as Safari and Mozilla will not implement it. This means that the only way to install the app will be by “from UI provided by the browser”, not the app/website. So as this feature would not be supported in all browsers, it has been removed from Vaadin. PWA::enableInstallPrompt
, PwaConfiguration::isInstallPromptEnabled
and PwaRegistry::getInstallPrompt
have been removed accordingly. The users should install the app through the browsers menu instead.