Skip to content

Commit 849d66b

Browse files
committed
Merge branch 'release/2.0.2'
2 parents 8d9f2a1 + 723e9a0 commit 849d66b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+960
-172
lines changed

domino-ui-shared/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>domino-ui-parent</artifactId>
77
<groupId>org.dominokit</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
</parent>
1010
<packaging>jar</packaging>
1111
<modelVersion>4.0.0</modelVersion>

domino-ui-tools/mdi-icons-processor/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>domino-ui-tools</artifactId>
77
<groupId>org.dominokit</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

domino-ui-tools/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>domino-ui-parent</artifactId>
77
<groupId>org.dominokit</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

domino-ui-webjar/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>domino-ui-parent</artifactId>
77
<groupId>org.dominokit</groupId>
8-
<version>2.0.1</version>
8+
<version>2.0.2</version>
99
</parent>
1010
<packaging>jar</packaging>
1111
<modelVersion>4.0.0</modelVersion>

domino-ui/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.dominokit</groupId>
88
<artifactId>domino-ui-parent</artifactId>
9-
<version>2.0.1</version>
9+
<version>2.0.2</version>
1010
</parent>
1111

1212
<artifactId>domino-ui</artifactId>

domino-ui/src/main/java/org/dominokit/domino/ui/carousel/Carousel.java

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@
1919
import static org.dominokit.domino.ui.utils.Domino.*;
2020

