>* Regex patterns like proposed by Justin and Maxime (this will allow us to
restrict a insertion to a Max/Min value).

Is the regex requirement just for numbers or all input?  

-Mark

-----Original Message-----
From: carlos.rov...@gmail.com [mailto:carlos.rov...@gmail.com] On Behalf Of 
Carlos Rovira
Sent: Tuesday, January 07, 2014 7:38 PM
To: dev@flex.apache.org
Subject: Re: New Flex MaskedTextInput Spark Component

Hi,

I rewrite the MaskedTextInput component to support various important
concepts:

* get/set data vía "text" property (remove "rawText" property). "get" text
remove separators and "set" text format the string to display in the
component. I think this the most important improvement.
* Support for more than one separator (now the property is "separators"). I
added "-+/|()[]{}.", but I think Maxime has a more complete list that I
will check before first commit.
* Now the component "jumps" separator places (i.e: (+34)915.666.77.88)
* Support for custom prompt vía new property "textMaskPrompt" (i.e:
dd/mm/yyyy)
* removed the need of a MaskedTextInputSkin (now using TextInputSkin and
getCurrentSkinState)
* remove the uppercase, so now is a CSS style using property
typographicCase: uppercase;
* flex life cycle is better used (commitProperties) and text is always fine
thanks to dispatchEvent(new Event("textChanged")); both in insertion,
override, etc...
* bettter handling of restricted chars using TextOperationEvent.CHANGING to
cancel the insert operation.
* simplified the logic getting a more clean code (the Automata's logic is
now few methods compared with old version)
* new getter "fullText" to get a convenient method that get the text
formatted with separators included
* removed test validation in latest version posted (this was only for my
testing purposes and not for a final SDK component)
* rewrite the docs.

I think this version is more like a 1.0 version (I need to make some
further testing since I could consider finished but right now I could
considere in a decent shape)

What is not implemented yet:

* Regex patterns like proposed by Justin and Maxime (this will allow us to
restrict a insertion to a Max/Min value).
* A handling of "insertion in a place" (i.e. inserting blank spaces between
chars, or inserts directly in char at position 5). My approach is more like
a normal text input that you can add/remove characters taking into account
all string dragging the rest of string with the operation. Is the way I see
in similar components in other technologies out there. Maybe this could be
discussed or make a configuration to support both methods (i.e:
dragMode="true/false" or something similar)
* As I use TextOperationEvent, I think this component is not mobile
friendly. Maybe someone could point me how we could support it as well
(StageText,...)
* I think copy/paste could be improved supporting "appending" text, as well
select a piece of intermediate text and make cut, copy and paste... (this
maybe could be added soon)

Here is the code:

AS3: https://gist.github.com/carlosrovira/7895322
CSS: https://gist.github.com/carlosrovira/7895435

(I also put the namespace to spark.components, and the Apache header)

demo:

http://www.carlosrovira.com/blog/spark-maskedtextinput-demo/

Feedback is highly appreciated for this version to fix any bug before
commit to experimental library.

Best,

Carlos Rovira




Reply via email to