| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"../_Widget", |
| 4 |
"../_TemplatedMixin" |
| 5 |
], function(declare, _Widget, _TemplatedMixin){ |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
return declare("dijit.form.HorizontalRule", [_Widget, _TemplatedMixin], { |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
templateString: '<div class="dijitRuleContainer dijitRuleContainerH"></div>', |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
count: 3, |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
container: "containerNode", |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
ruleStyle: "", |
| 28 |
|
| 29 |
_positionPrefix: '<div class="dijitRuleMark dijitRuleMarkH" style="left:', |
| 30 |
_positionSuffix: '%;', |
| 31 |
_suffix: '"></div>', |
| 32 |
|
| 33 |
_genHTML: function(pos){ |
| 34 |
return this._positionPrefix + pos + this._positionSuffix + this.ruleStyle + this._suffix; |
| 35 |
}, |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
_isHorizontal: true, |
| 40 |
|
| 41 |
buildRendering: function(){ |
| 42 |
this.inherited(arguments); |
| 43 |
|
| 44 |
var innerHTML; |
| 45 |
if(this.count == 1){ |
| 46 |
innerHTML = this._genHTML(50, 0); |
| 47 |
}else{ |
| 48 |
var i; |
| 49 |
var interval = 100 / (this.count - 1); |
| 50 |
if(!this._isHorizontal || this.isLeftToRight()){ |
| 51 |
innerHTML = this._genHTML(0, 0); |
| 52 |
for(i = 1; i < this.count - 1; i++){ |
| 53 |
innerHTML += this._genHTML(interval * i, i); |
| 54 |
} |
| 55 |
innerHTML += this._genHTML(100, this.count - 1); |
| 56 |
}else{ |
| 57 |
innerHTML = this._genHTML(100, 0); |
| 58 |
for(i = 1; i < this.count - 1; i++){ |
| 59 |
innerHTML += this._genHTML(100 - interval * i, i); |
| 60 |
} |
| 61 |
innerHTML += this._genHTML(0, this.count - 1); |
| 62 |
} |
| 63 |
} |
| 64 |
this.domNode.innerHTML = innerHTML; |
| 65 |
} |
| 66 |
}); |
| 67 |
}); |