]>
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=\"button presentation\" aria-hidden=\"true\"\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",
9 "./_AutoCompleterMixin",
12 "dojo/text!./templates/DropDownBox.html"
13 ], function(declare
, Deferred
, kernel
, lang
, QueryResults
, _AutoCompleterMixin
, _ComboBoxMenu
, _HasDropDown
, template
){
17 // dijit/form/ComboBoxMixin
19 return declare("dijit.form.ComboBoxMixin", [_HasDropDown
, _AutoCompleterMixin
], {
21 // Provides main functionality of ComboBox widget
23 // dropDownClass: [protected extension] Function String
24 // Dropdown widget class used to select a date/time.
25 // Subclasses should specify this.
26 dropDownClass
: _ComboBoxMenu
,
28 // hasDownArrow: Boolean
29 // Set this textbox to have a down arrow button, to display the drop down list.
33 templateString
: template
,
35 baseClass
: "dijitTextBox dijitComboBox",
38 // store: [const] dojo/store/api/Store|dojo/data/api/Read
39 // Reference to data provider object used by this ComboBox.
41 // Should be dojo/store/api/Store, but dojo/data/api/Read supported
42 // for backwards compatibility.
46 // Set classes like dijitDownArrowButtonHover depending on
47 // mouse action over button node
49 "_buttonNode": "dijitDownArrowButton"
52 _setHasDownArrowAttr: function(/*Boolean*/ val
){
53 this._set("hasDownArrow", val
);
54 this._buttonNode
.style
.display
= val
? "" : "none";
57 _showResultList: function(){
59 this.displayMessage("");
60 this.inherited(arguments
);
63 _setStoreAttr: function(store
){
64 // For backwards-compatibility, accept dojo.data store in addition to dojo/store/api/Store. Remove in 2.0.
70 // Retrieves an object by it's identity. This will trigger a fetchItemByIdentity.
71 // Like dojo/store/DataStore.get() except returns native item.
72 var deferred
= new Deferred();
73 this.fetchItemByIdentity({
75 onItem: function(object
){
76 deferred
.resolve(object
);
78 onError: function(error
){
79 deferred
.reject(error
);
82 return deferred
.promise
;
84 query: function(query
, options
){
86 // Queries the store for objects. Like dojo/store/DataStore.query()
87 // except returned Deferred contains array of native items.
88 var deferred
= new Deferred(function(){ fetchHandle
.abort
&& fetchHandle
.abort(); });
89 deferred
.total
= new Deferred();
90 var fetchHandle
= this.fetch(lang
.mixin({
92 onBegin: function(count
){
93 deferred
.total
.resolve(count
);
95 onComplete: function(results
){
96 deferred
.resolve(results
);
98 onError: function(error
){
99 deferred
.reject(error
);
102 return QueryResults(deferred
);
106 this._set("store", store
);
109 postMixInProperties: function(){
110 // Since _setValueAttr() depends on this.store, _setStoreAttr() needs to execute first.
111 // Unfortunately, without special code, it ends up executing second.
112 var store
= this.params
.store
|| this.store
;
114 this._setStoreAttr(store
);
117 this.inherited(arguments
);
119 // User may try to access this.store.getValue() etc. in a custom labelFunc() function.
120 // It's not available with the new data store for handling inline <option> tags, so add it.
121 if(!this.params
.store
&& !this.store
._oldAPI
){
122 var clazz
= this.declaredClass
;
123 lang
.mixin(this.store
, {
124 getValue: function(item
, attr
){
125 kernel
.deprecated(clazz
+ ".store.getValue(item, attr) is deprecated for builtin store. Use item.attr directly", "", "2.0");
128 getLabel: function(item
){
129 kernel
.deprecated(clazz
+ ".store.getLabel(item) is deprecated for builtin store. Use item.label directly", "", "2.0");
132 fetch: function(args
){
133 kernel
.deprecated(clazz
+ ".store.fetch() is deprecated for builtin store.", "Use store.query()", "2.0");
134 var shim
= ["dojo/data/ObjectStore"]; // indirection so it doesn't get rolled into a build
135 require(shim
, lang
.hitch(this, function(ObjectStore
){
136 new ObjectStore({objectStore
: this}).fetch(args
);