2121
import elemental2.dom.HTMLDivElement;
22+
import elemental2.dom.WheelEvent;
2223
import java.util.ArrayList;
2324
import java.util.List;
25+
import jsinterop.base.Js;
26+
import org.dominokit.domino.ui.config.CarouselConfig;
27+
import org.dominokit.domino.ui.config.HasComponentConfig;
2428
import org.dominokit.domino.ui.elements.AnchorElement;
2529
import org.dominokit.domino.ui.elements.DivElement;
2630
import org.dominokit.domino.ui.elements.OListElement;
31+
import org.dominokit.domino.ui.events.EventType;
2732
import org.dominokit.domino.ui.icons.lib.Icons;
2833
import org.dominokit.domino.ui.style.CssClass;
2934
import org.dominokit.domino.ui.style.GenericCss;
@@ -39,7 +44,8 @@
3944
*
4045
* @see BaseDominoElement
4146
*/
42-
public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel> {
47+
public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel>
48+
implements HasComponentConfig<CarouselConfig> {
4349

4450
private final OListElement indicatorsElement;
4551
private final DivElement slidesElement;
@@ -57,6 +63,7 @@ public class Carousel extends BaseDominoElement<HTMLDivElement, Carousel> {
5763
private Slide targetSlide;
5864
private int autoSlideDuration = 3000;
5965
private boolean attached = false;
66+
private CarouselConfig carouselConfig;
6067

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

7077
/** Creates and empty Carousel */
7178
public Carousel() {
72-
7379
element =
7480
div()
7581
.appendChild(indicatorsElement = ol().addCss(carousel_indicators))
@@ -89,11 +95,7 @@ public Carousel() {
8995
.appendChild(
9096
Icons.chevron_right()
9197
.addCss(GenericCss.dui_vertical_center, dui_font_size_12))
92-
.addEventListener(
93-
"click",
94-
evt -> {
95-
next();
96-
}))
98+
.addEventListener("click", evt -> next()))
9799
.addCss(carousel);
98100
timer =
99101
new Timer() {
@@ -105,6 +107,21 @@ public void run() {
105107
addAttachListener();
106108
addDetachListener();
107109
init(this);
110+
addEventListener(
111+
EventType.wheel.getName(),
112+
evt -> {
113+
if (getConfig().isScrollCarouselWithWheel()) {
114+
evt.preventDefault();
115+
WheelEvent wheelEvent = Js.uncheckedCast(evt);
116+
if (wheelEvent.deltaY > 0) {
117+
nextSlide();
118+
}
119+
120+
if (wheelEvent.deltaY < 0) {
121+
prevSlide();
122+
}
123+
}
124+
});
108125
}
109126

110127
/**
@@ -406,6 +423,16 @@ public Slide getActiveSlide() {
406423
return activeSlide;
407424
}
408425

426+
@Override
427+
public CarouselConfig getOwnConfig() {
428+
return carouselConfig;
429+
}
430+
431+
public Carousel setConfig(CarouselConfig config) {
432+
this.carouselConfig = config;
433+
return this;
434+
}
435+
409436
public enum SlideDirection {
410437
NONE,
411438
/** CSS class for previous indicator */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright © 2019 Dominokit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.dominokit.domino.ui.config;
17+
18+
public interface CarouselConfig extends ComponentConfig {
19+
/** @return boolean, true to allow scrolling a carousel with mouse scroll wheel. */
20+
default boolean isScrollCarouselWithWheel() {
21+
return false;
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright © 2019 Dominokit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.dominokit.domino.ui.config;
17+
18+
public interface DatatableConfig extends ComponentConfig {
19+
default boolean isRemoveSummaryRecordsForEmptyTable() {
20+
return false;
21+
}
22+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright © 2019 Dominokit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.dominokit.domino.ui.config;
17+
18+
public interface DelayedActionConfig extends ComponentConfig {
19+
20+
/**
21+
* Use to globally configure the delayed actions delay.
22+
*
23+
* @return the delay in milliseconds, default to 200ms
24+
*/
25+
default int getDelayedExecutionDefaultDelay() {
26+
return 200;
27+
}
28+
29+
/**
30+
* Use to globally configure select/suggest box search box typeahead delay.
31+
*
32+
* @return the delay in milliseconds, default to 1000ms
33+
*/
34+
default int getDefaultSelectableBoxTypeAheadDelay() {
35+
return 1000;
36+
}
37+
38+
/**
39+
* Use to globally configure Suggest box search box typeahead delay.
40+
*
41+
* @return the delay in milliseconds, default to {@link
42+
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
43+
*/
44+
default int getSuggestBoxTypeAheadDelay() {
45+
return getDefaultSelectableBoxTypeAheadDelay();
46+
}
47+
48+
/**
49+
* Use to globally configure Select box search box typeahead delay.
50+
*
51+
* @return the delay in milliseconds, default to {@link
52+
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
53+
*/
54+
default int getSelectBoxTypeAheadDelay() {
55+
return getDefaultSelectableBoxTypeAheadDelay();
56+
}
57+
58+
/**
59+
* Use to globally configure notification duration.
60+
*
61+
* @return the delay in milliseconds, default to 4000ms.
62+
*/
63+
default int getDefaultNotificationDuration() {
64+
return 4000;
65+
}
66+
67+
/**
68+
* Use to globally configure the delay before a datebox start parsing the value while tying in the
69+
* date box input.
70+
*
71+
* @return the delay in milliseconds, default to {@link
72+
* DelayedActionConfig#getDelayedExecutionDefaultDelay()}.
73+
*/
74+
default int getDateBoxDefaultInputParseDelay() {
75+
return getDelayedExecutionDefaultDelay();
76+
}
77+
}

domino-ui/src/main/java/org/dominokit/domino/ui/config/HasComponentConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.dominokit.domino.ui.config;
1717

18+
import static java.util.Objects.nonNull;
19+
1820
import org.dominokit.domino.ui.utils.DominoUIConfig;
1921

2022
/** HasComponentConfig interface. */
@@ -25,6 +27,13 @@ public interface HasComponentConfig<T extends ComponentConfig> {
2527
* @return a T object
2628
*/
2729
default T getConfig() {
30+
if (nonNull(getOwnConfig())) {
31+
return getOwnConfig();
32+
}
2833
return (T) DominoUIConfig.CONFIG.getUIConfig();
2934
}
35+
36+
default T getOwnConfig() {
37+
return null;
38+
}
3039
}

0 commit comments

Comments
 (0)