tt-rss/lib/dijit/InlineEditBox.js

2 lines
9.2 KiB
JavaScript
Raw Normal View History

2012-08-14 16:59:10 +02:00
//>>built
2013-03-18 07:26:24 +01:00
require({cache:{"url:dijit/templates/InlineEditBox.html":"<span data-dojo-attach-point=\"editNode\" role=\"presentation\" class=\"dijitReset dijitInline dijitOffScreen\"\n\tdata-dojo-attach-event=\"onkeypress: _onKeyPress\"\n\t><span data-dojo-attach-point=\"editorPlaceholder\"></span\n\t><span data-dojo-attach-point=\"buttonContainer\"\n\t\t><button data-dojo-type=\"dijit/form/Button\" data-dojo-props=\"label: '${buttonSave}', 'class': 'saveButton'\"\n\t\t\tdata-dojo-attach-point=\"saveButton\" data-dojo-attach-event=\"onClick:save\"></button\n\t\t><button data-dojo-type=\"dijit/form/Button\" data-dojo-props=\"label: '${buttonCancel}', 'class': 'cancelButton'\"\n\t\t\tdata-dojo-attach-point=\"cancelButton\" data-dojo-attach-event=\"onClick:cancel\"></button\n\t></span\n></span>\n"}});define("dijit/InlineEditBox",["require","dojo/_base/array","dojo/_base/declare","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/_base/event","dojo/i18n","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/sniff","dojo/when","./focus","./_Widget","./_TemplatedMixin","./_WidgetsInTemplateMixin","./_Container","./form/Button","./form/_TextBoxMixin","./form/TextBox","dojo/text!./templates/InlineEditBox.html","dojo/i18n!./nls/common"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,fm,_f,_10,_11,_12,_13,_14,_15,_16){var _17=_3("dijit._InlineEditor",[_f,_10,_11],{templateString:_16,postMixInProperties:function(){this.inherited(arguments);this.messages=_9.getLocalization("dijit","common",this.lang);_2.forEach(["buttonSave","buttonCancel"],function(_18){if(!this[_18]){this[_18]=this.messages[_18];}},this);},buildRendering:function(){this.inherited(arguments);var Cls=typeof this.editor=="string"?(_c.getObject(this.editor)||_1(this.editor)):this.editor;var _19=this.sourceStyle,_1a="line-height:"+_19.lineHeight+";",_1b=_7.getComputedStyle(this.domNode);_2.forEach(["Weight","Family","Size","Style"],function(_1c){var _1d=_19["font"+_1c],_1e=_1b["font"+_1c];if(_1e!=_1d){_1a+="font-"+_1c+":"+_19["font"+_1c]+";";}},this);_2.forEach(["marginTop","marginBottom","marginLeft","marginRight","position","left","top","right","bottom","float","clear","display"],function(_1f){this.domNode.style[_1f]=_19[_1f];},this);var _20=this.inlineEditBox.width;if(_20=="100%"){_1a+="width:100%;";this.domNode.style.display="block";}else{_1a+="width:"+(_20+(Number(_20)==_20?"px":""))+";";}var _21=_c.delegate(this.inlineEditBox.editorParams,{style:_1a,dir:this.dir,lang:this.lang,textDir:this.textDir});_21["displayedValue" in Cls.prototype?"displayedValue":"value"]=this.value;this.editWidget=new Cls(_21,this.editorPlaceholder);if(this.inlineEditBox.autoSave){_6.destroy(this.buttonContainer);}},postCreate:function(){this.inherited(arguments);var ew=this.editWidget;if(this.inlineEditBox.autoSave){this.connect(ew,"onChange","_onChange");this.connect(ew,"onKeyPress","_onKeyPress");}else{if("intermediateChanges" in ew){ew.set("intermediateChanges",true);this.connect(ew,"onChange","_onIntermediateChange");this.saveButton.set("disabled",true);}}},startup:function(){this.editWidget.startup();this.inherited(arguments);},_onIntermediateChange:function(){this.saveButton.set("disabled",(this.getValue()==this._resetValue)||!this.enableSave());},destroy:function(){this.editWidget.destroy(true);this.inherited(arguments);},getValue:function(){var ew=this.editWidget;return String(ew.get("displayedValue" in ew?"displayedValue":"value"));},_onKeyPress:function(e){if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing){if(e.altKey||e.ctrlKey){return;}if(e.charOrCode==_b.ESCAPE){_8.stop(e);this.cancel(true);}else{if(e.charOrCode==_b.ENTER&&e.target.tagName=="INPUT"){_8.stop(e);this._onChange();}}}},_onBlur:function(){this.inherited(arguments);if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing){if(this.getValue()==this._resetValue){this.cancel(false);}else{if(this.enableSave()){this.save(false);}}}},_onChange:function(){if(this.inlineEditBox.autoSave&&this.inlineEditBox.editing&&this.enableSave()){fm.focus(this.inlineEditBox.displayNode);}},enableSave:fun