form-debug.js

来自「php绿色服务器,让大家试用greenamp」· JavaScript 代码 · 共 2,414 行 · 第 1/5 页

JS
2,414
字号
                this.selectText(selStart, newValue.length);            }        }    },        onSelect : function(record, index){        if(this.fireEvent('beforeselect', this, record, index) !== false){            this.setValue(record.data[this.valueField || this.displayField]);            this.collapse();            this.fireEvent('select', this, record, index);        }    },        getValue : function(){        if(this.valueField){            return typeof this.value != 'undefined' ? this.value : '';        }else{            return Ext.form.ComboBox.superclass.getValue.call(this);        }    },        clearValue : function(){        if(this.hiddenField){            this.hiddenField.value = '';        }        this.setRawValue('');        this.lastSelectionText = '';    },        setValue : function(v){        var text = v;        if(this.valueField){            var r = this.findRecord(this.valueField, v);            if(r){                text = r.data[this.displayField];            }else if(this.valueNotFoundText){                text = this.valueNotFoundText;            }        }        this.lastSelectionText = text;        if(this.hiddenField){            this.hiddenField.value = v;        }        Ext.form.ComboBox.superclass.setValue.call(this, text);        this.value = v;    },        findRecord : function(prop, value){        var record;        if(this.store.getCount() > 0){            this.store.each(function(r){                if(r.data[prop] == value){                    record = r;                    return false;                }            });        }        return record;    },        onViewMove : function(e, t){        this.inKeyMode = false;    },        onViewOver : function(e, t){        if(this.inKeyMode){             return;        }        var item = this.view.findItemFromChild(t);        if(item){            var index = this.view.indexOf(item);            this.select(index, false);        }    },        onViewClick : function(doFocus){        var index = this.view.getSelectedIndexes()[0];        var r = this.store.getAt(index);        if(r){            this.onSelect(r, index);        }        if(doFocus !== false){            this.el.focus();        }    },        restrictHeight : function(){        this.innerList.dom.style.height = '';        var inner = this.innerList.dom;        var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);        this.innerList.setHeight(h < this.maxHeight ? 'auto' : this.maxHeight);        this.list.beginUpdate();        this.list.setHeight(this.innerList.getHeight()+this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight);        this.list.alignTo(this.el, this.listAlign);        this.list.endUpdate();    },        onEmptyResults : function(){        this.collapse();    },        isExpanded : function(){        return this.list.isVisible();    },        selectByValue : function(v, scrollIntoView){        if(v !== undefined && v !== null){            var r = this.findRecord(this.valueField || this.displayField, v);            if(r){                this.select(this.store.indexOf(r), scrollIntoView);                return true;            }        }        return false;    },        select : function(index, scrollIntoView){        this.selectedIndex = index;        this.view.select(index);        if(scrollIntoView !== false){            var el = this.view.getNode(index);            if(el){                this.innerList.scrollChildIntoView(el);            }        }    },        selectNext : function(){        var ct = this.store.getCount();        if(ct > 0){            if(this.selectedIndex == -1){                this.select(0);            }else if(this.selectedIndex < ct-1){                this.select(this.selectedIndex+1);            }        }    },        selectPrev : function(){        var ct = this.store.getCount();        if(ct > 0){            if(this.selectedIndex == -1){                this.select(0);            }else if(this.selectedIndex != 0){                this.select(this.selectedIndex-1);            }        }    },        onKeyUp : function(e){        if(this.editable !== false && !e.isSpecialKey()){            this.lastKey = e.getKey();            this.dqTask.delay(this.queryDelay);        }    },        validateBlur : function(){        return !this.list || !this.list.isVisible();       },        initQuery : function(){        this.doQuery(this.getRawValue());    },        doForce : function(){        if(this.el.dom.value.length > 0){            this.el.dom.value =                this.lastSelectionText === undefined ? '' : this.lastSelectionText;            this.applyEmptyText();        }    },        doQuery : function(q, forceAll){        if(q === undefined || q === null){            q = '';        }        var qe = {            query: q,            forceAll: forceAll,            combo: this,            cancel:false        };        if(this.fireEvent('beforequery', qe)===false || qe.cancel){            return false;        }        q = qe.query;        forceAll = qe.forceAll;        if(forceAll === true || (q.length >= this.minChars)){            if(this.lastQuery != q){                this.lastQuery = q;                if(this.mode == 'local'){                    this.selectedIndex = -1;                    if(forceAll){                        this.store.clearFilter();                    }else{                        this.store.filter(this.displayField, q);                    }                    this.onLoad();                }else{                    this.store.baseParams[this.queryParam] = q;                    this.store.load({                        params: this.getParams(q)                    });                    this.expand();                }            }else{                this.selectedIndex = -1;                this.onLoad();               }        }    },        getParams : function(q){        var p = {};                if(this.pageSize){            p.start = 0;            p.limit = this.pageSize;        }        return p;    },        collapse : function(){        if(!this.isExpanded()){            return;        }        this.list.hide();        Ext.get(document).un('mousedown', this.collapseIf, this);        this.fireEvent('collapse', this);    },        collapseIf : function(e){        if(!e.within(this.wrap) && !e.within(this.list)){            this.collapse();        }    },        expand : function(){        if(this.isExpanded() || !this.hasFocus){            return;        }        this.list.alignTo(this.el, this.listAlign);        this.list.show();        Ext.get(document).on('mousedown', this.collapseIf, this);        this.fireEvent('expand', this);    },            onTriggerClick : function(){        if(this.disabled){            return;        }        if(this.isExpanded()){            this.collapse();            this.el.focus();        }else{            this.hasFocus = true;            this.doQuery(this.triggerAction == 'all' ?                     this.doQuery(this.allQuery, true) : this.doQuery(this.getRawValue()));            this.el.focus();        }    }});Ext.Editor = function(field, config){    Ext.Editor.superclass.constructor.call(this, config);    this.field = field;    this.addEvents({                "beforestartedit" : true,                "startedit" : true,                "beforecomplete" : true,                "complete" : true,                "specialkey" : true    });};Ext.extend(Ext.Editor, Ext.Component, {                    value : "",        alignment: "c-c?",        shadow : "frame",        updateEl : false,        onRender : function(ct, position){        this.el = new Ext.Layer({            shadow: this.shadow,            cls: "x-editor",            parentEl : ct,            shim : this.shim,            shadowOffset:3,            id: this.id        });        this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");        this.field.render(this.el);        if(Ext.isGecko){            this.field.el.dom.setAttribute('autocomplete', 'off');        }        this.field.show();        this.field.on("blur", this.onBlur, this);        this.relayEvents(this.field,  ["specialkey"]);        if(this.field.grow){            this.field.on("autosize", this.el.sync,  this.el, {delay:1});        }    },        startEdit : function(el, value){        if(this.editing){            this.completeEdit();        }        this.boundEl = Ext.get(el);        var v = value !== undefined ? value : this.boundEl.dom.innerHTML;        if(!this.rendered){            this.render(this.parentEl || document.body);        }        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){            return;        }        this.startValue = v;        this.field.setValue(v);        if(this.autoSize){            var sz = this.boundEl.getSize();            switch(this.autoSize){                case "width":                this.setSize(sz.width,  "");                break;                case "height":                this.setSize("",  sz.height);                break;                default:                this.setSize(sz.width,  sz.height);            }        }        this.el.alignTo(this.boundEl, this.alignment);        this.editing = true;        if(Ext.QuickTips){            Ext.QuickTips.disable();        }        this.show();    },        setSize : function(w, h){        this.field.setSize(w, h);        if(this.el){            this.el.sync();        }    },        realign : function(){        this.el.alignTo(this.boundEl, this.alignment);    },        completeEdit : function(remainVisible){        if(!this.editing){            return;        }        var v = this.getValue();        if(this.revertInvalid !== false && !this.field.isValid()){            v = this.startValue;            this.cancelEdit(true);        }        if(String(v) == String(this.startValue) && this.ignoreNoChange){            this.editing = false;            this.hide();            return;        }        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){            this.editing = false;            if(this.updateEl && this.boundEl){                this.boundEl.update(v);            }            if(remainVisible !== true){                this.hide();            }            this.fireEvent("complete", this, v, this.startValue);        }    },        onShow : function(){        this.el.show();        if(this.hideEl !== false){            this.boundEl.hide();        }        this.field.show();        this.field.focus();        this.fireEvent("startedit", this.boundEl, this.startValue);    },        cancelEdit : function(remainVisible){        if(this.editing){            this.setValue(this.startValue);            if(remainVisible !== true){                this.hide();            }        }    },        onBlur : function(){        if(this.allowBlur !== true && this.editing){            this.completeEdit();        }    },        onHide : function(){        if(this.editing){            this.completeEdit();            return;        }        this.field.blur();        if(this.field.collapse){            this.field.collapse();        }        this.el.hide();        if(this.hideEl !== false){            this.boundEl.show();        }        if(Ext.QuickTips){            Ext.QuickTips.enable();        }    },        setValue : function(v){        this.field.setValue(v);    },        getValue : function(){        return this.field.getValue();    }});Ext.form.BasicForm = function(el, config){    Ext.apply(this, config);        this.items = new Ext.util.MixedCollection(false, function(o){        return o.id || (o.id = Ext.id());    });    this.addEvents({                beforeaction: true,                actionfailed : true,                actioncomplete : true    });    if(el){        this.initEl(el);    }    Ext.form.BasicForm.superclass.constructor.call(this);};Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {                                timeout: 30,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?