-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign FormLayout component #2201
Labels
Milestone
Comments
KremnevDmitry
added
breaking changes
Fix brings breaking changes in code or behavior
in: flowui
labels
Sep 4, 2023
This was referenced Sep 4, 2023
Studio ticket: https://youtrack.jmix.io/issue/JST-4259/Support-redesign-FormLayout-component |
KremnevDmitry
added a commit
that referenced
this issue
Sep 7, 2023
This was referenced Sep 20, 2023
KremnevDmitry
added a commit
that referenced
this issue
Sep 25, 2023
KremnevDmitry
added a commit
that referenced
this issue
Oct 6, 2023
- Hide the formItem if the nested component is unavailable due to security permissions
Tested all described cases on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
How it worked in 2.0
The
FormLayout
component has two methods for adding internal components:add(Component)
,addFormItem(Component, Label)
.When added via
add
: components will be added as is.Adding via
addFormItem
allows you to display the labelASIDE
.The
FormLayout
component has alabelPosition
attribute.The
formLayoytLoader
works in such a way that iflabelPosition
attribute is specified explicitly, then theaddFormItem
method is used, otherwise useadd
method.Why did we decide to change this?
This caused the following issues: #1989
If you use
responsiveSteps
with differentlabelPositions
, they will be ignored, because components were added via theadd
method.Let me remind you:
labelPosition=ASIDE
only works with wrappedformItem
components.In #1989 a wrapper of all components in
formItem
was implemented so thatlabelPosition = ASIDE
would always work.Why did we decide to change this again?
This caused the following problems: #2186
Another problem: changing the
visible
attribute for a component does not change its for theirformItem
.Thus, there may be a case where the user has hidden a component, but its
label
remains on the view because thelabel
is part of theformItem
.FormItem
reserves space for labels, even if they arenull
.So always using a wrapper is a bad idea.
It was decided to explicitly indicate the formItem in the XML markup if it is needed.
Thus, we will not hide the features of the implementation from users.
Also, Java API and XML will be consistent.
Please note: in order to hide a component with its
FormItem
, you must use the util method:io.jmix.flowui.kit.component.ComponentUtils#setVisible
Here are some examples of how it will work now
Case 1 (probably the most commonly used) [No BreakingChanges]
In this case, the components will be added via the
add
method andlabelPosition = TOP
as default value.If users want to hide a component, or disable it, they can do so in the XML or through the controller by injecting the component directly.
Everything will work transparently.
Case 2 [Has BreakingChanges]
By specifying
labelPosition=ASIDE
, users will have to wrap the components in aformItem
themselves.This way users will know when they are hiding a component and when they are hiding a
FormItem
.Case 3 (ResponsiveSteps with TOP labelPosition) [No BreakingChanges]
In this case,
responsiveSteps
will work correctly, because theformLayout
will not have to change thelabelPosition
attribute depending on the currentresponsiveStep
.Case 4 (ResponsiveSteps with ASIDE labelPosition) [Has BreakingChanges]
In this case, the user is implying that components should always have a
labelPosition=ASIDE
.You need to wrap the components in a
FormItem
for it.Case 5 [Has BreakingChanges]
In this case, the components need to be wrapped in a
FormItem
because theFormItem
is responsible for displaying the label on theTOP
andASIDE
.Thus BREAKING CHANGES only if any
labelPosition=ASIDE
settings were usedThe text was updated successfully, but these errors were encountered: