From f0cfe83e3725f9a3928da97a6e3085e79cb25309 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 18 Mar 2013 10:26:24 +0400 Subject: upgrade dojo to 1.8.3 (refs #570) --- .../form/HorizontalRuleLabels.js.uncompressed.js | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 lib/dijit/form/HorizontalRuleLabels.js.uncompressed.js (limited to 'lib/dijit/form/HorizontalRuleLabels.js.uncompressed.js') diff --git a/lib/dijit/form/HorizontalRuleLabels.js.uncompressed.js b/lib/dijit/form/HorizontalRuleLabels.js.uncompressed.js new file mode 100644 index 000000000..f8f418748 --- /dev/null +++ b/lib/dijit/form/HorizontalRuleLabels.js.uncompressed.js @@ -0,0 +1,92 @@ +define("dijit/form/HorizontalRuleLabels", [ + "dojo/_base/declare", // declare + "dojo/number", // number.format + "dojo/query", // query + "./HorizontalRule" +], function(declare, number, query, HorizontalRule){ + +// module: +// dijit/form/HorizontalRuleLabels + +return declare("dijit.form.HorizontalRuleLabels", HorizontalRule, { + // summary: + // Labels for `dijit/form/HorizontalSlider` + + templateString: '
', + + // labelStyle: String + // CSS style to apply to individual text labels + labelStyle: "", + + // labels: String[]? + // Array of text labels to render - evenly spaced from left-to-right or bottom-to-top. + // Alternately, minimum and maximum can be specified, to get numeric labels. + labels: [], + + // numericMargin: Integer + // Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified + numericMargin: 0, + + // numericMinimum: Integer + // Leftmost label value for generated numeric labels when labels[] are not specified + minimum: 0, + + // numericMaximum: Integer + // Rightmost label value for generated numeric labels when labels[] are not specified + maximum: 1, + + // constraints: Object + // pattern, places, lang, et al (see dojo.number) for generated numeric labels when labels[] are not specified + constraints: {pattern:"#%"}, + + _positionPrefix: '
', + _suffix: '
', + + _calcPosition: function(pos){ + // summary: + // Returns the value to be used in HTML for the label as part of the left: attribute + // tags: + // protected extension + return pos; + }, + + _genHTML: function(pos, ndx){ + return this._positionPrefix + this._calcPosition(pos) + this._positionSuffix + this.labelStyle + this._labelPrefix + this.labels[ndx] + this._suffix; + }, + + getLabels: function(){ + // summary: + // Overridable function to return array of labels to use for this slider. + // Can specify a getLabels() method instead of a labels[] array, or min/max attributes. + // tags: + // protected extension + + // if the labels array was not specified directly, then see if
  • children were + var labels = this.labels; + if(!labels.length && this.srcNodeRef){ + // for markup creation, labels are specified as child elements + labels = query("> li", this.srcNodeRef).map(function(node){ + return String(node.innerHTML); + }); + } + // if the labels were not specified directly and not as
  • children, then calculate numeric labels + if(!labels.length && this.count > 1){ + var start = this.minimum; + var inc = (this.maximum - start) / (this.count-1); + for(var i=0; i < this.count; i++){ + labels.push((i < this.numericMargin || i >= (this.count-this.numericMargin)) ? '' : number.format(start, this.constraints)); + start += inc; + } + } + return labels; + }, + + postMixInProperties: function(){ + this.inherited(arguments); + this.labels = this.getLabels(); + this.count = this.labels.length; + } +}); + +}); -- cgit v1.2.3-54-g00ecf