Skip to content

Commit a3b7078

Browse files
committed
tweaks and enhancements
1 parent cb60a05 commit a3b7078

File tree

17 files changed

+262
-85
lines changed

17 files changed

+262
-85
lines changed

domino-ui-shared/src/main/java/org/dominokit/domino/ui/style/GenericCss.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ public interface GenericCss {
381381

382382
CssClass dui_w_medium = () -> "dui-w-md";
383383

384+
CssClass dui_w_xmedium = () -> "dui-w-xmd";
385+
384386
CssClass dui_w_small = () -> "dui-w-sm";
385387

386388
CssClass dui_w_xsmall = () -> "dui-w-xs";
@@ -391,6 +393,8 @@ public interface GenericCss {
391393

392394
CssClass dui_h_medium = () -> "dui-h-md";
393395

396+
CssClass dui_h_xmedium = () -> "dui-h-xmd";
397+
394398
CssClass dui_h_small = () -> "dui-h-sm";
395399

396400
CssClass dui_h_xsmall = () -> "dui-h-xs";

domino-ui/src/main/java/org/dominokit/domino/ui/animations/Animation.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,28 @@ public Animation infinite() {
142142
return this;
143143
}
144144

145+
/**
146+
* Checks whether the animation is set to repeat infinitely.
147+
*
148+
* @return true if the animation repeats infinitely, false otherwise
149+
*/
150+
public boolean isInfinite() {
151+
return infinite;
152+
}
153+
154+
/**
155+
* Sets whether the animation should repeat infinitely or not.
156+
*
157+
* @param infinite boolean value indicating if the animation should repeat infinitely. Pass <code>
158+
* true</code> to make the animation repeat indefinitely, or <code>false</code> to disable
159+
* infinite repetition.
160+
* @return the current instance of the {@link Animation} class for method chaining.
161+
*/
162+
public Animation setInfinite(boolean infinite) {
163+
this.infinite = infinite;
164+
return this;
165+
}
166+
145167
/**
146168
* Sets the transition type for this animation.
147169
*

domino-ui/src/main/java/org/dominokit/domino/ui/button/ToggleButtonsGroup.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ public static ToggleButtonsGroup create(ToggleButton... buttons) {
7575

7676
@Override
7777
public void onItemToggle(ToggleButton toggleItem) {
78-
getButtons()
79-
.forEach(
80-
button -> {
81-
DomGlobal.console.info(button);
82-
});
83-
8478
if (getButtons().contains(toggleItem)) {
8579
if (isMultipleToggle()) {
8680
Set<ToggleButton> newValue =

domino-ui/src/main/java/org/dominokit/domino/ui/datatable/TableConfig.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.dominokit.domino.ui.elements.THeadElement;
3434
import org.dominokit.domino.ui.elements.TableRowElement;
3535
import org.dominokit.domino.ui.style.DominoCss;
36+
import org.dominokit.domino.ui.utils.ChildHandler;
3637
import org.dominokit.domino.ui.utils.HasMultiSelectionSupport;
3738

3839
/**
@@ -707,6 +708,17 @@ public TableConfig<T> setOnRowFinishEditHandler(Consumer<TableRow<T>> handler) {
707708
return this;
708709
}
709710

711+
/**
712+
* Adds a utility column to the table configuration by applying the specified handler.
713+
*
714+
* @param handler a ChildHandler instance that allows custom configuration of the utility column.
715+
* @return the updated TableConfig instance.
716+
*/
717+
public TableConfig<T> withUtilityColumn(ChildHandler<TableConfig<T>, ColumnConfig<T>> handler) {
718+
handler.apply(this, pluginUtilityColumn);
719+
return this;
720+
}
721+
710722
/** @return the handler to be called when a row editing finished. */
711723
Consumer<TableRow<T>> getOnRowFinishEditHandler() {
712724
return onRowFinishEditHandler;

domino-ui/src/main/java/org/dominokit/domino/ui/dialogs/DialogSize.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public enum DialogSize implements IsDialogSize {
4747
/** Medium dialog size. */
4848
MEDIUM(dui_w_medium, dui_h_medium),
4949

50+
/** Extra Medium dialog size. */
51+
XMEDIUM(dui_w_xmedium, dui_h_xmedium),
52+
5053
/** Large dialog size. */
5154
LARGE(dui_w_large, dui_h_large),
5255

domino-ui/src/main/java/org/dominokit/domino/ui/menu/AbstractMenuItem.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ private void onSelected(boolean silent) {
177177
SingleSelectionMode mode = getEffectiveSelectionMode();
178178

179179
// If we’re in multi-select & already selected, or in TOGGLE mode → deselect
180-
if ((parent.isMultiSelect() && selected) || (selected && mode == SingleSelectionMode.TOGGLE)) {
180+
if ((nonNull(parent) && parent.isMultiSelect() && selected)
181+
|| (selected && mode == SingleSelectionMode.TOGGLE)) {
181182
deselect(silent);
182183
}
183184
// Otherwise, if not selected (always select) or in RESELECT mode (re-select) → select
@@ -293,13 +294,14 @@ public AbstractMenuItem<V> deselect() {
293294
public AbstractMenuItem<V> select(boolean silent) {
294295
if (!isDisabled() && isSelectable()) {
295296
addCss(
296-
ConditionalCssClass.of(dui_menu_item_selected, () -> parent.isPreserveSelectionStyles()));
297+
ConditionalCssClass.of(
298+
dui_menu_item_selected, () -> nonNull(parent) && parent.isPreserveSelectionStyles()));
297299
setAttribute("selected", true);
298300
if (!silent) {
299301
triggerSelectionListeners(this, getSelection());
300302
}
301303
if (nonNull(parent)) {
302-
parent.onItemSelected(this, silent);
304+
parent.onItemSelected(this, silent, parent.isOpened());
303305
}
304306
}
305307
return this;
@@ -321,7 +323,7 @@ public AbstractMenuItem<V> deselect(boolean silent) {
321323
triggerDeselectionListeners(this, getSelection());
322324
}
323325
if (nonNull(parent)) {
324-
parent.onItemDeselected(this, silent);
326+
parent.onItemDeselected(this, silent, parent.isOpened());
325327
}
326328
}
327329
return this;
@@ -788,6 +790,20 @@ public Menu<V> getMenu() {
788790
return this.menu;
789791
}
790792

793+
@Override
794+
public AbstractMenuItem<V> remove() {
795+
if (nonNull(parent)) {
796+
parent.removeItem(this);
797+
} else {
798+
return super.remove();
799+
}
800+
return this;
801+
}
802+
803+
void doRemove() {
804+
super.remove();
805+
}
806+
791807
/**
792808
* Returns the underlying DOM element.
793809
*

domino-ui/src/main/java/org/dominokit/domino/ui/menu/Menu.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ public <I extends AbstractMenuItem<V>> Menu<V> insertGroup(
543543
*/
544544
public Menu<V> removeItem(AbstractMenuItem<V> menuItem) {
545545
if (this.menuItems.contains(menuItem)) {
546-
menuItem.remove();
546+
menuItem.doRemove();
547547
this.menuItems.remove(menuItem);
548548
}
549549
return this;
@@ -867,11 +867,11 @@ protected DivElement getMenuElement() {
867867
}
868868

869869
@Override
870-
protected void onItemSelected(AbstractMenuItem<V> item, boolean silent) {
870+
protected void onItemSelected(AbstractMenuItem<V> item, boolean silent, boolean shouldClose) {
871871
if (nonNull(parent)) {
872-
parent.onItemSelected(item, silent);
872+
parent.onItemSelected(item, silent, shouldClose);
873873
} else {
874-
if (isAutoCloseOnSelect() && !item.hasMenu()) {
874+
if (shouldClose && isAutoCloseOnSelect() && !item.hasMenu()) {
875875
close();
876876
PopupsCloser.close();
877877
}
@@ -893,11 +893,11 @@ protected void onItemSelected(AbstractMenuItem<V> item, boolean silent) {
893893
}
894894

895895
@Override
896-
protected void onItemDeselected(AbstractMenuItem<V> item, boolean silent) {
896+
protected void onItemDeselected(AbstractMenuItem<V> item, boolean silent, boolean shouldClose) {
897897
if (nonNull(parent)) {
898-
parent.onItemDeselected(item, silent);
898+
parent.onItemDeselected(item, silent, shouldClose);
899899
} else {
900-
if (isAutoCloseOnSelect() && !item.hasMenu()) {
900+
if (shouldClose && isAutoCloseOnSelect() && !item.hasMenu()) {
901901
close();
902902
PopupsCloser.close();
903903
}

domino-ui/src/main/java/org/dominokit/domino/ui/menu/base/BaseMenu.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,15 +1183,15 @@ private void applyTargetListeners(DropTarget menuTarget) {
11831183
* @param item The item that was selected.
11841184
* @param silent Indicates whether the selection was silent or should trigger events.
11851185
*/
1186-
protected abstract void onItemSelected(S item, boolean silent);
1186+
protected abstract void onItemSelected(S item, boolean silent, boolean shouldClose);
11871187

11881188
/**
11891189
* Handles the event when an item is deselected in the menu.
11901190
*
11911191
* @param item The item that was deselected.
11921192
* @param silent Indicates whether the deselection was silent or should trigger events.
11931193
*/
1194-
protected abstract void onItemDeselected(S item, boolean silent);
1194+
protected abstract void onItemDeselected(S item, boolean silent, boolean shouldClose);
11951195

11961196
/**
11971197
* Checks if the menu is configured to use the small screens direction for dropping.

domino-ui/src/main/java/org/dominokit/domino/ui/utils/AttributesObserver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* tracks the addition and removal of elements with specific attributes and dispatches events
3333
* accordingly.
3434
*/
35-
final class AttributesObserver {
35+
public final class AttributesObserver {
3636

3737
private static boolean ready = false;
3838
private static boolean paused = false;

0 commit comments

Comments
 (0)