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:54 UTC

[myfaces-tobago] branch t5_selectMany updated (cf1940d68d -> 113c2f30e4)

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a change to branch t5_selectMany
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


    from cf1940d68d feat: tc:selectMany
     new e7cba80185 build(deps): bump gson from 2.9.1 to 2.10 (#3367)
     new cda55429af refactor(typescript): MenuStore
     new 4e42969ff4 build(theme): rebuild after refactoring typescript (menuStore)
     new 113c2f30e4 feat(selectMany): minor improvements

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/renderkit/renderer/SelectManyRenderer.java   |  9 +++++----
 tobago-example/tobago-example-demo/pom.xml                |  2 +-
 tobago-theme/src/main/scss/_tobago.scss                   |  6 +++++-
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js  |  4 ++--
 .../tobago-theme-standard/src/main/js/tobago.js.map       |  2 +-
 .../tobago-theme-standard/src/main/ts/tobago-dropdown.ts  |  8 ++------
 .../src/main/ts/tobago-menu-store.ts                      | 15 ++++++---------
 .../tobago-theme-standard/src/main/ts/tobago-popover.ts   |  9 +++------
 .../tobago-theme-standard/src/main/ts/tobago-range.ts     |  5 -----
 .../tobago-theme-standard/src/main/ts/tobago-suggest.ts   |  8 ++------
 10 files changed, 27 insertions(+), 41 deletions(-)
 copy tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java => tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts (73%)


[myfaces-tobago] 04/04: feat(selectMany): minor improvements

Posted by hn...@apache.org.
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


[myfaces-tobago] 02/04: refactor(typescript): MenuStore

Posted by hn...@apache.org.
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 cda55429af8e61138fb1caaad0ff2c16455db41c
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 1 14:00:19 2022 +0100

    refactor(typescript): MenuStore
    
    Use dedicated MenuStore Typescript Class.
---
 .../src/main/ts/tobago-dropdown.ts                 | 22 +++++++---------
 .../src/main/ts/tobago-menu-store.ts               | 29 ++++++++++++++++++++++
 .../src/main/ts/tobago-popover.ts                  |  9 +++----
 .../src/main/ts/tobago-range.ts                    |  5 ----
 .../src/main/ts/tobago-suggest.ts                  |  8 ++----
 5 files changed, 43 insertions(+), 30 deletions(-)

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 c05adf9ba4..545b4d0152 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
@@ -15,21 +15,22 @@
  * limitations under the License.
  */
 
+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
@@ -48,7 +49,7 @@ class Dropdown extends HTMLElement {
     this.dispatchEvent(new CustomEvent(this.TobagoEvents.SHOW));
 
     if (!this.insideNavbar()) {
-      this.menuStore.appendChild(this.dropdownMenu);
+      MenuStore.appendChild(this.dropdownMenu);
     }
 
     this.dispatchEvent(new CustomEvent(this.TobagoEvents.SHOWN));
@@ -75,11 +76,6 @@ class Dropdown extends HTMLElement {
     const root = this.getRootNode() as ShadowRoot | Document;
     return root.querySelector(`.dropdown-menu[name='${this.id}']`);
   }
-
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
 }
 
 document.addEventListener("tobago.init", function (event: Event): void {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts
new file mode 100644
index 0000000000..2d988b0bf9
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-menu-store.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+export class MenuStore {
+  static appendChild<T extends Node>(node: T): T {
+    return MenuStore.get().appendChild(node);
+  }
+
+  static get(): HTMLDivElement {
+    const root = document.getRootNode() as ShadowRoot | Document;
+    return root.querySelector<HTMLDivElement>(".tobago-page-menuStore");
+  }
+}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
index 18558a1947..4a1b83167b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-popover.ts
@@ -20,6 +20,8 @@
 // import Popover from "bootstrap/dist/js/bootstrap.bundle";
 // import {createPopper} from "@popperjs/core/dist/esm/popper";
 import {Popover} from "bootstrap";
+import {MenuStore} from "./tobago-menu-store";
+
 // import {Popover} from "bootstrap/dist/js/bootstrap.bundle";
 
 class TobagoPopover extends HTMLElement {
@@ -32,18 +34,13 @@ class TobagoPopover extends HTMLElement {
 
   connectedCallback(): void {
     this.popover = new Popover(this.trigger, {
-      container: this.menuStore
+      container: MenuStore.get()
     });
   }
 
   get trigger(): HTMLElement {
     return this;
   }
-
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
 }
 
 document.addEventListener("tobago.init", function (event: Event): void {
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
index 0b99d0471c..dff2bf8139 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-range.ts
@@ -36,11 +36,6 @@ class TobagoRange extends HTMLElement {
     return this.querySelector(".tobago-tooltip");
   }
 
-  private get menuStore(): HTMLDivElement {
-    const root = this.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
-
   private updateTooltip(): void {
     this.tooltip.textContent = this.range.value;
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
index 2a55b517f5..7c6ae9a33f 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
@@ -17,6 +17,7 @@
 
 import Autocomplete from "@trevoreyre/autocomplete-js";
 import {SuggestFilter} from "./tobago-suggest-filter";
+import {MenuStore} from "./tobago-menu-store";
 
 export class Suggest {
 
@@ -86,7 +87,7 @@ export class Suggest {
 
     new Autocomplete(this.base, options);
     if (!this.localMenu) {
-      this.menuStore.append(this.resultList);
+      MenuStore.appendChild(this.resultList);
     }
   }
 
@@ -201,11 +202,6 @@ export class Suggest {
     return this.base.dataset.position;
   }
 
-  private get menuStore(): HTMLDivElement {
-    const root = this.base.getRootNode() as ShadowRoot | Document;
-    return root.querySelector(".tobago-page-menuStore");
-  }
-
   private get update(): boolean {
     return this.suggest.getAttribute("update") !== null;
   }


[myfaces-tobago] 03/04: build(theme): rebuild after refactoring typescript (menuStore)

Posted by hn...@apache.org.
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 4e42969ff4aeb3f5f6b23de55e5a04048b57082d
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Nov 1 14:01:44 2022 +0100

    build(theme): rebuild after refactoring typescript (menuStore)
---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js     | 4 ++--
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index bb0444a5b5..3527d1aea4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(){super(),this.CssClass={SHOW:"show",COLLAPSE:"collapse",COLLAPSING:"collapsing"},this.toggleButton.addEventListener("click",this.toggleCollapse.bind(this))}connectedCallback(){this.expanded="true"===this.toggleButton.ariaExpanded}toggleCollapse(e){window.clearTimeout(this.timeout),this.expanded?(this.expanded=!1,this.navbarContent.style.height=`${this.navbar [...]
 /*!
     * Bootstrap v5.2.2 (https://getbootstrap.com/)
     * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
     * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
     */
-const Me="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},je=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},He=e=>{const t=Re(e);return t?document.querySelector(t):null},qe=e=>{e.dispatchEvent(new Event(Me))},Be=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
+const Me="transitionend",Re=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t},je=e=>{const t=Re(e);return t&&document.querySelector(t)?t:null},He=e=>{const t=Re(e);return t?document.querySelector(t):null},Be=e=>{e.dispatchEvent(new Event(Me))},Pe=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&( [...]
 //# sourceMappingURL=tobago.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 9ca988049d..ed6690128b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-bar.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_m [...]
\ No newline at end of file


[myfaces-tobago] 01/04: build(deps): bump gson from 2.9.1 to 2.10 (#3367)

Posted by hn...@apache.org.
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 e7cba80185f777fd691c7b1c2490d917771bc2b1
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Fri Oct 28 08:09:19 2022 +0200

    build(deps): bump gson from 2.9.1 to 2.10 (#3367)
    
    Bumps [gson](https://github.com/google/gson) from 2.9.1 to 2.10.
    - [Release notes](https://github.com/google/gson/releases)
    - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
    - [Commits](https://github.com/google/gson/compare/gson-parent-2.9.1...gson-parent-2.10)
    
    ---
    updated-dependencies:
    - dependency-name: com.google.code.gson:gson
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
---
 tobago-example/tobago-example-demo/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tobago-example/tobago-example-demo/pom.xml b/tobago-example/tobago-example-demo/pom.xml
index 1f6c5f82e4..95ec15c845 100644
--- a/tobago-example/tobago-example-demo/pom.xml
+++ b/tobago-example/tobago-example-demo/pom.xml
@@ -199,7 +199,7 @@
     <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
-      <version>2.9.1</version>
+      <version>2.10</version>
       <scope>compile</scope>
     </dependency>
     <dependency>