You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/02/04 18:08:56 UTC

[myfaces-tobago] branch tobago-4.x updated: fix: columns attribute: "auto" in not dispayed in combination with "fr" fractions issue: TOBAGO-2069

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

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


The following commit(s) were added to refs/heads/tobago-4.x by this push:
     new b105910  fix: <tc:sheet> columns attribute: "auto" in not dispayed in combination with "<n>fr" fractions issue: TOBAGO-2069
b105910 is described below

commit b1059107edba129f69fda5e50a415f53bf60e345
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Feb 4 19:06:29 2021 +0100

    fix: <tc:sheet> columns attribute: "auto" in not dispayed in combination with "<n>fr" fractions
    issue: TOBAGO-2069
---
 .../internal/taglib/component/SheetTagDeclaration.java |  8 +++++++-
 .../tobago-bootstrap/_version/js/tobago-sheet.js       | 18 ++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
index ec0086a..6b5bcfa 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
@@ -94,8 +94,14 @@ import javax.faces.component.UIData;
 public interface SheetTagDeclaration
     extends HasIdBindingAndRendered, IsVisual, IsShowRoot, IsShowRootJunction, HasVar {
   /**
+   * <p>
    * LayoutConstraints for column layout.
-   * Semicolon separated list of layout tokens ('&lt;x&gt;*', '&lt;x&gt;px' or '&lt;x&gt;%') or "auto"
+   * Semicolon separated list of layout tokens '&lt;n&gt;fr', '&lt;x&gt;px', '&lt;x&gt;%' or "auto",
+   * where x is a number and n is an integer.
+   * </p>
+   * <p>
+   * The layout token '&lt;n&gt;*' is deprecated, please use '&lt;n&gt;fr'!
+   * </p>
    */
   @TagAttribute
   @UIComponentTagAttribute()
diff --git a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
index 1c73169..740d298 100644
--- a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
+++ b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
@@ -218,6 +218,7 @@ Tobago.Sheet.setup2 = function (sheets) {
         var intValue;
         var sumRelative = 0;
         var widthRelative = $bodyTable.width();
+        var r = 0;
         for (i = 0; i < tokens.length; i++) {
           if (rendered[i] === "true") {
             if (typeof tokens[i] === "number") {
@@ -229,16 +230,21 @@ Tobago.Sheet.setup2 = function (sheets) {
               } else if (tokens[i].measure.lastIndexOf("%") > 0) {
                 widthRelative -= parseInt($bodyTable.width() / 100 * intValue);
               }
+            } else if(tokens[i] === "auto") {
+              var value = $headerCol.eq(r).width();
+              widthRelative -= value;
+              tokens[i] = {measure: value + "px"}; // converting "auto" to a specific value
             } else {
-              console.debug("auto? = " + tokens[i]); // @DEV_ONLY
+              console.debug("(layout columns a) auto? token[i]='%s' i=%i", tokens[i], i); // @DEV_ONLY
             }
+            r++;
           }
         }
         if (widthRelative < 0) {
           widthRelative = 0;
         }
 
-        var headerBodyColCount = 0;
+        r = 0;
         for (i = 0; i < tokens.length; i++) {
           var colWidth = 0;
           if (rendered[i] === "true") {
@@ -252,13 +258,13 @@ Tobago.Sheet.setup2 = function (sheets) {
                 colWidth = parseInt($bodyTable.width() / 100 * intValue);
               }
             } else {
-              console.debug("auto? = " + tokens[i]); // @DEV_ONLY
+              console.debug("(layout columns b) auto? token[i]='%s' i=%i", tokens[i], i); // @DEV_ONLY
             }
             if (colWidth > 0) { // because tokens[i] == "auto"
-              $headerCol.eq(headerBodyColCount).attr("width", colWidth);
-              $bodyCol.eq(headerBodyColCount).attr("width", colWidth);
+              $headerCol.eq(r).attr("width", colWidth);
+              $bodyCol.eq(r).attr("width", colWidth);
             }
-            headerBodyColCount++;
+            r++;
           }
         }
       }