📄 form-debug.js
字号:
// private formatDate : function(date){ return Ext.isDate(date) ? date.dateFormat(this.format) : date; }, // private menuListeners : { select: function(m, d){ this.setValue(d); this.fireEvent('select', this, d); }, show : function(){ // retain focus styling this.onFocus(); }, hide : function(){ this.focus.defer(10, this); var ml = this.menuListeners; this.menu.un("select", ml.select, this); this.menu.un("show", ml.show, this); this.menu.un("hide", ml.hide, this); } }, // private // Implements the default empty TriggerField.onTriggerClick function to display the DatePicker onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.DateMenu(); } Ext.apply(this.menu.picker, { minDate : this.minValue, maxDate : this.maxValue, disabledDatesRE : this.disabledDatesRE, disabledDatesText : this.disabledDatesText, disabledDays : this.disabledDays, disabledDaysText : this.disabledDaysText, format : this.format, showToday : this.showToday, minText : String.format(this.minText, this.formatDate(this.minValue)), maxText : String.format(this.maxText, this.formatDate(this.maxValue)) }); this.menu.on(Ext.apply({}, this.menuListeners, { scope:this })); this.menu.picker.setValue(this.getValue() || new Date()); this.menu.show(this.el, "tl-bl?"); }, // private beforeBlur : function(){ var v = this.parseDate(this.getRawValue()); if(v){ this.setValue(v); } } });Ext.reg('datefield', Ext.form.DateField);Ext.form.Checkbox = Ext.extend(Ext.form.Field, { checkedCls: 'x-form-check-checked', focusCls: 'x-form-check-focus', overCls: 'x-form-check-over', mouseDownCls: 'x-form-check-down', tabIndex: 0, checked: false, defaultAutoCreate: {tag: 'input', type: 'checkbox', autocomplete: 'off'}, // private actionMode: 'wrap', // private baseCls: 'x-form-check', // private initComponent : function(){ Ext.form.Checkbox.superclass.initComponent.call(this); this.addEvents( 'check' ); }, // private initEvents : function(){ Ext.form.Checkbox.superclass.initEvents.call(this); this.initCheckEvents(); }, // private initCheckEvents : function(){ this.innerWrap.removeAllListeners(); this.innerWrap.addClassOnOver(this.overCls); this.innerWrap.addClassOnClick(this.mouseDownCls); this.innerWrap.on('click', this.onClick, this); this.innerWrap.on('keyup', this.onKeyUp, this); }, // private onRender : function(ct, position){ Ext.form.Checkbox.superclass.onRender.call(this, ct, position); if(this.inputValue !== undefined){ this.el.dom.value = this.inputValue; } this.el.addClass('x-hidden'); this.innerWrap = this.el.wrap({ tabIndex: this.tabIndex, cls: this.baseCls+'-wrap-inner' }); this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'}); if(this.boxLabel){ this.labelEl = this.innerWrap.createChild({ tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel }); } this.imageEl = this.innerWrap.createChild({ tag: 'img', src: Ext.BLANK_IMAGE_URL, cls: this.baseCls }, this.el); if(this.checked){ this.setValue(true); }else{ this.checked = this.el.dom.checked; } this.originalValue = this.checked; }, // private afterRender : function(){ Ext.form.Checkbox.superclass.afterRender.call(this); this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls); }, // private onDestroy : function(){ if(this.rendered){ Ext.destroy(this.imageEl, this.labelEl, this.innerWrap, this.wrap); } Ext.form.Checkbox.superclass.onDestroy.call(this); }, // private onFocus: function(e) { Ext.form.Checkbox.superclass.onFocus.call(this, e); this.el.addClass(this.focusCls); }, // private onBlur: function(e) { Ext.form.Checkbox.superclass.onBlur.call(this, e); this.el.removeClass(this.focusCls); }, // private onResize : function(){ Ext.form.Checkbox.superclass.onResize.apply(this, arguments); if(!this.boxLabel && !this.fieldLabel){ this.el.alignTo(this.wrap, 'c-c'); } }, // private onKeyUp : function(e){ if(e.getKey() == Ext.EventObject.SPACE){ this.onClick(e); } }, // private onClick : function(e){ if (!this.disabled && !this.readOnly) { this.toggleValue(); } e.stopEvent(); }, // private onEnable : function(){ Ext.form.Checkbox.superclass.onEnable.call(this); this.initCheckEvents(); }, // private onDisable : function(){ Ext.form.Checkbox.superclass.onDisable.call(this); this.innerWrap.removeAllListeners(); }, toggleValue : function(){ this.setValue(!this.checked); }, // private getResizeEl : function(){ if(!this.resizeEl){ this.resizeEl = Ext.isWebKit ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap); } return this.resizeEl; }, // private getPositionEl : function(){ return this.wrap; }, markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn, // private initValue: function(){ this.originalValue = this.getValue(); }, getValue : function(){ if(this.rendered){ return this.el.dom.checked; } return this.checked; }, setValue : function(v) { var checked = this.checked; this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on'); if(this.rendered){ this.el.dom.checked = this.checked; this.el.dom.defaultChecked = this.checked; this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls); } if(checked != this.checked){ this.fireEvent("check", this, this.checked); if(this.handler){ this.handler.call(this.scope || this, this, this.checked); } } } });Ext.reg('checkbox', Ext.form.Checkbox);Ext.form.Radio = Ext.extend(Ext.form.Checkbox, { // private inputType: 'radio', // private baseCls: 'x-form-radio', getGroupValue : function(){ var c = this.getParent().child('input[name='+this.el.dom.name+']:checked', true); return c ? c.value : null; }, // private getParent : function(){ return this.el.up('form') || Ext.getBody(); }, // private toggleValue : function() { if(!this.checked){ var els = this.getParent().select('input[name='+this.el.dom.name+']'); els.each(function(el){ if(el.dom.id == this.id){ this.setValue(true); }else{ Ext.getCmp(el.dom.id).setValue(false); } }, this); } }, setValue : function(v){ if(typeof v=='boolean') { Ext.form.Radio.superclass.setValue.call(this, v); }else{ var r = this.getParent().child('input[name='+this.el.dom.name+'][value='+v+']', true); if(r && !r.checked){ Ext.getCmp(r.id).toggleValue(); }; } }, markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn });Ext.reg('radio', Ext.form.Radio);Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, { // private defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"}, listClass: '', selectedClass: 'x-combo-selected', triggerClass : 'x-form-arrow-trigger', shadow:'sides', listAlign: 'tl-bl?', maxHeight: 300, minHeight: 90, triggerAction: 'query', minChars : 4, typeAhead: false, queryDelay: 500, pageSize: 0, selectOnFocus:false, queryParam: 'query', loadingText: 'Loading...', resizable: false, handleHeight : 8, editable: true, allQuery: '', mode: 'remote', minListWidth : 70, forceSelection:false, typeAheadDelay : 250, lazyInit : true, // private initComponent : function(){ Ext.form.ComboBox.superclass.initComponent.call(this); this.addEvents( 'expand', 'collapse', 'beforeselect', 'select', 'beforequery' ); if(this.transform){ this.allowDomMove = false; var s = Ext.getDom(this.transform); if(!this.hiddenName){ this.hiddenName = s.name; } if(!this.store){ this.mode = 'local'; var d = [], opts = s.options; for(var i = 0, len = opts.length;i < len; i++){ var o = opts[i], value = (o.hasAttribute ? o.hasAttribute('value') : o.getAttributeNode('value').specified) ? o.value : o.text; if(o.selected) { this.value = value; } d.push([value, o.text]); } this.store = new Ext.data.SimpleStore({ 'id': 0, fields: ['value', 'text'], data : d }); this.valueField = 'value'; this.displayField = 'text'; } s.name = Ext.id(); // wipe out the name in case somewhere else they have a reference if(!this.lazyRender){ this.target = true; this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate); Ext.removeNode(s); // remove it this.render(this.el.parentNode); }else{ Ext.removeNode(s); // remove it } } //auto-configure store from local array data else if(Ext.isArray(this.store)){ if (Ext.isArray(this.store[0])){ this.store = new Ext.data.SimpleStore({ fields: ['value','text'], data: this.store }); this.valueField = 'value'; }else{ this.store = new Ext.data.SimpleStore({ fields: ['text'], data: this.store, expandData: true }); this.valueField = 'text'; } this.displayField = 'text'; this.mode = 'local'; } this.selectedIndex = -1; if(this.mode == 'local'){ if(this.initialConfig.queryDelay === undefined){ this.queryDelay = 10;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -