1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "dojo/_base/window", |
---|
4 | "dojo/dom-construct", |
---|
5 | "dijit/_Contained", |
---|
6 | "dijit/_WidgetBase", |
---|
7 | "dojo/has", |
---|
8 | "dojo/has!dojo-bidi?dojox/mobile/bidi/RoundRectCategory" |
---|
9 | ], function(declare, win, domConstruct, Contained, WidgetBase, has, BidiRoundRectCategory){ |
---|
10 | |
---|
11 | // module: |
---|
12 | // dojox/mobile/RoundRectCategory |
---|
13 | |
---|
14 | var RoundRectCategory = declare(has("dojo-bidi") ? "dojox.mobile.NonBidiRoundRectCategory" : "dojox.mobile.RoundRectCategory", [WidgetBase, Contained], { |
---|
15 | // summary: |
---|
16 | // A category header for a rounded rectangle list. |
---|
17 | |
---|
18 | // label: String |
---|
19 | // A label of the category. If the label is not specified, |
---|
20 | // innerHTML is used as a label. |
---|
21 | label: "", |
---|
22 | |
---|
23 | // tag: String |
---|
24 | // A name of html tag to create as domNode. |
---|
25 | tag: "h2", |
---|
26 | |
---|
27 | /* internal properties */ |
---|
28 | |
---|
29 | // baseClass: String |
---|
30 | // The name of the CSS class of this widget. |
---|
31 | baseClass: "mblRoundRectCategory", |
---|
32 | |
---|
33 | buildRendering: function(){ |
---|
34 | var domNode = this.domNode = this.containerNode = this.srcNodeRef || domConstruct.create(this.tag); |
---|
35 | this.inherited(arguments); |
---|
36 | if(!this.label && domNode.childNodes.length === 1 && domNode.firstChild.nodeType === 3){ |
---|
37 | // if it has only one text node, regard it as a label |
---|
38 | this.label = domNode.firstChild.nodeValue; |
---|
39 | } |
---|
40 | }, |
---|
41 | |
---|
42 | _setLabelAttr: function(/*String*/label){ |
---|
43 | // summary: |
---|
44 | // Sets the category header text. |
---|
45 | // tags: |
---|
46 | // private |
---|
47 | this.label = label; |
---|
48 | this.domNode.innerHTML = this._cv ? this._cv(label) : label; |
---|
49 | } |
---|
50 | }); |
---|
51 | |
---|
52 | return has("dojo-bidi") ? declare("dojox.mobile.RoundRectCategory", [RoundRectCategory, BidiRoundRectCategory]) : RoundRectCategory; |
---|
53 | }); |
---|