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

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 3961aa1  -ResponsiveVisibility bead to make any component show or hide 
depending on screen sizes / devices -Added missing properties for "widescreen" 
size in GridCell and GridCellLayout -Make Menu button hide on JewelExample when 
size is in desktop and widescreen
3961aa1 is described below

commit 3961aa1dca34a5bbbaffa43a880abc419d2483e5
Author: Carlos Rovira <[email protected]>
AuthorDate: Thu Jul 12 13:03:20 2018 +0200

    -ResponsiveVisibility bead to make any component show or hide depending on 
screen sizes / devices
    -Added missing properties for "widescreen" size in GridCell and 
GridCellLayout
    -Make Menu button hide on JewelExample when size is in desktop and 
widescreen
---
 .../JewelExample/src/main/royale/MainContent.mxml  |   3 +
 .../projects/Jewel/src/main/resources/defaults.css |  72 +++---
 .../Jewel/src/main/resources/jewel-manifest.xml    |   1 +
 .../royale/org/apache/royale/jewel/GridCell.as     |  38 ++++
 .../royale/jewel/beads/layouts/GridCellLayout.as   |  41 ++++
 .../jewel/beads/layouts/ResponsiveVisibility.as    | 250 +++++++++++++++++++++
 .../projects/Jewel/src/main/sass/_mixins.sass      |   5 +-
 .../Jewel/src/main/sass/components/_layout.sass    |  29 ++-
 8 files changed, 388 insertions(+), 51 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml 
b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
index 3ebb284..d0c1125 100644
--- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml
+++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
@@ -81,6 +81,9 @@ limitations under the License.
         <j:TopAppBarRow>
             <j:TopAppBarSection>
                 <j:Button click="drawer.isOpen ? drawer.close() : 
drawer.open()">
+                    <js:beads>
+                        <j:ResponsiveVisibility desktopVisible="false" 
wideScreenVisible="false"/>
+                    </js:beads>
                     <j:icon>
                         <js:FontIcon text="{MaterialIconType.MENU}" 
material="true"/>
                     </j:icon>
diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css 
b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 963c0fd..2fc207d 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -777,14 +777,6 @@ j|Label {
     width: 100%;
   }
 }
