Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @since 1.0
*/
@Tag("vaadin-accordion")
@NpmPackage(value = "@vaadin/accordion", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/accordion", version = "dev-disable-dates")
@JsModule("@vaadin/accordion/src/vaadin-accordion.js")
public class Accordion extends Component implements HasSize, HasStyle {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @since 1.0
*/
@Tag("vaadin-accordion-panel")
@NpmPackage(value = "@vaadin/accordion", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/accordion", version = "dev-disable-dates")
@JsModule("@vaadin/accordion/src/vaadin-accordion-panel.js")
public class AccordionPanel extends Details {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* @since 1.0
*/
@Tag("vaadin-app-layout")
@NpmPackage(value = "@vaadin/app-layout", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/app-layout", version = "dev-disable-dates")
@JsModule("@vaadin/app-layout/src/vaadin-app-layout.js")
public class AppLayout extends Component implements RouterLayout, HasStyle {
private static final PropertyDescriptor<String, String> primarySectionProperty = PropertyDescriptors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @since 2.0
*/
@Tag("vaadin-drawer-toggle")
@NpmPackage(value = "@vaadin/app-layout", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/app-layout", version = "dev-disable-dates")
@JsModule("@vaadin/app-layout/src/vaadin-drawer-toggle.js")
public class DrawerToggle extends Button {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @since 25.0
*/
@NpmPackage(value = "@vaadin/aura", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/aura", version = "dev-disable-dates")
public class Aura {
/**
* The path to the Aura stylesheet. Can be used as argument to a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/
@Tag("vaadin-avatar")
@JsModule("@vaadin/avatar/src/vaadin-avatar.js")
@NpmPackage(value = "@vaadin/avatar", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/avatar", version = "dev-disable-dates")
public class Avatar extends Component
implements HasStyle, HasSize, HasThemeVariant<AvatarVariant> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
*/
@Tag("vaadin-avatar-group")
@JsModule("@vaadin/avatar-group/src/vaadin-avatar-group.js")
@NpmPackage(value = "@vaadin/avatar-group", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/avatar-group", version = "dev-disable-dates")
public class AvatarGroup extends Component
implements HasStyle, HasSize, HasThemeVariant<AvatarGroupVariant> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* @since 25.1
*/
@Tag("vaadin-badge")
@NpmPackage(value = "@vaadin/badge", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/badge", version = "dev-disable-dates")
@JsModule("@vaadin/badge/src/vaadin-badge.js")
public class Badge extends Component implements HasAriaRole, HasSize, HasText,
HasThemeVariant<BadgeVariant> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @since 2.0.1
*/
@Tag("vaadin-board")
@NpmPackage(value = "@vaadin/board", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/board", version = "dev-disable-dates")
@JsModule("@vaadin/board/src/vaadin-board.js")
@Deprecated(since = "25.0", forRemoval = true)
public class Board extends Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @since 2.0.1
*/
@Tag("vaadin-board-row")
@NpmPackage(value = "@vaadin/board", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/board", version = "dev-disable-dates")
@JsModule("@vaadin/board/src/vaadin-board-row.js")
@Deprecated(since = "25.0", forRemoval = true)
public class Row extends Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* @since 25.2
*/
@Tag("vaadin-breadcrumbs")
@NpmPackage(value = "@vaadin/breadcrumbs", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/breadcrumbs", version = "dev-disable-dates")
@JsModule("@vaadin/breadcrumbs/src/vaadin-breadcrumbs.js")
public class Breadcrumbs extends Component implements HasSize, HasStyle,
HasAriaLabel, HasComponentsOfType<BreadcrumbsItem>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @since 25.2
*/
@Tag("vaadin-breadcrumbs-item")
@NpmPackage(value = "@vaadin/breadcrumbs", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/breadcrumbs", version = "dev-disable-dates")
@JsModule("@vaadin/breadcrumbs/src/vaadin-breadcrumbs-item.js")
public class BreadcrumbsItem extends Component
implements HasText, HasEnabled, HasPrefix {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* @since 1.0
*/
@Tag("vaadin-button")
@NpmPackage(value = "@vaadin/button", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/button", version = "dev-disable-dates")
@JsModule("@vaadin/button/src/vaadin-button.js")
public class Button extends Component
implements ClickNotifier<Button>, Focusable<Button>, HasAriaLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @since 24.7
*/
@Tag("vaadin-card")
@NpmPackage(value = "@vaadin/card", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/card", version = "dev-disable-dates")
@JsModule("@vaadin/card/src/vaadin-card.js")
public class Card extends Component implements HasSize, HasAriaLabel,
HasAriaRole, HasComponents, HasThemeVariant<CardVariant> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
* @since 6.0.1
*/
@Tag("vaadin-chart")
@NpmPackage(value = "@vaadin/charts", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/charts", version = "dev-disable-dates")
@JsModule("@vaadin/charts/src/vaadin-chart.js")
public class Chart extends Component implements HasStyle, HasSize, HasTheme {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
* @since 1.0
*/
@Tag("vaadin-checkbox")
@NpmPackage(value = "@vaadin/checkbox", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/checkbox", version = "dev-disable-dates")
@JsModule("@vaadin/checkbox/src/vaadin-checkbox.js")
public class Checkbox extends AbstractSinglePropertyField<Checkbox, Boolean>
implements ClickNotifier<Checkbox>, Focusable<Checkbox>, HasAriaLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
* @since 1.1
*/
@Tag("vaadin-checkbox-group")
@NpmPackage(value = "@vaadin/checkbox-group", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/checkbox-group", version = "dev-disable-dates")
@JsModule("@vaadin/checkbox-group/src/vaadin-checkbox-group.js")
public class CheckboxGroup<T>
extends AbstractSinglePropertyField<CheckboxGroup<T>, Set<T>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
* @since 1.0
*/
@Tag("vaadin-combo-box")
@NpmPackage(value = "@vaadin/combo-box", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/combo-box", version = "dev-disable-dates")
@JsModule("@vaadin/combo-box/src/vaadin-combo-box.js")
@JsModule("./flow-component-renderer.js")
@JsModule("./comboBoxConnector.js")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
* @since 23.2
*/
@Tag("vaadin-multi-select-combo-box")
@NpmPackage(value = "@vaadin/multi-select-combo-box", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/multi-select-combo-box", version = "dev-disable-dates")
@JsModule("@vaadin/multi-select-combo-box/src/vaadin-multi-select-combo-box.js")
@JsModule("./flow-component-renderer.js")
@JsModule("./comboBoxConnector.js")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* @since 1.0
*/
@Tag("vaadin-confirm-dialog")
@NpmPackage(value = "@vaadin/confirm-dialog", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/confirm-dialog", version = "dev-disable-dates")
@JsModule("@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js")
@ModalRoot
public class ConfirmDialog extends Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
*/
@SuppressWarnings("serial")
@Tag("vaadin-context-menu")
@NpmPackage(value = "@vaadin/context-menu", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/tooltip", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/context-menu", version = "dev-disable-dates")
@NpmPackage(value = "@vaadin/tooltip", version = "dev-disable-dates")
@JsModule("@vaadin/context-menu/src/vaadin-context-menu.js")
@JsModule("@vaadin/tooltip/src/vaadin-tooltip.js")
@JsModule("./flow-component-renderer.js")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @since 1.0
*/
@Tag("vaadin-crud")
@NpmPackage(value = "@vaadin/crud", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/crud", version = "dev-disable-dates")
@JsModule("@vaadin/crud/src/vaadin-crud.js")
@JsModule("@vaadin/crud/src/vaadin-crud-edit-column.js")
public class Crud<E> extends Component implements HasSize, HasTheme, HasStyle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @since 1.0
*/
@Tag("vaadin-custom-field")
@NpmPackage(value = "@vaadin/custom-field", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/custom-field", version = "dev-disable-dates")
@JsModule("@vaadin/custom-field/src/vaadin-custom-field.js")
public abstract class CustomField<T> extends AbstractField<CustomField<T>, T>
implements Focusable<CustomField<T>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@Tag("vaadin-dashboard")
@JsModule("@vaadin/dashboard/src/vaadin-dashboard.js")
@JsModule("./flow-component-renderer.js")
@NpmPackage(value = "@vaadin/dashboard", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/dashboard", version = "dev-disable-dates")
public class Dashboard extends Component
implements HasWidgets, HasSize, HasThemeVariant<DashboardVariant> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
@Tag("vaadin-dashboard-section")
@JsModule("@vaadin/dashboard/src/vaadin-dashboard-section.js")
@NpmPackage(value = "@vaadin/dashboard", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/dashboard", version = "dev-disable-dates")
public class DashboardSection extends Component implements HasWidgets {

private final List<DashboardWidget> widgets = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
@Tag("vaadin-dashboard-widget")
@JsModule("@vaadin/dashboard/src/vaadin-dashboard-widget.js")
@NpmPackage(value = "@vaadin/dashboard", version = "25.3.0-alpha2")
@NpmPackage(value = "@vaadin/dashboard", version = "dev-disable-dates")
public class DashboardWidget extends Component {

private int colspan = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2000-2026 Vaadin Ltd.
*
* 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.
*/
package com.vaadin.flow.component.datepicker;

import java.time.LocalDate;
import java.util.List;

import com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.router.Route;

/**
* Test page for a date picker that combines the two disabled-dates APIs: a
* fixed list of disabled dates and a per-date provider. January 2023 is shown,
* with January 10th and 20th disabled through the fixed list, and the 15th of
* every month disabled through the provider.
*/
@Route("vaadin-date-picker/date-picker-disabled-dates")
public class DatePickerDisabledDatesPage extends Div {

public static final int PROVIDER_DISABLED_DAY = 15;
public static final List<LocalDate> FIXED_DISABLED_DATES = List
.of(LocalDate.of(2023, 1, 10), LocalDate.of(2023, 1, 20));

Check warning on line 37 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/main/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfKEWR74vVuuK_n&open=AZ88jOfKEWR74vVuuK_n&pullRequest=9691

Check warning on line 37 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/main/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfKEWR74vVuuK_o&open=AZ88jOfKEWR74vVuuK_o&pullRequest=9691

public DatePickerDisabledDatesPage() {
DatePicker datePicker = new DatePicker();
datePicker.setId("date-picker");
datePicker.setI18n(new DatePickerI18n()
.setDateDisabledErrorMessage("Date is not available"));
// Show January 2023 when the overlay opens.
datePicker.setValue(LocalDate.of(2023, 1, 5));

Check warning on line 45 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/main/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesPage.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfKEWR74vVuuK_p&open=AZ88jOfKEWR74vVuuK_p&pullRequest=9691

// Fixed list of already-booked dates.
datePicker.setDisabledDates(FIXED_DISABLED_DATES);
// Provider: the 15th of every month.
datePicker.setDisabledDatesProvider(date -> {
System.out.println("Checking " + date);
return date.getDayOfMonth() == PROVIDER_DISABLED_DAY;
});

add(new Paragraph(
"Disabled: January 10 and 20, 2023 (fixed list); the 15th of every month (provider)."),
datePicker);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright 2000-2026 Vaadin Ltd.
*
* 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.
*/
package com.vaadin.flow.component.datepicker;

import java.time.LocalDate;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.vaadin.flow.component.datepicker.testbench.DatePickerElement;
import com.vaadin.flow.component.datepicker.testbench.DatePickerElement.MonthCalendarElement;
import com.vaadin.flow.testutil.TestPath;
import com.vaadin.tests.AbstractComponentIT;

@TestPath("vaadin-date-picker/date-picker-disabled-dates")
public class DatePickerDisabledDatesIT extends AbstractComponentIT {

private DatePickerElement datePicker;

@Before
public void init() {
open();
datePicker = $(DatePickerElement.class).id("date-picker");
}

@Test
public void openOverlay_fixedAndProviderDatesAreDisabled() {
datePicker.open();

MonthCalendarElement january = getJanuary2023();
// The provider resolves asynchronously; wait for the 15th to become
// disabled once the result arrives.
waitUntil(driver -> january.isDateDisabled(
DatePickerDisabledDatesPage.PROVIDER_DISABLED_DAY));

// Fixed disabled dates (January 10 and 20).
Assert.assertTrue("January 10 (fixed) should be disabled",
january.isDateDisabled(10));
Assert.assertTrue("January 20 (fixed) should be disabled",
january.isDateDisabled(20));
Assert.assertFalse("An unaffected date should remain enabled",
january.isDateDisabled(
DatePickerDisabledDatesPage.PROVIDER_DISABLED_DAY + 1));
}

@Test
public void selectProviderDisabledDate_fieldIsInvalid() {
datePicker.setDate(LocalDate.of(2023, 1,

Check warning on line 62 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfBEWR74vVuuK_j&open=AZ88jOfBEWR74vVuuK_j&pullRequest=9691
DatePickerDisabledDatesPage.PROVIDER_DISABLED_DAY));
Assert.assertTrue("A provider-disabled date should be invalid",
datePicker.getPropertyBoolean("invalid"));

datePicker.setDate(LocalDate.of(2023, 1,

Check warning on line 67 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfBEWR74vVuuK_k&open=AZ88jOfBEWR74vVuuK_k&pullRequest=9691
DatePickerDisabledDatesPage.PROVIDER_DISABLED_DAY + 1));
Assert.assertFalse("An enabled date should be valid",
datePicker.getPropertyBoolean("invalid"));
}

@Test
public void selectFixedDisabledDate_fieldIsInvalid() {
datePicker.setDate(LocalDate.of(2023, 1, 10));

Check warning on line 75 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfBEWR74vVuuK_l&open=AZ88jOfBEWR74vVuuK_l&pullRequest=9691
Assert.assertTrue("A fixed disabled date should be invalid",
datePicker.getPropertyBoolean("invalid"));

datePicker.setDate(LocalDate.of(2023, 1, 11));

Check warning on line 79 in vaadin-date-picker-flow-parent/vaadin-date-picker-flow-integration-tests/src/test/java/com/vaadin/flow/component/datepicker/DatePickerDisabledDatesIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=vaadin_flow-components&issues=AZ88jOfBEWR74vVuuK_m&open=AZ88jOfBEWR74vVuuK_m&pullRequest=9691
Assert.assertFalse("An enabled date should be valid",
datePicker.getPropertyBoolean("invalid"));
}

private MonthCalendarElement getJanuary2023() {
return datePicker.getOverlayContent().getVisibleMonthCalendars()
.stream()
.filter(calendar -> "January 2023"
.equals(calendar.getHeaderText()))
.findFirst().orElseThrow(() -> new AssertionError(
"January 2023 month calendar not found"));
}
}
Loading
Loading