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 2023/11/06 09:34:19 UTC

(myfaces-tobago) branch tobago-5.x updated (affc9ede2e -> cdeef10066)

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

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


    from affc9ede2e fix(npm): Npm build is not working under windows OS
     new ab7a7e15a1 fix(sheet): Selector All Checkbox is not synchronized with selector Checkbox in each row after ajax request
     new cdeef10066 build(theme): rebuild after fixing columnSelectorAll

The 2 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:
 .../tobago-theme-standard/src/main/js/tobago.js    |  6 ++---
 .../src/main/js/tobago.js.map                      |  2 +-
 .../src/main/ts/tobago-sheet.ts                    | 31 +++++++++++++++++++++-
 3 files changed, 34 insertions(+), 5 deletions(-)


(myfaces-tobago) 01/02: fix(sheet): Selector All Checkbox is not synchronized with selector Checkbox in each row after ajax request

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ab7a7e15a1c642d99656299e43d448d8a36d7946
Author: Bernd Bohmann <bo...@apache.org>
AuthorDate: Fri Nov 3 11:05:32 2023 +0100

    fix(sheet): Selector All Checkbox is not synchronized with selector Checkbox in each row after ajax request
    
    issue: TOBAGO-2254
    
    (cherry picked from commit a9c98992bc819e10a735ac32b6570c2a75230f8e)
---
 .../src/main/ts/tobago-sheet.ts                    | 31 +++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
index fac0f9ee70..3d8688b444 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
@@ -196,6 +196,10 @@ export class Sheet extends HTMLElement {
         row.addEventListener("click", this.clickOnRow.bind(this));
       }
     }
+    if (selectionMode === "multi"  && this.getSelectorAllCheckbox()) {
+      const selectedSet = new Set<number>(JSON.parse(this.getHiddenSelected().value));
+      this.calculateSelectorAllChecked(selectedSet);
+    }
 
     for (const checkbox of this.querySelectorAll(
         ".tobago-body td > input.tobago-selected")) {
@@ -265,7 +269,6 @@ export class Sheet extends HTMLElement {
       });
     }
   }
-
   // attribute getter + setter ---------------------------------------------------------- //
 
   get lazyActive(): boolean {
@@ -748,6 +751,30 @@ Type: ${data.type}`);
     return row.querySelector("tr>td>input.tobago-selected");
   }
 
+  private getSelectorAllCheckbox(): HTMLInputElement {
+    return this.querySelector("thead>tr>th>span>input.tobago-selected");
+  }
+
+  private calculateSelectorAllChecked(selectedSet: Set<number>) {
+    const selectorAll = this.getSelectorAllCheckbox();
+    if (selectorAll) {
+      let selected = false;
+      for (const row of this.getRowElements()) {
+        const checkbox: HTMLInputElement = this.getSelectorCheckbox(row);
+        if (checkbox === null || !checkbox.disabled) {
+          const rowIndex = Number(row.getAttribute("row-index"));
+          if (selectedSet.has(rowIndex)) {
+            selected = true;
+          } else {
+            selected = false;
+            break;
+          }
+        }
+      }
+      selectorAll.checked = selected;
+    }
+  }
+
   getRowElements(): NodeListOf<HTMLTableRowElement> {
     return this.getBodyTable().querySelectorAll("tbody>tr");
   }
@@ -774,6 +801,7 @@ Type: ${data.type}`);
         this.selectRow(selectedSet, rowIndex, row, checkbox);
       }
     }
