You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2022/11/01 15:33:58 UTC
[myfaces-tobago] 04/04: feat(selectMany): minor improvements
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch t5_selectMany
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 113c2f30e4fb16feb5fe2ac36094a1b0e4810bf4
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 1 14:28:09 2022 +0100
feat(selectMany): minor improvements
* use boostrap events
* remove dropdown-toggle arrow
* form-control for inline=true
Issue: TOBAGO-2159
---
.../internal/renderkit/renderer/SelectManyRenderer.java | 9 +++++----
tobago-theme/src/main/scss/_tobago.scss | 6 +++++-
.../tobago-theme-standard/src/main/ts/tobago-dropdown.ts | 14 +++++++-------
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
index ae0216e2ff..112c4d34dc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
@@ -164,15 +164,16 @@ public class SelectManyRenderer<T extends AbstractUISelectMany> extends SelectMa
writer.writeNameAttribute(clientId);
HtmlRendererUtils.writeDataAttributes(facesContext, writer, component);
writer.writeClassAttribute(
- BootstrapClass.FORM_SELECT,
+ inline ? BootstrapClass.FORM_CONTROL : BootstrapClass.FORM_SELECT,
TobagoClass.FILTER__WRAPPER,
inline ? BootstrapClass.LIST_GROUP_ITEM : BootstrapClass.DROPDOWN_TOGGLE,
BootstrapClass.borderColor(ComponentUtils.getMaximumSeverity(component)),
component.getCustomClass());
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
- writer.writeAttribute(DataAttributes.BS_TOGGLE, "dropdown", false);
- writer.writeAttribute(DataAttributes.BS_AUTO_CLOSE, "outside", false);
- writer.writeAttribute(DataAttributes.BS_REFERENCE, "parent", false);
+ if (!inline) {
+ writer.writeAttribute(DataAttributes.BS_TOGGLE, "dropdown", false);
+ writer.writeAttribute(DataAttributes.BS_AUTO_CLOSE, "outside", false);
+ }
writer.writeAttribute(Arias.EXPANDED, Boolean.FALSE.toString(), false);
final Object[] values = component.getSelectedValues();
diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 962084e7e1..882bc1337e 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -1182,7 +1182,11 @@ tobago-select-many {
flex-wrap: wrap;
align-items: center;
- &.list-group-item.form-select {
+ &.dropdown-toggle::after {
+ content: none;
+ }
+
+ &.list-group-item.form-control {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
index 545b4d0152..a89102f0ed 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-dropdown.ts
@@ -18,19 +18,19 @@
import {MenuStore} from "./tobago-menu-store";
import {BootstrapEvents} from "./BootstrapEvents";
-const TobagoDropdownEvent = {
- HIDE: "tobago.dropdown.hide",
- HIDDEN: "tobago.dropdown.hidden",
- SHOW: "tobago.dropdown.show",
- SHOWN: "tobago.dropdown.shown"
-};
-
/**
* The dropdown implementation of Bootstrap does not move the menu to the tobago-page-menuStore. This behavior is
* implemented in this class.
*/
class Dropdown extends HTMLElement {
+ private readonly TobagoEvents = {
+ HIDE: "tobago.dropdown.hide",
+ HIDDEN: "tobago.dropdown.hidden",
+ SHOW: "tobago.dropdown.show",
+ SHOWN: "tobago.dropdown.shown"
+ };
+
constructor() {
super();
if (!this.classList.contains("tobago-dropdown-submenu")) { // ignore submenus