| 1 |
define([ |
| 2 |
"dojo/_base/array", |
| 3 |
"dojo/_base/declare", |
| 4 |
"dijit/_Contained", |
| 5 |
"dijit/_Container", |
| 6 |
"dijit/_WidgetBase", |
| 7 |
"dojo/has", |
| 8 |
"dojo/has!dojo-bidi?dojox/mobile/bidi/_PickerBase" |
| 9 |
], function(array, declare, Contained, Container, WidgetBase, has, _BidiPickerBase){ |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
var _PickerBase = declare(has("dojo-bidi") ? "dojox.mobile.NonBidi_PickerBase" : "dojox.mobile._PickerBase", [WidgetBase, Container, Contained],{ |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
slotClasses: [], |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
slotProps: [], |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
slotOrder: [], |
| 51 |
|
| 52 |
buildRendering: function(){ |
| 53 |
this.inherited(arguments); |
| 54 |
this.slots = []; |
| 55 |
for(var i = 0; i < this.slotClasses.length; i++){ |
| 56 |
var idx = this.slotOrder.length ? this.slotOrder[i] : i; |
| 57 |
var slot = new this.slotClasses[idx](this.slotProps[idx]); |
| 58 |
this.addChild(slot); |
| 59 |
this.slots[idx] = slot; |
| 60 |
} |
| 61 |
}, |
| 62 |
|
| 63 |
startup: function(){ |
| 64 |
if(this._started){ return; } |
| 65 |
this._duringStartup = true; |
| 66 |
this.inherited(arguments); |
| 67 |
this.reset(); |
| 68 |
delete this._duringStartup; |
| 69 |
}, |
| 70 |
|
| 71 |
getSlots: function(){ |
| 72 |
|
| 73 |
|
| 74 |
return this.slots.length ? this.slots : |
| 75 |
array.filter(this.getChildren(), function(c){ |
| 76 |
return c.declaredClass.indexOf("Slot") !== -1; |
| 77 |
}); |
| 78 |
}, |
| 79 |
|
| 80 |
_getValuesAttr: function(){ |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
return array.map(this.getSlots(), function(w){ |
| 86 |
return w.get("value"); |
| 87 |
}); |
| 88 |
}, |
| 89 |
|
| 90 |
_setValuesAttr: function(a){ |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
array.forEach(this.getSlots(), function(w, i){ |
| 96 |
w.set("value", a[i]); |
| 97 |
}); |
| 98 |
}, |
| 99 |
|
| 100 |
_setColorsAttr: function(a){ |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
array.forEach(this.getSlots(), function(w, i){ |
| 106 |
w.setColor && w.setColor(a[i]); |
| 107 |
}); |
| 108 |
}, |
| 109 |
|
| 110 |
reset: function(){ |
| 111 |
|
| 112 |
|
| 113 |
array.forEach(this.getSlots(), function(w){ |
| 114 |
w.setInitialValue(); |
| 115 |
}); |
| 116 |
} |
| 117 |
}); |
| 118 |
return has("dojo-bidi") ? declare("dojox.mobile._PickerBase", [_PickerBase, _BidiPickerBase]) : _PickerBase; |
| 119 |
}); |