Changeset 12954
- Timestamp:
- 03/06/08 20:09:10 (10 months ago)
- Files:
-
- 5 modified
-
dijit/trunk/form/CurrencyTextBox.js (modified) (1 diff)
-
dijit/trunk/form/NumberTextBox.js (modified) (2 diffs)
-
dijit/trunk/form/_DateTimeTextBox.js (modified) (1 diff)
-
dojo/trunk/currency.js (modified) (2 diffs)
-
dojo/trunk/number.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/CurrencyTextBox.js
r12665 r12954 14 14 // A validating currency textbox 15 15 // 16 // constraints: dijit.form._DateTimeTextBox.__Constraints 17 // 16 18 // 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" 19 20 currency: "", 21 22 /*===== 23 constraints: {}, 24 ======*/ 20 25 21 26 regExpGen: dojo.currency.regexp, 22 27 _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 =====*/ 23 36 parse: dojo.currency.parse, 24 37 -
dijit/trunk/form/NumberTextBox.js
r12952 r12954 36 36 37 37 format: function(/*Number*/ value, /*dojo.number.__FormatOptions*/ constraints){ 38 // summary: formats the value as a Number, according to constraints 39 38 40 if(typeof value == "string") { return value; } 39 41 if(isNaN(value)){ return ""; } … … 47 49 /*===== 48 50 parse: function(value, constraints){ 51 // summary: parses the value as a Number, according to constraints 49 52 // value: String 50 53 // -
dijit/trunk/form/_DateTimeTextBox.js
r12944 r12954 28 28 compare: dojo.date.compare, 29 29 format: function(/*Date*/ value, /*dojo.date.locale.__FormatOptions*/ constraints){ 30 // summary: formats the value as a Date, according to constraints 30 31 if(!value){ return ''; } 31 32 return dojo.date.locale.format(value, constraints); 32 33 }, 33 34 parse: function(/*String*/ value, /*dojo.date.locale.__FormatOptions*/ constraints){ 35 // summary: parses the value as a Date, according to constraints 34 36 return dojo.date.locale.parse(value, constraints) || undefined; /* can't return null to getValue since that's special */ 35 37 }, -
dojo/trunk/currency.js
r11695 r12954 33 33 } 34 34 35 dojo.currency.format = function(/*Number*/value, /* Object?*/options){35 dojo.currency.format = function(/*Number*/value, /*dojo.number.__FormatOptions?*/options){ 36 36 // summary: 37 // Format a Number as a String, using locale-specific settings37 // Format a Number as a currency, using locale-specific settings 38 38 // 39 39 // 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/cldr42 // as well as the appropriate symbols and delimiters. See http://www.unicode.org/reports/tr35/#Number_Elements40 // 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. 43 43 // 44 44 // value: 45 45 // 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_421750 // symbol- override currency symbol. Normally, will be looked up in table of supported currencies, and ISO currency code will51 // be used if not found. See dojo.i18n.cldr.nls->currency.js52 // 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 rules56 46 57 47 return dojo.number.format(value, dojo.currency._mixInDefaults(options)); 58 48 } 59 49 60 dojo.currency.regexp = function(/* Object?*/options){50 dojo.currency.regexp = function(/*dojo.number.__RegexpOptions?*/options){ 61 51 // 62 52 // summary: 63 // Builds the regular needed to parse a number53 // Builds the regular needed to parse a currency value 64 54 // 65 55 // description: … … 78 68 } 79 69 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 /*===== 71 dojo.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 87 dojo.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 104 99 return dojo.number.parse(expression, dojo.currency._mixInDefaults(options)); 105 100 } -
dojo/trunk/number.js
r12862 r12954 14 14 dojo.number.__FormatOptions = function(){ 15 15 // pattern: String? 16 // override formatting pattern with this string (see17 // dojo.number._applyPattern)16 // override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns) 17 // with this string 18 18 // type: String? 19 19 // choose a format type based on the locale from the following: … … 26 26 // means don't round. 27 27 // currency: String? 28 // iso4217 currency code28 // an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD" 29 29 // symbol: String? 30 30 // localized currency symbol