-@media (max-width: 767px) {
-  .layout.grid .visible-phone {
-    display: flex !important;
-  }
-  .layout.grid .hidden-phone {
-    display: none !important;
-  }
-}
 @media (min-width: 768px) {
   .layout.grid .tablet-col-1-1 {
     width: 100%;
@@ -1021,14 +1013,6 @@ j|Label {
     width: 100%;
   }
 }
-@media (min-width: 768px) and (max-width: 991px) {
-  .layout.grid .visible-tablet {
-    display: flex !important;
-  }
-  .layout.grid .hidden-tablet {
-    display: none !important;
-  }
-}
 @media (min-width: 992px) {
   .layout.grid .desktop-col-1-1 {
     width: 100%;
@@ -1265,14 +1249,6 @@ j|Label {
     width: 100%;
   }
 }
-@media (min-width: 992px) and (max-width: 1199px) {
-  .layout.grid .visible-desktop {
-    display: flex !important;
-  }
-  .layout.grid .hidden-desktop {
-    display: none !important;
-  }
-}
 @media (min-width: 1200px) {
   .layout.grid .widescreen-col-1-1 {
     width: 100%;
@@ -1509,14 +1485,6 @@ j|Label {
     width: 100%;
   }
 }
-@media (min-width: 1200px) {
-  .layout.grid .visible-widescreen {
-    display: flex !important;
-  }
-  .layout.grid .hidden-widescreen {
-    display: none !important;
-  }
-}
 .layout.grid.gap > * {
   margin: 5px;
 }
@@ -2465,6 +2433,42 @@ j|Label {
   }
 }
 
+@media (max-width: 767px) {
+  .visible-phone {
+    display: block !important;
+  }
+
+  .hidden-phone {
+    display: none !important;
+  }
+}
+@media (min-width: 768px) and (max-width: 991px) {
+  .visible-tablet {
+    display: block !important;
+  }
+
+  .hidden-tablet {
+    display: none !important;
+  }
+}
+@media (min-width: 992px) and (max-width: 1199px) {
+  .visible-desktop {
+    display: block !important;
+  }
+
+  .hidden-desktop {
+    display: none !important;
+  }
+}
+@media (min-width: 1200px) {
+  .visible-widescreen {
+    display: block !important;
+  }
+
+  .hidden-widescreen {
+    display: none !important;
+  }
+}
 .visible-phone, .visible-tablet, .visible-desktop, .visible-widescreen {
   display: none !important;
 }
@@ -2473,10 +2477,6 @@ j|Label {
   display: block !important;
 }
 
-.hidden-flex-phone, .hidden-flex-tablet, .hidden-flex-desktop, 
.hidden-flex-widescreen {
-  display: flex !important;
-}
-
 .jewel.list, .jewel.navigation {
   align-items: stretch;
   align-content: flex-start;
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml 
b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 7fcc0ab..251fad1 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -67,6 +67,7 @@
     
     <component id="Disabled" 
class="org.apache.royale.jewel.beads.controls.Disabled"/>
     <component id="SizeControl" 
class="org.apache.royale.jewel.beads.controls.SizeControl"/>
+    <component id="ResponsiveVisibility" 
class="org.apache.royale.jewel.beads.layouts.ResponsiveVisibility"/>
     
     <component id="TextPrompt" 
class="org.apache.royale.jewel.beads.controls.textinput.TextPrompt"/>
     <component id="PasswordInput" 
class="org.apache.royale.jewel.beads.controls.textinput.PasswordInput"/>
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/GridCell.as 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/GridCell.as
index 9fd44fe..aad1ccd 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/GridCell.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/GridCell.as
@@ -350,6 +350,44 @@ package org.apache.royale.jewel
                }
 
                /**
+                *  Makes the cell to be visible or hidden in phone size
+                *  Uses "visible-widescreen" and "hidden-widescreen" effect 
selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get wideScreenVisible():Boolean
+        {
+            return layout.wideScreenVisible;
+        }
+
+        public function set wideScreenVisible(value:Boolean):void
+        {
+                       if (layout.wideScreenVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       layout.wideScreenVisible = value;
+
+                                       if(layout.wideScreenVisible)
+                                       {
+                                               typeNames = 
StringUtil.removeWord(typeNames, " hidden-widescreen");
+                                               typeNames += " 
visible-widescreen";
+                                       } else
+                                       {
+                                               typeNames = 
StringUtil.removeWord(typeNames, " visible-widescreen");
+                                               typeNames += " 
hidden-widescreen";
+                                       }
+
+                                       if (parent)
+                               setClassName(computeFinalClassNames());
+                               }
+                       }
+               }
+
+               /**
                 *  Assigns variable gap to grid from 1 to 20
                 *  Activate "gap-Xdp" effect selector to set a numeric gap 
                 *  between grid cells
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridCellLayout.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridCellLayout.as
index 6865def..c389748 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridCellLayout.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridCellLayout.as
@@ -404,6 +404,47 @@ package org.apache.royale.jewel.beads.layouts
                        }
                }
 
+               private var _wideScreenVisible:Boolean;
+               /**
+                *  Makes the cell to be visible or hidden in phone size
+                *  Uses "visible-widescreen" and "hidden-widescreen" effect 
selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get wideScreenVisible():Boolean
+        {
+            return _wideScreenVisible;
+        }
+
+        public function set wideScreenVisible(value:Boolean):void
+        {
+                       if (_wideScreenVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       _wideScreenVisible = value;
+
+                                       if(hostComponent)
+                                       {
+                                               if(_wideScreenVisible)
+                                               {
+                                                       if 
(hostClassList.contains("hidden-widescreen"))
+                                                               
hostClassList.remove("hidden-widescreen");
+                                                       
hostClassList.add("visible-widescreen");
+                                               } else
+                                               {
+                                                       if 
(hostClassList.contains("visible-widescreen"))
+                                                               
hostClassList.remove("visible-widescreen");
+                                                       
hostClassList.add("hidden-widescreen");
+                                               }
+                                       }
+                               }
+                       }
+               }
+
         /**
          * @copy org.apache.royale.core.IBeadLayout#layout
                 * @royaleignorecoercion org.apache.royale.core.UIBase
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
new file mode 100644
index 0000000..948be8e
--- /dev/null
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
@@ -0,0 +1,250 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.jewel.beads.layouts
+{      
+       import org.apache.royale.core.IBead;
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.core.StyledUIBase;
+       
+       /**
+        *  The ResponsiveVisibility bead class is a specialty bead that 
+        *  can be used to show or hide a Jewel control depending on responsive
+        *  rules.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9.3
+        */
+       public class ResponsiveVisibility implements IBead
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+               public function ResponsiveVisibility()
+               {
+               }
+
+               private var _phoneVisible:Boolean;
+               /**
+                *  Makes the component to be visible or hidden in phone size
+                *  Uses "visible-phone" and "hidden-phone" effect selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get phoneVisible():Boolean
+        {
+            return _phoneVisible;
+        }
+
+        public function set phoneVisible(value:Boolean):void
+        {
+                       if (_phoneVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       _phoneVisible = value;
+                                       
+                                       if(_strand)
+                               showOrHideHost();
+                               }
+                       }
+               }
+
+               private var _tabletVisible:Boolean;
+               /**
+                *  Makes the component to be visible or hidden in phone size
+                *  Uses "visible-tablet" and "hidden-tablet" effect selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get tabletVisible():Boolean
+        {
+            return _tabletVisible;
+        }
+
+        public function set tabletVisible(value:Boolean):void
+        {
+                       if (_tabletVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       _tabletVisible = value;
+
+                                       if(_strand)
+                               showOrHideHost();
+                               }
+                       }
+               }
+
+               private var _desktopVisible:Boolean;
+               /**
+                *  Makes the component to be visible or hidden in phone size
+                *  Uses "visible-desktop" and "hidden-desktop" effect 
selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get desktopVisible():Boolean
+        {
+            return _desktopVisible;
+        }
+
+        public function set desktopVisible(value:Boolean):void
+        {
+                       if (_desktopVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       _desktopVisible = value;
+
+                                       if(_strand)
+                               showOrHideHost();
+                               }
+                       }
+               }
+               
+               private var _wideScreenVisible:Boolean;
+               /**
+                *  Makes the component to be visible or hidden in phone size
+                *  Uses "visible-widescreen" and "hidden-widescreen" effect 
selectors.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                */
+        public function get wideScreenVisible():Boolean
+        {
+            return _wideScreenVisible;
+        }
+
+        public function set wideScreenVisible(value:Boolean):void
+        {
+                       if (_wideScreenVisible != value)
+            {
+                COMPILE::JS
+                {
+                                       _wideScreenVisible = value;
+
+                                       if(_strand)
+                               showOrHideHost();
+                               }
+                       }
+               }
+
+               private var _strand:IStrand;
+               
+               /**
+                *  @copy org.apache.royale.core.IBead#strand
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9.3
+                *  @royaleignorecoercion HTMLInputElement
+                *  @royaleignorecoercion org.apache.royale.core.UIBase;
+                */
+               public function set strand(value:IStrand):void
+               {
+                       _strand = value;
+                       showOrHideHost();
+               }
+
+               private function showOrHideHost():void
+               {
+                       var host:StyledUIBase = _strand as StyledUIBase;
+                       if (host)
+            {
+                               if(_phoneVisible != null)
+                               {
+                                       if(_phoneVisible)
+                                       {
+                                               if 
(host.containsClass("hidden-phone"))
+                                                       
host.removeClass("hidden-phone");
+                                               host.addClass("visible-phone");
+                                       } else
+                                       {
+                                               if 
(host.containsClass("visible-phone"))
+                                                       
host.removeClass("visible-phone");
+                                               host.addClass("hidden-phone");
+                                       }
+                               }
+
+                               if(_tabletVisible != null)
+                               {
+                                       if(_tabletVisible)
+                                       {
+                                               if 
(host.containsClass("hidden-tablet"))
+                                                       
host.removeClass("hidden-tablet");
+                                               host.addClass("visible-tablet");
+                                       } else
+                                       {
+                                               if 
(host.containsClass("visible-tablet"))
+                                                       
host.removeClass("visible-tablet");
+                                               host.addClass("hidden-tablet");
+                                       }
+                               }
+
+                               if(_desktopVisible != null)
+                               {
+                                       if(_desktopVisible)
+                                       {
+                                               if 
(host.containsClass("hidden-desktop"))
+                                                       
host.removeClass("hidden-desktop");
+                                               
host.addClass("visible-desktop");
+                                       } else
+                                       {
+                                               if 
(host.containsClass("visible-desktop"))
+                                                       
host.removeClass("visible-desktop");
+                                               host.addClass("hidden-desktop");
+                                       }
+                               }
+
+                               if(_wideScreenVisible != null)
+                               {
+                                       if(_wideScreenVisible)
+                                       {
+                                               if 
(host.containsClass("hidden-widescreen"))
+                                                       
host.removeClass("hidden-widescreen");
+                                               
host.addClass("visible-widescreen");
+                                       } else
+                                       {
+                                               if 
(host.containsClass("visible-widescreen"))
+                                                       
host.removeClass("visible-widescreen");
+                                               
host.addClass("hidden-widescreen");
+                                       }
+                               }
+            }
+               }
+       }
+}
diff --git a/frameworks/projects/Jewel/src/main/sass/_mixins.sass 
b/frameworks/projects/Jewel/src/main/sass/_mixins.sass
index f5bb271..25c4772 100644
--- a/frameworks/projects/Jewel/src/main/sass/_mixins.sass
+++ b/frameworks/projects/Jewel/src/main/sass/_mixins.sass
@@ -24,10 +24,9 @@
        -ms-appearance: $val
        appearance: $val
 
