📄 textitem.js
字号:
else template[template.length] = " spellcheck=false" } // If we get an oninput event for this browser, write it out into our element's HTML if (this._willHandleInput) { template[template.length] = " ONINPUT='" template[template.length] = this.getID() template[template.length] = "._handleInput()'" } if (this.isDisabled()) template[template.length] = this._$disabled; // Write out 'readOnly' setting if present if (this.readOnly) template[template.length] = " READONLY=TRUE" // disable native autoComplete if (this._getAutoCompleteSetting() != this._$native) { template[template.length] = this._$autoCompleteOff; } template[template.length] = this.getElementStyleHTML(); var tabIndex = this._getElementTabIndex(); if (tabIndex != null) { var end = template.length; template[end] = this._$tabIndexEquals; isc._fillNumber(template, tabIndex, end+1, 5); } // Note: if we're showing a title for the element, we don't need to set // up an accessKey here, since the label tag takes care of that if (this.showTitle == false && this.accessKey != null) { template[template.length] = this._$accessKeyEquals; template[template.length] = this.accessKey; } template[template.length] = this._$rightAngle; var result = template.join(isc.emptyString); // Trim the entries off the end of the template so we can reuse it. template.length = 8; return result; }, _sizeTextBoxAsContentBox : function () { return isc.Browser.isStrict; }, // override _nativeElementBlur() to fire blur and change handlers in response to a native // blur // // Natively onblur is fired when focus is taken from the text item, but onchange will // only fire if the value on leaving the text item is different from what it was when // the user put focus into the text item. // // Since we do internal values handling, having the same element value when focus is // taken from a form item as when focus first went to a form item is not a guarantee // that our stored value for the form item has not changed, and vice versa - // typically we are saving values in response to key events due to 'changeOnKeypress'. // // Therefore instead of relying on the native change handler, on blur we will always fire // our change handler if changeOnBlur is true, and otherwise compare our stored value to // the current element value, and fire the change handler if they do not match. _nativeElementBlur : function (element, itemID) { var returnVal = this.Super("_nativeElementBlur", arguments); if (this.changeOnBlur) this.form.elementChanged(this); else { var elementValue = this.getElementValue(); // unmap the value if necessary if (this.mapDisplayToValue) { elementValue = this.mapDisplayToValue(elementValue); } if (this._value != elementValue) this.form.elementChanged(this); } return returnVal; }, //> @method textItem.getElementStyleHTML() (I) // Get the HTML string used to set the visual characteristics for a text item. // This includes the STYLE=... & CLASS=... properties to be written into this // form item's element. // This varies by platform, as we attempt to make Netscape think in pixels rather than // characters and rows // // @group appearance // @return (string) String of HTML containing STYLE=... & CLASS=... properties for // this items element. // //< _$styleTemplate:[ " CLASS='", // [0] , // [1] this.getTextBoxStyle(), "' STYLE='", // [2] , // [3] null or 'width:' ,,,, // [4-7] null or width , // [8] null or 'px;' , // [9] null or 'height:' ,,,, // [10-13] null or height , // [14] null or 'px;' // text align property, known to be supported in IE6 and Moz/Firefox on // Windows, not supported on Safari 1.2 , // [15] null or 'text-align' , // [16] null or this.textAlign , // [17] null or ";" // In Mozilla we must use the '-moz-user-focus' css property to govern // whether this element can recieve focus or not. // (slots 18 and 19) (isc.Browser.isMoz ? "-moz-user-focus:" : isc.Browser.isIE ? "margin-top:-1px;margin-bottom:-1px;" : null), // [18] , // [19] Moz: 'normal' or 'ignore' - otherwise null "' " // [20] ], _$widthColon:"WIDTH:", _$pxSemi:"px;", _$heightColon:"HEIGHT:", _$textAlignColon:"text-align:", _$semi:";", _$normal:"normal;", _$ignore:"ignore;", getElementStyleHTML : function () { var template = this._$styleTemplate, width = this.getTextBoxWidth(), height = this.getTextBoxHeight(), style = this.getTextBoxStyle(); template[1] = style; if (isc.isA.Number(width)) { template[3] = this._$widthColon; isc._fillNumber(template, width, 4, 4); template[8] = this._$pxSemi; } else { template[3] = template[4] = template[5] = template[6] = template[7] = template[8] = null; } if (isc.isA.Number(height)) { template[9] = this._$heightColon; isc._fillNumber(template, height, 10, 4); template[14] = this._$pxSemi; } else { template[9] = template[10] = template[11] = template[12] = template[13] = template[14] = null; } if (this.textAlign) { template[15] = this._$textAlignColon; template[16] = this.textAlign; template[17] = this._$semi; } else { template[15] = template[16] = template[17] = null; } if (isc.Browser.isMoz) { template[19] = (this._getElementTabIndex() > 0 ? this._$normal : this._$ignore); } return template.join(isc.emptyString); }, //> @method textItem.mapValueToDisplay() (A) // @group drawing // Map from the internal value for this item to the display value. // @param internalValue (string) Internal value for this item. // @return (string) Displayed value corresponding to internal value. //< mapValueToDisplay : function (internalValue) { var value = isc.FormItem._instancePrototype.mapValueToDisplay.call(this, internalValue); // always display the empty string for null values, rather than "null" or "undefined" if (value == null) return isc.emptyString; return value; }, //> @method textItem.mapDisplayToValue() (A) // @group drawing // Map from a the display value for this item to the internal value. // // @param displayValue (string) Value displayed to the user. // @return (string) Internal value corresponding to that display value. //< mapDisplayToValue : function (displayValue) { var value = this._unmapKey(displayValue); // if the value to be saved is an empty string, map it to 'null' if necessary if (isc.is.emptyString(value)) value = this._emptyStringValue; return value; }, // override 'setValue'. // If passed null or the empty string, we store this as the 'empty string value' - this will // then be returned whenever the user clears out the text item element. setValue : function (value,b,c,d) { var undef; if (value !== undef && (value == null || isc.is.emptyString(value))) this._emptyStringValue = value; return this.invokeSuper(isc.TextItem, "setValue", value,b,c,d); }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -