You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2016/11/04 16:10:56 UTC
[20/35] git commit: [flex-asjs] [refs/heads/feature/mdl] - Text Input
with floating text
Text Input with floating text
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/43f829a1
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/43f829a1
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/43f829a1
Branch: refs/heads/feature/mdl
Commit: 43f829a1e5bf027592886568c0c32480747c9992
Parents: f434c6a
Author: Carlos Rovira <ca...@apache.org>
Authored: Wed Oct 19 02:21:37 2016 +0200
Committer: Carlos Rovira <ca...@apache.org>
Committed: Fri Nov 4 17:10:12 2016 +0100
----------------------------------------------------------------------
.../flexjs/MDLExample/src/main/flex/App.mxml | 5 ++-
.../main/flex/org/apache/flex/mdl/TextInput.as | 45 +++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/43f829a1/examples/flexjs/MDLExample/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml
index 95dad1b..636b72b 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -57,7 +57,9 @@ limitations under the License.
</js:Container>
<!-- Text Fields :: https://getmdl.io/components/index.html#textfields-section -->
- <mdl:TextInput id="mdlti" text="Something..." change="mdlchk.text = mdlti.text"/>
+ <mdl:TextInput id="mdlti" change="mdlchk.text = mdlti.text" text="Text..."/>
+
+ <mdl:TextInput mdlEffect="mdl-textfield--floating-label" text="Floating Label"/>
<!-- Toggles :: https://getmdl.io/components/index.html#toggles-section -->
<mdl:CheckBox id="mdlchk" text="This Checks" selected="true"/>
@@ -66,6 +68,7 @@ limitations under the License.
<mdl:RadioButton groupName="g1" text="Black"/>
<mdl:RadioButton groupName="g1" text="White"/>
<mdl:RadioButton groupName="g1" text="Red"/>
+
</js:Form>
</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/43f829a1/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
index 4617678..48d71bf 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
@@ -49,8 +49,17 @@ package org.apache.flex.mdl
super();
}
+ COMPILE::JS
+ {
+ private var _textNode:Text;
+ }
+
/**
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLDivElement
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion HTMLLabelElement
+ * @flexjsignorecoercion Text
*/
COMPILE::JS
override protected function createElement():WrappedHTMLElement
@@ -70,7 +79,7 @@ package org.apache.flex.mdl
label = document.createElement('label') as HTMLLabelElement;
label.className = "mdl-textfield__label";
- textNode = document.createTextNode('') as Text;
+ _textNode = textNode = document.createTextNode('') as Text;
label.appendChild(textNode);
div.appendChild(input);
@@ -94,5 +103,39 @@ package org.apache.flex.mdl
return element;
}
+ private var _mdlEffect:String = "";
+
+ public function get mdlEffect():String
+ {
+ return _mdlEffect;
+ }
+
+ public function set mdlEffect(value:String):void
+ {
+ _mdlEffect = value;
+ COMPILE::JS
+ {
+ element.className = 'mdl-textfield mdl-js-textfield ' + _mdlEffect;
+ }
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ override public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ //inSetter = true;
+ //ITextModel(model).text = value;
+ //inSetter = false;
+ }
+ COMPILE::JS
+ {
+ _textNode.text = value;
+ dispatchEvent(new Event('textChange'));
+ }
+ }
}
}