Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-RC15'
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jan 12, 2023
2 parents c2a2a69 + a719272 commit 6c51965
Show file tree
Hide file tree
Showing 98 changed files with 4,731 additions and 1,379 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: Deploy

on:
push:
branches: [ master , development]
branches: [ master , development ]

jobs:
verify:
Expand Down
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>1.0.0-RC14</version>
<version>1.0.0-RC15</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>1.0.0-RC14</version>
<version>1.0.0-RC15</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>1.0.0-RC14</version>
<version>1.0.0-RC15</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion domino-ui-tools/theme-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>1.0.0-RC14</version>
<version>1.0.0-RC15</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>1.0.0-RC14</version>
<version>1.0.0-RC15</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>1.0.0-RC14</version>
<version>1.0.0-RC15</version>
</parent>

<artifactId>domino-ui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ private void animateElement() {

/** stops the animation and calls the {@link CompleteCallback} if it is set. */
public void stop() {
stop(false);
}

/** stops the animation and calls the {@link CompleteCallback} if it is set. */
public void stop(boolean silent) {
element.removeCss(transition.getStyle());
element.removeCss("animated");
element.removeCss("infinite");
Expand All @@ -235,7 +240,9 @@ public void stop() {
element.removeEventListener("mozAnimationEnd", stopListener);
element.removeEventListener("oanimationend", stopListener);
element.removeEventListener("animationend", stopListener);
callback.onComplete(element.element());
if (!silent) {
callback.onComplete(element.element());
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.dominokit.domino.ui.style.Styles;
import org.dominokit.domino.ui.utils.BaseDominoElement;
import org.dominokit.domino.ui.utils.DominoElement;
import org.dominokit.domino.ui.utils.ElementUtil;
import org.dominokit.domino.ui.utils.SwipeUtil;
import org.gwtproject.core.client.Scheduler;
import org.gwtproject.timer.client.Timer;
Expand Down Expand Up @@ -139,17 +138,15 @@ private void resetTimer() {
}

private void addDetachListener() {
ElementUtil.onDetach(
element(),
onDetached(
mutationRecord -> {
this.attached = false;
this.stopAutoSlide();
});
}

private void addAttachListener() {
ElementUtil.onAttach(
this.element(),
onAttached(
mutationRecord -> {
this.attached = true;
if (autoSlide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.dominokit.domino.ui.collapsible;

import static java.util.Objects.nonNull;

import elemental2.dom.HTMLElement;
import org.dominokit.domino.ui.animations.Animation;
import org.dominokit.domino.ui.animations.Transition;
Expand All @@ -31,6 +33,9 @@ public class AnimationCollapseStrategy implements CollapseStrategy {
private final Transition showTransition;
private final Transition hideTransition;
private final CollapseDuration duration;
private Animation hideAnimation;
private boolean showing = false;
private boolean hiding = false;

public AnimationCollapseStrategy(
Transition showTransition, Transition hideTransition, CollapseDuration duration) {
Expand All @@ -47,31 +52,52 @@ public AnimationCollapseStrategy(Transition transition, CollapseDuration duratio

/** {@inheritDoc} */
@Override
public void show(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
DominoElement.of(element).removeCss(duration.getStyle());
Animation.create(element)
.duration(duration.getDuration())
.transition(showTransition)
.beforeStart(
theElement -> {
style.removeCssProperty("display");
DominoElement.of(element).removeAttribute("d-collapsed");
})
.animate();
public void show(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
if (!showing) {
DominoElement.of(element).removeCss(duration.getStyle());
Animation.create(element)
.duration(duration.getDuration())
.transition(showTransition)
.beforeStart(
theElement -> {
showing = true;
if (nonNull(hideAnimation)) {
hideAnimation.stop(true);
hideAnimation = null;
hiding = false;
}
style.removeCssProperty("display");
DominoElement.of(element).removeAttribute("d-collapsed");
})
.callback(
e -> {
showing = false;
onCompleted.run();
})
.animate();
}
}

/** {@inheritDoc} */
@Override
public void hide(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
DominoElement.of(element).removeCss(duration.getStyle());
Animation.create(element)
.duration(duration.getDuration())
.transition(hideTransition)
.callback(
theElement -> {
style.setDisplay("none");
DominoElement.of(element).setAttribute("d-collapsed", "true");
})
.animate();
public void hide(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
if (!hiding) {
DominoElement.of(element).removeCss(duration.getStyle());
hideAnimation =
Animation.create(element)
.duration(duration.getDuration())
.transition(hideTransition)
.beforeStart(element1 -> hiding = true)
.callback(
theElement -> {
style.setDisplay("none");
DominoElement.of(element).setAttribute("d-collapsed", "true");
hiding = false;
onCompleted.run();
})
.animate();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,39 @@ default void init(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>
*
* @param element The collapsible {@link HTMLElement}
* @param style the {@link Style} of the element
* @param onCompleted the {@link Runnable} to be executed when the show operation is completed
*/
void show(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style);
void show(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted);
/**
* Implement this method to show a collapsible element
*
* @param element The collapsible {@link HTMLElement}
* @param style the {@link Style} of the element
*/
default void show(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
show(element, style, () -> {});
}

/**
* Implement this method to hide a collapsible element
*
* @param element The collapsible {@link HTMLElement}
* @param style the {@link Style} of the element
* @param onCompleted the {@link Runnable} to be executed when the hide operation is completed
*/
void hide(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted);

/**
* Implement this method to hide a collapsible element
*
* @param element The collapsible {@link HTMLElement}
* @param style the {@link Style} of the element
*/
void hide(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style);
default void hide(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
hide(element, style, () -> {});
}

/**
* Implement this method to clean up any attributes or styles added the strategy when we switch to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ public Collapsible show() {
@Override
public Collapsible hide() {
if (!forceHidden) {
strategy.hide(element, style);
strategy.hide(element, style, this::onHideCompleted);
element.setAttribute("aria-expanded", "false");
onHideCompleted();
this.collapsed = true;
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@ public class DisplayCollapseStrategy implements CollapseStrategy {

/** {@inheritDoc} */
@Override
public void show(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
public void show(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
style.removeCssProperty("display");
DominoElement.of(element).removeAttribute("d-collapsed");
onCompleted.run();
}

/** {@inheritDoc} */
@Override
public void hide(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
public void hide(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
style.setDisplay("none");
DominoElement.of(element).setAttribute("d-collapsed", "true");
onCompleted.run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,24 @@ public void cleanup(HTMLElement element, Style<HTMLElement, IsElement<HTMLElemen

/** {@inheritDoc} */
@Override
public void show(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
public void show(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
DominoElement.of(element)
.apply(
self -> {
if (self.isAttached()) {
expandElement(element, style);
expandElement(element, style, onCompleted);
} else {
self.onAttached(
mutationRecord -> {
expandElement(element, style);
expandElement(element, style, onCompleted);
});
}
});
}

private void expandElement(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {

DominoElement<HTMLElement> theElement = DominoElement.of(element);
if (!theElement.containsCss(CollapsibleStyles.HEIGHT_COLLAPSED)) {
Expand All @@ -87,6 +88,7 @@ private void expandElement(
String collapseHeight = element.getAttribute("dom-ui-collapse-height");
theElement.removeAttribute("dom-ui-collapse-height");
element.style.height = CSSProperties.HeightUnionType.of(collapseHeight);
onCompleted.run();
};
String scrollHeight = element.getAttribute(DOM_UI_SCROLL_HEIGHT);
AddEventListenerOptions addEventListenerOptions = AddEventListenerOptions.create();
Expand All @@ -107,18 +109,21 @@ private void expandElement(

/** {@inheritDoc} */
@Override
public void hide(HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style) {
public void hide(
HTMLElement element, Style<HTMLElement, IsElement<HTMLElement>> style, Runnable onCompleted) {
DominoElement.of(element)
.apply(
self -> {
if (self.isAttached()) {
collapseElement(element, style, true);
onCompleted.run();
} else {
self.onAttached(
mutationRecord -> {
style.removeCss(transition.getStyle());
collapseElement(element, style, false);
style.addCss(transition.getStyle());
onCompleted.run();
});
}
});
Expand Down
Loading

0 comments on commit 6c51965

Please sign in to comment.