Skip to content

Commit

Permalink
Merge branch 'release/2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jul 29, 2024
2 parents 8d9f2a1 + 723e9a0 commit 849d66b
Show file tree
Hide file tree
Showing 50 changed files with 960 additions and 172 deletions.
2 changes: 1 addition & 1 deletion domino-ui-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>domino-ui-parent</artifactId>
<groupId>org.dominokit</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion domino-ui-tools/mdi-icons-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>domino-ui-tools</artifactId>
<groupId>org.dominokit</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion domino-ui-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>domino-ui-parent</artifactId>
<groupId>org.dominokit</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion domino-ui-webjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>domino-ui-parent</artifactId>
<groupId>org.dominokit</groupId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion domino-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.dominokit</groupId>
<artifactId>domino-ui-parent</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
</parent>

<artifactId>domino-ui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@
import static org.dominokit.domino.ui.utils.Domino.*;

import elemental2.dom.HTMLDivElement;
import elemental2.dom.WheelEvent;
import java.util.ArrayList;
import java.util.List;
import jsinterop.base.Js;
import org.dominokit.domino.ui.config.CarouselConfig;
import org.dominokit.domino.ui.config.HasComponentConfig;
import org.dominokit.domino.ui.elements.AnchorElement;
import org.dominokit.domino.ui.elements.DivElement;
import org.dominokit.domino.ui.elements.OListElement;
import org.dominokit.domino.ui.events.EventType;
import org.dominokit.domino.ui.icons.lib.Icons;
import org.dominokit.domino.ui.style.CssClass;
import org.dominokit.domino.ui.style.GenericCss;
Expand All @@ -39,7 +44,8 @@
*
* @see BaseDominoElement
*/
public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel> {
public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel>
implements HasComponentConfig<CarouselConfig> {

private final OListElement indicatorsElement;
private final DivElement slidesElement;
Expand All @@ -57,6 +63,7 @@ public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel> {
private Slide targetSlide;
private int autoSlideDuration = 3000;
private boolean attached = false;
private CarouselConfig carouselConfig;

/**
* Factory method to create an empty Carousel
Expand All @@ -69,7 +76,6 @@ public static Carousel create() {

/** Creates and empty Carousel */
public Carousel() {

element =
div()
.appendChild(indicatorsElement = ol().addCss(carousel_indicators))
Expand All @@ -89,11 +95,7 @@ public Carousel() {
.appendChild(
Icons.chevron_right()
.addCss(GenericCss.dui_vertical_center, dui_font_size_12))
.addEventListener(
"click",
evt -> {
next();
}))
.addEventListener("click", evt -> next()))
.addCss(carousel);
timer =
new Timer() {
Expand All @@ -105,6 +107,21 @@ public void run() {
addAttachListener();
addDetachListener();
init(this);
addEventListener(
EventType.wheel.getName(),
evt -> {
if (getConfig().isScrollCarouselWithWheel()) {
evt.preventDefault();
WheelEvent wheelEvent = Js.uncheckedCast(evt);
if (wheelEvent.deltaY > 0) {
nextSlide();
}

if (wheelEvent.deltaY < 0) {
prevSlide();
}
}
});
}

/**
Expand Down Expand Up @@ -406,6 +423,16 @@ public Slide getActiveSlide() {
return activeSlide;
}

@Override
public CarouselConfig getOwnConfig() {
return carouselConfig;
}

public Carousel setConfig(CarouselConfig config) {
this.carouselConfig = config;
return this;
}

public enum SlideDirection {
NONE,
/** CSS class for previous indicator */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright © 2019 Dominokit
*
* 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 org.dominokit.domino.ui.config;

public interface CarouselConfig extends ComponentConfig {
/** @return boolean, true to allow scrolling a carousel with mouse scroll wheel. */
default boolean isScrollCarouselWithWheel() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright © 2019 Dominokit
*
* 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 org.dominokit.domino.ui.config;

public interface DatatableConfig extends ComponentConfig {
default boolean isRemoveSummaryRecordsForEmptyTable() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright © 2019 Dominokit
*
* 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 org.dominokit.domino.ui.config;

public interface DelayedActionConfig extends ComponentConfig {

/**
* Use to globally configure the delayed actions delay.
*
* @return the delay in milliseconds, default to 200ms
*/
default int getDelayedExecutionDefaultDelay() {
return 200;
}

/**
* Use to globally configure select/suggest box search box typeahead delay.
*
* @return the delay in milliseconds, default to 1000ms
*/
default int getDefaultSelectableBoxTypeAheadDelay() {
return 1000;
}

/**
* Use to globally configure Suggest box search box typeahead delay.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
*/
default int getSuggestBoxTypeAheadDelay() {
return getDefaultSelectableBoxTypeAheadDelay();
}

/**
* Use to globally configure Select box search box typeahead delay.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
*/
default int getSelectBoxTypeAheadDelay() {
return getDefaultSelectableBoxTypeAheadDelay();
}

/**
* Use to globally configure notification duration.
*
* @return the delay in milliseconds, default to 4000ms.
*/
default int getDefaultNotificationDuration() {
return 4000;
}

/**
* Use to globally configure the delay before a datebox start parsing the value while tying in the
* date box input.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDelayedExecutionDefaultDelay()}.
*/
default int getDateBoxDefaultInputParseDelay() {
return getDelayedExecutionDefaultDelay();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.dominokit.domino.ui.config;

import static java.util.Objects.nonNull;

import org.dominokit.domino.ui.utils.DominoUIConfig;

/** HasComponentConfig interface. */
Expand All @@ -25,6 +27,13 @@ public interface HasComponentConfig<T extends ComponentConfig> {
* @return a T object
*/
default T getConfig() {
if (nonNull(getOwnConfig())) {
return getOwnConfig();
}
return (T) DominoUIConfig.CONFIG.getUIConfig();
}

default T getOwnConfig() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Implementations of this interface can be used to configure defaults for {@link
* org.dominokit.domino.ui.search.SearchBox} component
*/
public interface SearchConfig extends ComponentConfig {
public interface SearchConfig extends DelayedActionConfig {

/**
* Use this method to define the default auto search delay for SearchBox in milliseconds
Expand All @@ -29,7 +29,7 @@ public interface SearchConfig extends ComponentConfig {
* @return an integer delay in milliseconds
*/
default int getAutoSearchDelay() {
return 200;
return getDelayedExecutionDefaultDelay();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ public interface UIConfig
UploadConfig,
StepperConfig,
CalendarConfig,
TimePickerConfig {}
TimePickerConfig,
DelayedActionConfig,
DatatableConfig,
CarouselConfig {}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,15 @@ default FilePreviewFactory getFilePreviewFactory() {
default Supplier<FilePreviewContainer<?, ?>> getDefaultFilePreviewContainer() {
return DefaultFilePreviewContainer::new;
}

/**
* when the user uploaded a set of files that are less or equals the max uploads allowed, and they
* are already uploaded, should we allow him to upload a new set of files that are in total with
* the previous batch could overflow the max allowed upload limit.
*
* @return boolean default true
*/
default boolean isMaxUploadsOverflowAllowed() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,15 @@ public List<ColumnConfig<T>> getFlattenColumns() {
.collect(Collectors.toList());
}

/**
* Retrieves only the leaf columns of the data table.
*
* @return A list of {@link ColumnConfig} representing all columns, flattened.
*/
public List<ColumnConfig<T>> getLeafColumns() {
return columns.stream().flatMap(col -> col.leafColumns().stream()).collect(Collectors.toList());
}

/**
* Retrieves the columns of the DataTable as grouped.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static java.util.Objects.nonNull;
import static org.dominokit.domino.ui.datatable.DataTableStyles.dui_datatable_column_filter;
import static org.dominokit.domino.ui.datatable.DataTableStyles.dui_datatable_row;
import static org.dominokit.domino.ui.utils.Domino.*;

import elemental2.dom.HTMLElement;
Expand Down Expand Up @@ -55,6 +56,7 @@ public class ColumnHeaderFilterPlugin<T> implements DataTablePlugin<T> {
@Override
public void init(DataTable<T> dataTable) {
this.datatable = dataTable;
this.filtersRowElement.addCss(dui_datatable_row);
}

/**
Expand Down
Loading

0 comments on commit 849d66b

Please sign in to comment.