2 'url:dijit/templates/ProgressBar.html':"<div class=\"dijitProgressBar dijitProgressBarEmpty\" role=\"progressbar\"\n\t><div data-dojo-attach-point=\"internalProgress\" class=\"dijitProgressBarFull\"\n\t\t><div class=\"dijitProgressBarTile\" role=\"presentation\"></div\n\t\t><span style=\"visibility:hidden\"> </span\n\t></div\n\t><div data-dojo-attach-point=\"labelNode\" class=\"dijitProgressBarLabel\" id=\"${id}_label\"></div\n\t><img data-dojo-attach-point=\"indeterminateHighContrastImage\" class=\"dijitProgressBarIndeterminateHighContrastImage\" alt=\"\"\n/></div>\n"}});
3 define("dijit/ProgressBar", [
4 "require", // require.toUrl
5 "dojo/_base/declare", // declare
6 "dojo/dom-class", // domClass.toggle
7 "dojo/_base/lang", // lang.mixin
8 "dojo/number", // number.format
11 "dojo/text!./templates/ProgressBar.html"
12 ], function(require
, declare
, domClass
, lang
, number
, _Widget
, _TemplatedMixin
, template
){
15 var _Widget = dijit._Widget;
16 var _TemplatedMixin = dijit._TemplatedMixin;
22 // A progress indication widget, showing the amount completed
23 // (often the percentage completed) of a task.
26 return declare("dijit.ProgressBar", [_Widget
, _TemplatedMixin
], {
28 // A progress indication widget, showing the amount completed
29 // (often the percentage completed) of a task.
32 // | <div data-dojo-type="ProgressBar"
34 // | value="..." maximum="...">
37 // progress: [const] String (Percentage or Number)
38 // Number or percentage indicating amount of task completed.
39 // Deprecated. Use "value" instead.
42 // value: String (Percentage or Number)
43 // Number or percentage indicating amount of task completed.
44 // With "%": percentage value, 0% <= progress <= 100%, or
45 // without "%": absolute value, 0 <= progress <= maximum.
46 // Infinity means that the progress bar is indeterminate.
49 // maximum: [const] Float
53 // places: [const] Number
54 // Number of places to show in values; 0 by default
57 // indeterminate: [const] Boolean
58 // If false: show progress value (number or percentage).
59 // If true: show that a process is underway but that the amount completed is unknown.
60 // Deprecated. Use "value" instead.
64 // Label on progress bar. Defaults to percentage for determinate progress bar and
65 // blank for indeterminate progress bar.
69 // this is the field name (for a form) if set. This needs to be set if you want to use
70 // this widget in a dijit.form.Form widget (such as dijit.Dialog)
73 templateString
: template
,
75 // _indeterminateHighContrastImagePath: [private] URL
76 // URL to image to use for indeterminate progress bar when display is in high contrast mode
77 _indeterminateHighContrastImagePath
:
78 require
.toUrl("./themes/a11y/indeterminate_progress.gif"),
80 postMixInProperties: function(){
81 this.inherited(arguments
);
82 if(!("value" in this.params
)){
83 this.value
= this.indeterminate
? Infinity
: this.progress
;
87 buildRendering: function(){
88 this.inherited(arguments
);
89 this.indeterminateHighContrastImage
.setAttribute("src",
90 this._indeterminateHighContrastImagePath
.toString());
94 update: function(/*Object?*/attributes
){
96 // Internal method to change attributes of ProgressBar, similar to set(hash). Users should call
97 // set("value", ...) rather than calling this method directly.
99 // May provide progress and/or maximum properties on this parameter;
100 // see attribute specs for details.
102 // | myProgressBar.update({'indeterminate': true});
103 // | myProgressBar.update({'progress': 80});
104 // | myProgressBar.update({'indeterminate': true, label:"Loading ..." })
108 // TODO: deprecate this method and use set() instead
110 lang
.mixin(this, attributes
|| {});
111 var tip
= this.internalProgress
, ap
= this.domNode
;
113 if(this.indeterminate
){
114 ap
.removeAttribute("aria-valuenow");
115 ap
.removeAttribute("aria-valuemin");
116 ap
.removeAttribute("aria-valuemax");
118 if(String(this.progress
).indexOf("%") != -1){
119 percent
= Math
.min(parseFloat(this.progress
)/100, 1);
120 this.progress
= percent
* this.maximum
;
122 this.progress
= Math
.min(this.progress
, this.maximum
);
123 percent
= this.maximum
? this.progress
/ this.maximum
: 0;
126 ap
.setAttribute("aria-describedby", this.labelNode
.id
);
127 ap
.setAttribute("aria-valuenow", this.progress
);
128 ap
.setAttribute("aria-valuemin", 0);
129 ap
.setAttribute("aria-valuemax", this.maximum
);
131 this.labelNode
.innerHTML
= this.report(percent
);
133 domClass
.toggle(this.domNode
, "dijitProgressBarIndeterminate", this.indeterminate
);
134 tip
.style
.width
= (percent
* 100) + "%";
138 _setValueAttr: function(v
){
139 this._set("value", v
);
141 this.update({indeterminate
:true});
143 this.update({indeterminate
:false, progress
:v
});
147 _setLabelAttr: function(label
){
148 this._set("label", label
);
152 _setIndeterminateAttr: function(indeterminate
){
153 // Deprecated, use set("value", ...) instead
154 this.indeterminate
= indeterminate
;
158 report: function(/*float*/percent
){
160 // Generates message to show inside progress bar (normally indicating amount of task completed).
161 // May be overridden.
165 return this.label
? this.label
:
166 (this.indeterminate
? " " : number
.format(percent
, { type
: "percent", places
: this.places
, locale
: this.lang
}));
169 onChange: function(){
171 // Callback fired when progress updates.