You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/03/17 18:33:11 UTC

[royale-asjs] branch feature/jewel_positioner updated: fix jewel checkbox and radiobutton positioner and disabled styles

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

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


The following commit(s) were added to refs/heads/feature/jewel_positioner by this push:
     new 318c8f4  fix jewel checkbox and radiobutton positioner and disabled styles
318c8f4 is described below

commit 318c8f4d821dca62a34f98b29a43d63c7dd8e7bb
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Mar 17 19:33:04 2019 +0100

    fix jewel checkbox and radiobutton positioner and disabled styles
---
 .../projects/Jewel/src/main/resources/defaults.css | 10 +---
 .../royale/org/apache/royale/jewel/CheckBox.as     | 60 +++++++++++-----------
 .../royale/org/apache/royale/jewel/RadioButton.as  | 30 +++++++----
 .../main/royale/org/apache/royale/jewel/Slider.as  |  5 +-
 .../Jewel/src/main/sass/components/_checkbox.sass  |  6 +--
 .../src/main/sass/components/_radiobutton.sass     |  6 +--
 6 files changed, 56 insertions(+), 61 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index e991d44..fe5f79e 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -264,7 +264,6 @@ j|Card {
   margin: 0;
   padding: 0;
   height: auto;
-  cursor: pointer;
 }
 .jewel.checkbox input {
   -webkit-appearance: none;
@@ -303,13 +302,11 @@ j|Card {
 .jewel.checkbox input:focus + span::before, .jewel.checkbox input:checked:focus + span::before, .jewel.checkbox input:checked:active:focus + span::before {
   outline: none;
 }
-.jewel.checkbox input[disabled] {
-  cursor: unset;
-}
 .jewel.checkbox input[disabled] + span {
   cursor: unset;
 }
 .jewel.checkbox span {
+  cursor: pointer;
   margin: 0;
   vertical-align: top;
   line-height: 24px;
@@ -3257,7 +3254,6 @@ j|PopUp {
   margin: 0;
   padding: 0;
   height: 22px;
-  cursor: pointer;
 }
 .jewel.radiobutton input {
   -webkit-appearance: none;
@@ -3296,13 +3292,11 @@ j|PopUp {
 .jewel.radiobutton input:focus + span::before, .jewel.radiobutton input:checked:focus + span::before, .jewel.radiobutton input:checked:active:focus + span::before {
   outline: none;
 }
-.jewel.radiobutton input[disabled] {
-  cursor: unset;
-}
 .jewel.radiobutton input[disabled] + span {
   cursor: unset;
 }
 .jewel.radiobutton span {
+  cursor: pointer;
   margin: 0;
   vertical-align: top;
   line-height: 24px;
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/CheckBox.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/CheckBox.as
index 656645e..cbd7d4d 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/CheckBox.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/CheckBox.as
@@ -18,25 +18,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel
 {
-    import org.apache.royale.core.IToggleButtonModel;
-    import org.apache.royale.events.Event;
-    import org.apache.royale.jewel.supportClasses.checkbox.CheckBoxIcon;
-    import org.apache.royale.utils.ClassSelectorList;
-
     COMPILE::SWF
     {
-        import org.apache.royale.events.MouseEvent;
-        import org.apache.royale.core.UIButtonBase;
-        import org.apache.royale.core.IStrand;
-        import org.apache.royale.core.ISelectable;
+    import org.apache.royale.core.ISelectable;
+    import org.apache.royale.core.IStrand;
+    import org.apache.royale.core.UIButtonBase;
+    import org.apache.royale.events.MouseEvent;
     }
-
     COMPILE::JS
     {
-        import org.apache.royale.core.WrappedHTMLElement;
-        import org.apache.royale.html.util.addElementToWrapper;
-        import org.apache.royale.core.StyledUIBase;
+    import org.apache.royale.core.StyledUIBase;
+    import org.apache.royale.core.WrappedHTMLElement;
+    import org.apache.royale.html.util.addElementToWrapper;
     }
+    import org.apache.royale.core.IToggleButtonModel;
+    import org.apache.royale.events.Event;
+    import org.apache.royale.utils.ClassSelectorList;
 
     //--------------------------------------
     //  Events
@@ -196,7 +193,6 @@ package org.apache.royale.jewel
         }
 
         private var _label:WrappedHTMLElement;
-		private var _icon:CheckBoxIcon;
 
 		private static var _checkNumber:Number = 0;
         
@@ -205,36 +201,40 @@ package org.apache.royale.jewel
 
         COMPILE::JS
         protected var checkbox:HTMLSpanElement;
-
-        COMPILE::JS
-        protected var label:HTMLLabelElement;
         
         /**
          * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
-         * @royaleignorecoercion HTMLLabelElement
          * @royaleignorecoercion HTMLInputElement
          * @royaleignorecoercion HTMLSpanElement
-         * @royaleignorecoercion Text
          */
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-            var label:HTMLLabelElement = document.createElement('label') as HTMLLabelElement;
-            
             input = addElementToWrapper(this,'input') as HTMLInputElement;
-            input.type = 'checkbox';    
-            label.appendChild(input);
-            
+            input.type = 'checkbox';
             checkbox = document.createElement('span') as HTMLSpanElement;
-            label.appendChild(checkbox);
-            
-            positioner = label as WrappedHTMLElement;
-            positioner.royale_wrapper = this;
-            //(input as WrappedHTMLElement).royale_wrapper = this;
-            //(checkbox as WrappedHTMLElement).royale_wrapper = this;
+            positioner = document.createElement('label') as WrappedHTMLElement;   
             return element;
         }
 
+        COMPILE::JS
+		private var _positioner:WrappedHTMLElement;
+
+		COMPILE::JS
+		override public function get positioner():WrappedHTMLElement
+		{
+			return _positioner;
+		}
+
+		COMPILE::JS
+		override public function set positioner(value:WrappedHTMLElement):void
+		{
+			_positioner = value;
+            _positioner.royale_wrapper = this;
+			_positioner.appendChild(element);
+            _positioner.appendChild(checkbox);
+		}
+
         /**
          *  The text label for the CheckBox.
          *
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/RadioButton.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/RadioButton.as
index efb8dc0..74d2d88 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/RadioButton.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/RadioButton.as
@@ -310,38 +310,48 @@ package org.apache.royale.jewel
 
         private var radio:HTMLSpanElement;
         private var icon:HTMLInputElement;
-        private var label:HTMLLabelElement;
         private var textNode:Text;
 
         /**
          * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
-         * @royaleignorecoercion HTMLLabelElement
          * @royaleignorecoercion HTMLInputElement
          * @royaleignorecoercion HTMLSpanElement
          * @royaleignorecoercion Text
          */
         override protected function createElement():WrappedHTMLElement
         {
-            label = document.createElement('label') as HTMLLabelElement;
-
             icon = addElementToWrapper(this, 'input') as HTMLInputElement;
             icon.type = 'radio';
             icon.id = '_radio_' + Math.random();
             icon.value = String(value);
-            label.appendChild(icon);
-
+            
             textNode = document.createTextNode('') as Text;
-
             radio = document.createElement('span') as HTMLSpanElement;
             radio.appendChild(textNode);
-            label.appendChild(radio);
             
-            positioner = label as WrappedHTMLElement;
-            positioner.royale_wrapper = this;
+            positioner = document.createElement('label') as WrappedHTMLElement;
             
             return element;
         }
 
+        COMPILE::JS
+		private var _positioner:WrappedHTMLElement;
+
+		COMPILE::JS
+		override public function get positioner():WrappedHTMLElement
+		{
+			return _positioner;
+		}
+
+		COMPILE::JS
+		override public function set positioner(value:WrappedHTMLElement):void
+		{
+			_positioner = value;
+            _positioner.royale_wrapper = this;
+			_positioner.appendChild(element);
+            _positioner.appendChild(radio);
+		}
+
         override public function addEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void
         {
             if (type == MouseEvent.CLICK)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Slider.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Slider.as
index eea650a..8394d92 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Slider.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Slider.as
@@ -20,12 +20,11 @@ package org.apache.royale.jewel
 {
 	import org.apache.royale.core.IRangeModel;
 	import org.apache.royale.core.StyledUIBase;
-	import org.apache.royale.events.Event;
 
     COMPILE::JS
     {
-        import org.apache.royale.core.WrappedHTMLElement;
-		import org.apache.royale.html.util.addElementToWrapper;
+	import org.apache.royale.core.WrappedHTMLElement;
+	import org.apache.royale.html.util.addElementToWrapper;
     }
 
 	//--------------------------------------
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_checkbox.sass b/frameworks/projects/Jewel/src/main/sass/components/_checkbox.sass
index 6f26052..8c24493 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_checkbox.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_checkbox.sass
@@ -33,12 +33,10 @@ $checkbox-button-yoffset: 0px
 
 	// width: 100%
 	height: auto //$checkbox-button-size
-	cursor: pointer
 
 	// -- INPUT
 	input
 		+appear(none)
-		// cursor: pointer
 		display: inline-flex
 
 		margin: 0
@@ -79,14 +77,12 @@ $checkbox-button-yoffset: 0px
 			outline: none
 
 		&[disabled]
-			cursor: unset
-
 			& + span
 				cursor: unset
 
 	// -- LABEL
 	span
-		// cursor: pointer
+		cursor: pointer
 
 		margin: 0
 		vertical-align: top
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_radiobutton.sass b/frameworks/projects/Jewel/src/main/sass/components/_radiobutton.sass
index aa95a98..1e65a51 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_radiobutton.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_radiobutton.sass
@@ -33,12 +33,10 @@ $radiobutton-button-yoffset: 0px
 
 	// width: 100%
 	height: $radiobutton-button-size
-	cursor: pointer
 
 	// -- INPUT
 	input
 		+appear(none)
-		// cursor: pointer
 		display: inline-flex
 
 		margin: 0
@@ -79,14 +77,12 @@ $radiobutton-button-yoffset: 0px
 			outline: none
 			
 		&[disabled]
-			cursor: unset
-
 			& + span
 				cursor: unset
 				
 	// -- LABEL
 	span
-		// cursor: pointer
+		cursor: pointer
 
 		margin: 0
 		vertical-align: top