+    this.calculateSelectorAllChecked(selectedSet);
   }
 
   selectAll(selectedSet: Set<number>): void {
@@ -807,6 +835,7 @@ Type: ${data.type}`);
         }
       }
     }
+    this.calculateSelectorAllChecked(selectedSet);
   }
 
   /**


(myfaces-tobago) 02/02: build(theme): rebuild after fixing columnSelectorAll

Posted by hn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cdeef10066f8541bcc67fadf5faa976aed11a4b0
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Nov 6 10:24:37 2023 +0100

    build(theme): rebuild after fixing columnSelectorAll
---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js     | 6 +++---
 tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map | 2 +-
 2 files changed, 4 insertions(+), 4 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 35afb9d4cc..ef609963a7 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -1,10 +1,10 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e;!function(e){e.ACTIVE="active",e.AUTOCOMPLETE="autocomplete",e.AUTOCOMPLETE_INPUT="autocomplete-input",e.BOTTOM_0="bottom-0",e.COLLAPSE="collapse",e.COLLAPSING="collapsing",e.D_NONE="d-none",e.DISABLED="disabled",e.DROPDOWN="dropdown",e.DROPDOWN_ITEM="dropdown-item",e.DROPDOWN_MENU="dropdown-menu",e.DROPDOWN_MENU_END="dropdown-menu-end",e.END_0="end-0",e.FADE="fade",e.FIXED_BOTTOM="fixed-bott [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e;!function(e){e.ACTIVE="active",e.AUTOCOMPLETE="autocomplete",e.AUTOCOMPLETE_INPUT="autocomplete-input",e.BOTTOM_0="bottom-0",e.COLLAPSE="collapse",e.COLLAPSING="collapsing",e.D_NONE="d-none",e.DISABLED="disabled",e.DROPDOWN="dropdown",e.DROPDOWN_ITEM="dropdown-item",e.DROPDOWN_MENU="dropdown-menu",e.DROPDOWN_MENU_END="dropdown-menu-end",e.END_0="end-0",e.FADE="fade",e.FIXED_BOTTOM="fixed-bott [...]
 /*!
       * Bootstrap v5.3.2 (https://getbootstrap.com/)
       * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
       * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
       */
-const $e=new Map,Me={set(e,t,s){$e.has(e)||$e.set(e,new Map);const n=$e.get(e);n.has(t)||0===n.size?n.set(t,s):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>$e.has(e)&&$e.get(e).get(t)||null,remove(e,t){if(!$e.has(e))return;const s=$e.get(e);s.delete(t),0===s.size&&$e.delete(e)}},Pe="transitionend",Be=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),H [...]
+const $e=new Map,Me={set(e,t,s){$e.has(e)||$e.set(e,new Map);const n=$e.get(e);n.has(t)||0===n.size?n.set(t,s):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>$e.has(e)&&$e.get(e).get(t)||null,remove(e,t){if(!$e.has(e))return;const s=$e.get(e);s.delete(t),0===s.size&&$e.delete(e)}},Pe="transitionend",Be=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),H [...]
 /**
      * @license
      * Copyright 2017 Google LLC
@@ -15,5 +15,5 @@ const $e=new Map,Me={set(e,t,s){$e.has(e)||$e.set(e,new Map);const n=$e.get(e);n
       ${s>0?" tabindex='"+String(s)+"'":""}
       @click="${this.removeBadge.bind(this)}"
       @focus="${this.focusEvent.bind(this)}"
-      @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){const t=e.target.closest(".btn-group").dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!1;const n=this.selectField.querySelector(`[data-tobago-value="${t}"]`),i=n.previousElementSibling,o="SPAN"===n.nextElementSibling.tagName?n.nextElementSibling:null;i?i.querySelector("button.btn.badge").focus():o?o.querySelector("button.btn.badge").focus():(this.filterInput.dis [...]
+      @blur="${this.blurEvent.bind(this)}"><i class='bi-x-lg'></i></button>`}removeBadge(e){const t=e.target.closest(".btn-group").dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!1;const n=this.selectField.querySelector(`[data-tobago-value="${t}"]`),i=n.previousElementSibling,o="SPAN"===n.nextElementSibling.tagName?n.nextElementSibling:null;i?i.querySelector("button.btn.badge").focus():o?o.querySelector("button.btn.badge").focus():(this.filterInput.dis [...]
 //# 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 322381a38e..f8690b5e4f 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-css.ts","../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.j [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../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.j [...]
\ No newline at end of file