-
Notifications
You must be signed in to change notification settings - Fork 0
Add Vaadin 25 support while maintaining Vaadin 24 compatibility #27
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
Open
paodb
wants to merge
8
commits into
master
Choose a base branch
from
vaadin-25-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d127e3c
refactor: use Java text blocks to improved JavaScript readability
paodb 31f4e45
refactor: add Vaadin 25 support
paodb 409a750
feat(demo): add AppShellConfiguratorImpl class
paodb bfc6605
refactor(demo): use separate stylesheets for Vaadin 25 compatibility
paodb c9183de
feat(demo): add simple change password validation
paodb 306972a
test: refactor tests to make them compatible with Vaadin 24 & 25
paodb 64cee53
refactor: move static methods from interface to utils class
paodb 040fdb4
ci: update Vaadin version to 25.0.6 in v25 profile
paodb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /*- | ||
| * #%L | ||
| * Extended Login Add-on | ||
| * %% | ||
| * Copyright (C) 2023 - 2026 Flowing Code | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package com.flowingcode.vaadin.addons.extendedlogin; | ||
|
|
||
| /** | ||
| * Utility class for LoginOverlay. | ||
| */ | ||
| class LoginOverlayUtils { | ||
|
|
||
| private LoginOverlayUtils() { | ||
| // Utility class | ||
| } | ||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the overlay wrapper element. | ||
| * Handles both Vaadin 24 and Vaadin 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the overlay wrapper | ||
| * @return the complete JavaScript string with the overlay wrapper lookup and | ||
| * the provided action | ||
| */ | ||
| static String getOverlayWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayWrapper) { | ||
| var loginOverlay = document.querySelector('vaadin-login-overlay'); | ||
| if (loginOverlay && loginOverlay.shadowRoot) { | ||
| overlayWrapper = loginOverlay.shadowRoot | ||
| .querySelector('vaadin-login-overlay-wrapper'); | ||
| } | ||
| } | ||
| if (!overlayWrapper) return; | ||
| %s | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the form element. Handles both | ||
| * Vaadin 24 and Vaadin 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the form | ||
| * @return the complete JavaScript string with the form lookup and the provided | ||
| * action | ||
| */ | ||
| static String getFormWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayFormWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayFormWrapper) { | ||
| overlayFormWrapper = document.querySelector('vaadin-login-overlay'); | ||
| } | ||
| if (!overlayFormWrapper) return; | ||
| var form = overlayFormWrapper.querySelector('form'); | ||
| if (form) { | ||
| %s | ||
| } | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
paodb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the form wrapper containing form | ||
| * elements. Handles both Vaadin 24 and Vaadin 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the form wrapper | ||
| * @return the complete JavaScript string with the form wrapper lookup and the | ||
| * provided action | ||
| */ | ||
| static String getLoginFormWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayWrapper) { | ||
| var loginOverlay = document.querySelector('vaadin-login-overlay'); | ||
| if (loginOverlay && loginOverlay.shadowRoot) { | ||
| overlayWrapper = loginOverlay.shadowRoot | ||
| .querySelector('vaadin-login-overlay-wrapper'); | ||
| } | ||
| } | ||
| if (!overlayWrapper) return; | ||
| var formWrapper = overlayWrapper.querySelector('vaadin-login-form-wrapper'); | ||
| if (!formWrapper) return; | ||
| %s | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/test/java/com/flowingcode/vaadin/addons/AppShellConfiguratorImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /*- | ||
| * #%L | ||
| * Extended Login Add-on | ||
| * %% | ||
| * Copyright (C) 2023 - 2026 Flowing Code | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package com.flowingcode.vaadin.addons; | ||
|
|
||
| import com.vaadin.flow.component.page.AppShellConfigurator; | ||
| import com.vaadin.flow.theme.Theme; | ||
|
|
||
| @Theme | ||
| public class AppShellConfiguratorImpl implements AppShellConfigurator { | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.