Skip to content

Commit

Permalink
fix #946 Enhance datepicker: API to single days for deactivating etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jul 28, 2024
1 parent 074de3d commit 5bf1745
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ public SummaryPluginConfig(boolean removeOnEmptyData) {
this.removeOnEmptyData = removeOnEmptyData;
}

public static SummaryPluginConfig of(){
return new SummaryPluginConfig(DominoUIConfig.CONFIG.getUIConfig().isRemoveSummaryRecordsForEmptyTable());
public static SummaryPluginConfig of() {
return new SummaryPluginConfig(
DominoUIConfig.CONFIG.getUIConfig().isRemoveSummaryRecordsForEmptyTable());
}

public static SummaryPluginConfig of(boolean removeOnEmptyData){
public static SummaryPluginConfig of(boolean removeOnEmptyData) {
return new SummaryPluginConfig(removeOnEmptyData);
}

/**
* @return boolean, true will cause the plugin to remove the summary records for empty data
* tables, false will keep them, default to {@link DatatableConfig#isRemoveSummaryRecordsForEmptyTable()}
* tables, false will keep them, default to {@link
* DatatableConfig#isRemoveSummaryRecordsForEmptyTable()}
*/
public boolean isRemoveOnEmptyData() {
return removeOnEmptyData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,21 @@ public Calendar(Date date, DateTimeFormatInfo dateTimeFormatInfo, CalendarInitCo
this.dateTimeFormatInfo = dateTimeFormatInfo;
this.config = config;

this.root =
div()
.addCss(dui_calendar)
.apply(calendar -> header = LazyChild.of(CalendarHeader.create(this), calendar))
.appendChild(selectors = CalendarSelectors.create(this))
.appendChild(
calendarBody =
div()
.addCss(dui_calendar_body)
.appendChild(calendarMonth = CalendarMonth.create(this))
.appendChild(yearMonthPicker = YearMonthPicker.create(this).hide()))
.apply(
calendar ->
this.footer = LazyChild.of(div().addCss(dui_calendar_footer), calendar));
this.root = div().addCss(dui_calendar);

getConfig().getPlugins().forEach(plugin -> plugin.onInit(this));
init(this);

this.root
.apply(calendar -> header = LazyChild.of(CalendarHeader.create(this), calendar))
.appendChild(selectors = CalendarSelectors.create(this))
.appendChild(
calendarBody =
div()
.addCss(dui_calendar_body)
.appendChild(calendarMonth = CalendarMonth.create(this))
.appendChild(yearMonthPicker = YearMonthPicker.create(this).hide()))
.apply(calendar -> this.footer = LazyChild.of(div().addCss(dui_calendar_footer), calendar));

this.root.addEventListener(
CalendarCustomEvents.DATE_NAVIGATION_CHANGED,
Expand Down Expand Up @@ -168,11 +169,10 @@ public Calendar(Date date, DateTimeFormatInfo dateTimeFormatInfo, CalendarInitCo
calendarBody.removeCss(dui_p_x_1_5);
}
});
init(this);

onDateViewUpdate(this.date);
onDateSelectionChanged(this.date);
onDateTimeFormatChanged();
getConfig().getPlugins().forEach(plugin -> plugin.onInit(this));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.dominokit.domino.ui.datepicker;

import static org.dominokit.domino.ui.utils.Domino.*;
import static org.dominokit.domino.ui.utils.Domino.div;
import static org.dominokit.domino.ui.utils.Domino.span;

Expand Down Expand Up @@ -65,13 +64,6 @@ public CalendarDay(IsCalendar calendar, Date date, int day, boolean inRange) {

root =
div()
.addClickListener(
evt -> {
this.dispatchEvent(
CalendarCustomEvents.dateSelectionChanged(
new Date(this.date.getYear(), this.date.getMonth(), this.date.getDate())
.getTime()));
})
.addCss(
dui_calendar_day,
BooleanCssClass.of(dui_month_day_in_range, inRange),
Expand All @@ -84,6 +76,13 @@ public CalendarDay(IsCalendar calendar, Date date, int day, boolean inRange) {
.addCss(dui_calendar_day_number)
.textContent(String.valueOf(date.getDate())));
init(this);
addClickListener(
evt -> {
this.dispatchEvent(
CalendarCustomEvents.dateSelectionChanged(
new Date(this.date.getYear(), this.date.getMonth(), this.date.getDate())
.getTime()));
});
}

/**
Expand Down

0 comments on commit 5bf1745

Please sign in to comment.