Changeset 12954

Show
Ignore:
Timestamp:
03/06/08 20:09:10 (10 months ago)
Author:
peller
Message:

Add CurrencyTextBox? constraints docs. Refs #6075 !strict

Files:
5 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/CurrencyTextBox.js

    r12665 r12954  
    1414                //              A validating currency textbox 
    1515                // 
     16                // constraints: dijit.form._DateTimeTextBox.__Constraints  
     17                // 
    1618                // currency: String 
    17                 //              the ISO4217 currency code, a three letter sequence like "USD" 
    18                 //              See http://en.wikipedia.org/wiki/ISO_4217 
     19                //              the [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD" 
    1920                currency: "", 
     21 
     22                /*===== 
     23                constraints: {}, 
     24                ======*/ 
    2025 
    2126                regExpGen: dojo.currency.regexp, 
    2227                _formatter: dojo.currency.format, 
     28/*===== 
     29                parse: function(value, constraints){ 
     30                        //      summary: parses the value as a Currency, according to constraints 
     31                        //      value: String 
     32                        // 
     33                        //      constraints: dojo.currency.__ParseOptions 
     34                }, 
     35=====*/ 
    2336                parse: dojo.currency.parse, 
    2437 
  • dijit/trunk/form/NumberTextBox.js

    r12952 r12954  
    3636 
    3737                format: function(/*Number*/ value, /*dojo.number.__FormatOptions*/ constraints){ 
     38                        //      summary: formats the value as a Number, according to constraints 
     39 
    3840                        if(typeof value == "string") { return value; } 
    3941                        if(isNaN(value)){ return ""; } 
     
    4749                /*===== 
    4850                parse: function(value, constraints){ 
     51                        //      summary: parses the value as a Number, according to constraints 
    4952                        //      value: String 
    5053                        // 
  • dijit/trunk/form/_DateTimeTextBox.js

    r12944 r12954  
    2828                compare: dojo.date.compare, 
    2929                format: function(/*Date*/ value, /*dojo.date.locale.__FormatOptions*/ constraints){ 
     30                        //      summary: formats the value as a Date, according to constraints 
    3031                        if(!value){ return ''; } 
    3132                        return dojo.date.locale.format(value, constraints); 
    3233                }, 
    3334                parse: function(/*String*/ value, /*dojo.date.locale.__FormatOptions*/ constraints){ 
     35                        //      summary: parses the value as a Date, according to constraints 
    3436                        return dojo.date.locale.parse(value, constraints) || undefined; /* can't return null to getValue since that's special */ 
    3537                }, 
  • dojo/trunk/currency.js

    r11695 r12954  
    3333} 
    3434 
    35 dojo.currency.format = function(/*Number*/value, /*Object?*/options){ 
     35dojo.currency.format = function(/*Number*/value, /*dojo.number.__FormatOptions?*/options){ 
    3636// summary: 
    37 //              Format a Number as a String, using locale-specific settings 
     37//              Format a Number as a currency, using locale-specific settings 
    3838// 
    3939// description: 
    40 //              Create a string from a Number using a known localized pattern. 
    41 //              Formatting patterns appropriate to the locale are chosen from the CLDR http://unicode.org/cldr 
    42 //              as well as the appropriate symbols and delimiters.  See http://www.unicode.org/reports/tr35/#Number_Elements 
     40//              Create a string from a Number using a known, localized pattern. 
     41//              [Formatting patterns](http://www.unicode.org/reports/tr35/#Number_Elements) appropriate to the locale are chosen from the [CLDR](http://unicode.org/cldr) 
     42//              as well as the appropriate symbols and delimiters. 
    4343// 
    4444// value: 
    4545//              the number to be formatted. 
    46 // 
    47 // options: object {currency: String, pattern: String?, places: Number?, round: Number?, symbol: String?, locale: String?} 
    48 //              currency- the ISO4217 currency code, a three letter sequence like "USD" 
    49 //                      See http://en.wikipedia.org/wiki/ISO_4217 
    50 //              symbol- override currency symbol. Normally, will be looked up in table of supported currencies, and ISO currency code will 
    51 //                      be used if not found.  See dojo.i18n.cldr.nls->currency.js 
    52 //              pattern- override formatting pattern with this string (see dojo.number.applyPattern) 
    53 //              places- fixed number of decimal places to show.  Default is defined by the currency. 
    54 //          round- 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1 means don't round. 
    55 //              locale- override the locale used to determine formatting rules 
    5646 
    5747        return dojo.number.format(value, dojo.currency._mixInDefaults(options)); 
    5848} 
    5949 
    60 dojo.currency.regexp = function(/*Object?*/options){ 
     50dojo.currency.regexp = function(/*dojo.number.__RegexpOptions?*/options){ 
    6151// 
    6252// summary: 
    63 //              Builds the regular needed to parse a number 
     53//              Builds the regular needed to parse a currency value 
    6454// 
    6555// description: 
     
    7868} 
    7969 
    80 dojo.currency.parse = function(/*String*/expression, /*Object?*/options){ 
    81 // 
    82 // summary: 
    83 //              Convert a properly formatted string to a primitive Number, 
    84 //              using locale-specific settings. 
    85 // 
    86 // description: 
    87 //              Create a Number from a string using a known localized pattern. 
    88 //              Formatting patterns are chosen appropriate to the locale. 
    89 //              Formatting patterns are implemented using the syntax described at *URL* 
    90 // 
    91 // expression: A string representation of a Number 
    92 // 
    93 // options: object {pattern: string, locale: string, strict: boolean} 
    94 //              currency- the ISO4217 currency code, a three letter sequence like "USD" 
    95 //                      See http://en.wikipedia.org/wiki/ISO_4217 
    96 //              symbol- override currency symbol. Normally, will be looked up in table of supported currencies, and ISO currency code will 
    97 //                      be used if not found.  See dojo.i18n.cldr.nls->currency.js 
    98 //              pattern- override pattern with this string 
    99 //              locale- override the locale used to determine formatting rules 
    100 //              strict- strict parsing, false by default 
    101 //              places- number of decimal places to accept.  Default is defined by currency. 
    102 //              fractional- where places are implied by pattern or explicit 'places' parameter, whether to include the fractional portion. 
    103 //                      By default for currencies, it the fractional portion is optional. 
     70/*===== 
     71dojo.declare("dojo.currency.__ParseOptions", [dojo.number.__ParseOptions], { 
     72        //      type: String? 
     73        //              currency, set by default. 
     74        //      symbol: String? 
     75        //              override currency symbol. Normally, will be looked up in table of supported currencies, 
     76        //              and ISO currency code will be used if not found.  See dojo.i18n.cldr.nls->currency.js 
     77        //      places: Number? 
     78        //              number of decimal places to accept.  Default is defined by currency. 
     79        //      fractional: Boolean?|Array? 
     80        //              where places are implied by pattern or explicit 'places' parameter, whether to include the fractional portion. 
     81        //              By default for currencies, it the fractional portion is optional. 
     82 
     83        this.type = type; 
     84}); 
     85=====*/ 
     86 
     87dojo.currency.parse = function(/*String*/expression, /*dojo.currency.__ParseOptions?*/options){ 
     88        // 
     89        // summary: 
     90        //              Convert a properly formatted currency string to a primitive Number, 
     91        //              using locale-specific settings. 
     92        // 
     93        // description: 
     94        //              Create a Number from a string using a known, localized pattern. 
     95        //              [Formatting patterns](http://www.unicode.org/reports/tr35/#Number_Format_Patterns) are chosen appropriate to the locale. 
     96        // 
     97        // expression: A string representation of a Number 
     98 
    10499        return dojo.number.parse(expression, dojo.currency._mixInDefaults(options)); 
    105100} 
  • dojo/trunk/number.js

    r12862 r12954  
    1414dojo.number.__FormatOptions = function(){ 
    1515        //      pattern: String? 
    16         //              override formatting pattern with this string (see 
    17         //              dojo.number._applyPattern) 
     16        //              override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns) 
     17        //              with this string 
    1818        //      type: String? 
    1919        //              choose a format type based on the locale from the following: 
     
    2626        //              means don't round. 
    2727        //      currency: String? 
    28         //              iso4217 currency code 
     28        //              an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD" 
    2929        //      symbol: String? 
    3030        //              localized currency symbol