-// VISIBLE / HIDDEN responive rules
-=visible-classes($size)
+=visible-hidden-responsive-rules($size)
        .visible-#{$size}
-               display: flex !important
+               display: block !important
 
        .hidden-#{$size}
                display: none !important
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_layout.sass 
b/frameworks/projects/Jewel/src/main/sass/components/_layout.sass
index cef8518..8b59ad8 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_layout.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_layout.sass
@@ -92,6 +92,10 @@ $gap-size: 10px !default
        align-items: stretch
        width: 100%
        height: 100%
+       // align-content: stretch
+
+       // &.itemsFullHeight
+       //      align-items: stretch
        
        > *
                flex: 0 0 auto // flex-grow, flex-shrink and flex-basis
@@ -105,16 +109,6 @@ $gap-size: 10px !default
                                @for $j from 1 through $i
                                        .#{$size}-col-#{$j}-#{$i}
                                                width: percentage($j / $i)
-                                               
-               @if index($size-names, $size) == 1
-                       @media (max-width: nth(nth($sizes, 2), 2) - 1)
-                               +visible-classes($size)
-               @else if index($size-names, $size) != 1 and index($size-names, 
$size) < length($sizes)
-                       @media (min-width: map-get($sizes, $size)) and 
(max-width: nth(nth($sizes, index($size-names, $size) + 1), 2) - 1)
-                               +visible-classes($size)
-               @else if index($size-names, $size) == length($sizes)
-                       @media (min-width: nth(nth($sizes, length($sizes)), 2))
-                               +visible-classes($size)
        &.gap   
                > *
                        margin: $gap-size / 2
@@ -125,12 +119,23 @@ $gap-size: 10px !default
                                                .#{$size}-col-#{$j}-#{$i}
                                                        width: 
calc(#{percentage($j / $i)} - #{$gap-size})
 
+@each $size in $size-names                     
+       @if index($size-names, $size) == 1
+               @media (max-width: nth(nth($sizes, 2), 2) - 1)
+                       +visible-hidden-responsive-rules($size)
+       @else if index($size-names, $size) != 1 and index($size-names, $size) < 
length($sizes)
+               @media (min-width: map-get($sizes, $size)) and (max-width: 
nth(nth($sizes, index($size-names, $size) + 1), 2) - 1)
+                       +visible-hidden-responsive-rules($size)
+       @else if index($size-names, $size) == length($sizes)
+               @media (min-width: nth(nth($sizes, length($sizes)), 2))
+                       +visible-hidden-responsive-rules($size)
+
 #{$visible-sizes}
        display: none !important
 
 #{$hidden-sizes}
        display: block !important
 
-#{$hidden-flex-sizes}
-       display: flex !important
+// #{$hidden-flex-sizes}
+//     display: flex !important
 

Reply via email to