]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/ComboBoxMixin.js.uncompressed.js
2 'url:dijit/form/templates/DropDownBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\"\n\tid=\"widget_${id}\"\n\trole=\"combobox\"\n\t><div class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer'\n\t\tdata-dojo-attach-point=\"_buttonNode, _popupStateNode\" role=\"presentation\"\n\t\t><input class=\"dijitReset dijitInputField dijitArrowButtonInner\" value=\"▼ \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t\t\t${_buttonInputDisabled}\n\t/></div\n\t><div class='dijitReset dijitValidationContainer'\n\t\t><input class=\"dijitReset dijitInputField dijitValidationIcon dijitValidationInner\" value=\"Χ \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t/></div\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class='dijitReset dijitInputInner' ${!nameAttrSetting} type=\"text\" autocomplete=\"off\"\n\t\t\tdata-dojo-attach-point=\"textbox,focusNode\" role=\"textbox\" aria-haspopup=\"true\"\n\t/></div\n></div>\n"}});
3 define("dijit/form/ComboBoxMixin", [
4 "dojo/_base/declare", // declare
6 "dojo/_base/kernel", // kernel.deprecated
7 "dojo/_base/lang", // lang.mixin
8 "dojo/store/util/QueryResults", // dojo.store.util.QueryResults
9 "./_AutoCompleterMixin",
12 "dojo/text!./templates/DropDownBox.html"
13 ], function(declare
, Deferred
, kernel
, lang
, QueryResults
, _AutoCompleterMixin
, _ComboBoxMenu
, _HasDropDown
, template
){
16 var _AutoCompleterMixin = dijit.form._AutoCompleterMixin;
17 var _ComboBoxMenu = dijit.form._ComboBoxMenu;
18 var _HasDropDown = dijit._HasDropDown;
22 // dijit/form/ComboBoxMixin
24 // Provides main functionality of ComboBox widget
26 return declare("dijit.form.ComboBoxMixin", [_HasDropDown
, _AutoCompleterMixin
], {
28 // Provides main functionality of ComboBox widget
30 // dropDownClass: [protected extension] Function String
31 // Dropdown widget class used to select a date/time.
32 // Subclasses should specify this.
33 dropDownClass
: _ComboBoxMenu
,
35 // hasDownArrow: Boolean
36 // Set this textbox to have a down arrow button, to display the drop down list.
40 templateString
: template
,
42 baseClass
: "dijitTextBox dijitComboBox",
45 // store: [const] dojo.store.api.Store || dojo.data.api.Read
46 // Reference to data provider object used by this ComboBox.
48 // Should be dojo.store.api.Store, but dojo.data.api.Read supported
49 // for backwards compatibility.
53 // Set classes like dijitDownArrowButtonHover depending on
54 // mouse action over button node
56 "_buttonNode": "dijitDownArrowButton"
59 _setHasDownArrowAttr: function(/*Boolean*/ val
){
60 this._set("hasDownArrow", val
);
61 this._buttonNode
.style
.display
= val
? "" : "none";
64 _showResultList: function(){
66 this.displayMessage("");
67 this.inherited(arguments
);
70 _setStoreAttr: function(store
){
71 // For backwards-compatibility, accept dojo.data store in addition to dojo.store.store. Remove in 2.0.
77 // Retrieves an object by it's identity. This will trigger a fetchItemByIdentity.
78 // Like dojo.store.DataStore.get() except returns native item.
79 var deferred
= new Deferred();
80 this.fetchItemByIdentity({
82 onItem: function(object
){
83 deferred
.resolve(object
);
85 onError: function(error
){
86 deferred
.reject(error
);
89 return deferred
.promise
;
91 query: function(query
, options
){
93 // Queries the store for objects. Like dojo.store.DataStore.query()
94 // except returned Deferred contains array of native items.
95 var deferred
= new Deferred(function(){ fetchHandle
.abort
&& fetchHandle
.abort(); });
96 var fetchHandle
= this.fetch(lang
.mixin({
98 onBegin: function(count
){
99 deferred
.total
= count
;
101 onComplete: function(results
){
102 deferred
.resolve(results
);
104 onError: function(error
){
105 deferred
.reject(error
);
108 return QueryResults(deferred
);
112 this._set("store", store
);
115 postMixInProperties: function(){
116 // Since _setValueAttr() depends on this.store, _setStoreAttr() needs to execute first.
117 // Unfortunately, without special code, it ends up executing second.
118 if(this.params
.store
){
119 this._setStoreAttr(this.params
.store
);
122 this.inherited(arguments
);
124 // User may try to access this.store.getValue() etc. in a custom labelFunc() function.
125 // It's not available with the new data store for handling inline <option> tags, so add it.
126 if(!this.params
.store
){
127 var clazz
= this.declaredClass
;
128 lang
.mixin(this.store
, {
129 getValue: function(item
, attr
){
130 kernel
.deprecated(clazz
+ ".store.getValue(item, attr) is deprecated for builtin store. Use item.attr directly", "", "2.0");
133 getLabel: function(item
){
134 kernel
.deprecated(clazz
+ ".store.getLabel(item) is deprecated for builtin store. Use item.label directly", "", "2.0");
137 fetch: function(args
){
138 kernel
.deprecated(clazz
+ ".store.fetch() is deprecated for builtin store.", "Use store.query()", "2.0");
139 var shim
= ["dojo/data/ObjectStore"]; // indirection so it doesn't get rolled into a build
140 require(shim
, lang
.hitch(this, function(ObjectStore
){
141 new ObjectStore({objectStore
: this}).fetch(args
);