📄 ssfx.ui.forms.debug.js
字号:
this._itemCache$1[cacheKey] = items;
}
if (!this._dropDown$1) {
this._createDropDown$1();
}
this._dropDown$1.innerHTML = '';
this._selectedItemIndex$1 = -1;
if (itemCount) {
for (var i = 0; i < itemCount; i++) {
var itemElement = document.createElement('DIV');
if (this._options$1.itemCSSClass) {
itemElement.className = this._options$1.itemCSSClass;
}
var item = items[i];
var text = item;
var displayHandler = this.get_events().getHandler('itemDisplay');
if (displayHandler) {
var e = new ScriptFX.UI.AutoCompleteItemEventArgs(item, i);
displayHandler.invoke(this, e);
text = e.get_text();
if (!text) {
text = item;
}
}
itemElement.innerHTML = text;
itemElement.__index = i;
itemElement.__item = items[i];
this._dropDown$1.appendChild(itemElement);
}
this._showDropDown$1();
}
else {
this._hideDropDown$1();
}
},
_updateTextBox$1: function ScriptFX_UI_AutoCompleteBehavior$_updateTextBox$1(item, index) {
this._stopTimer$1();
this._hideDropDown$1();
var text = null;
var selectedHandler = this.get_events().getHandler('itemSelected');
if (selectedHandler) {
var e = new ScriptFX.UI.AutoCompleteItemEventArgs(item, index);
selectedHandler.invoke(this, e);
text = e.get_text();
}
if (!text) {
text = item;
}
this._currentPrefix$1 = text;
(this.get_domElement()).value = text;
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.AutoCompleteItemEventArgs
ScriptFX.UI.AutoCompleteItemEventArgs = function ScriptFX_UI_AutoCompleteItemEventArgs(item, index) {
ScriptFX.UI.AutoCompleteItemEventArgs.constructBase(this);
this._item$1 = item;
this._index$1 = index;
}
ScriptFX.UI.AutoCompleteItemEventArgs.prototype = {
_item$1: null,
_index$1: 0,
_text$1: null,
get_index: function ScriptFX_UI_AutoCompleteItemEventArgs$get_index() {
return this._index$1;
},
get_item: function ScriptFX_UI_AutoCompleteItemEventArgs$get_item() {
return this._item$1;
},
get_text: function ScriptFX_UI_AutoCompleteItemEventArgs$get_text() {
return this._text$1;
},
set_text: function ScriptFX_UI_AutoCompleteItemEventArgs$set_text(value) {
this._text$1 = value;
return value;
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.AutoCompleteRequestEventArgs
ScriptFX.UI.AutoCompleteRequestEventArgs = function ScriptFX_UI_AutoCompleteRequestEventArgs(prefixText) {
ScriptFX.UI.AutoCompleteRequestEventArgs.constructBase(this);
this._prefixText$1 = prefixText;
}
ScriptFX.UI.AutoCompleteRequestEventArgs.prototype = {
_prefixText$1: null,
_items$1: null,
get__items: function ScriptFX_UI_AutoCompleteRequestEventArgs$get__items() {
return this._items$1;
},
get_prefixText: function ScriptFX_UI_AutoCompleteRequestEventArgs$get_prefixText() {
return this._prefixText$1;
},
setItems: function ScriptFX_UI_AutoCompleteRequestEventArgs$setItems(items) {
this._items$1 = items;
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.Button
ScriptFX.UI.Button = function ScriptFX_UI_Button(domElement) {
ScriptFX.UI.Button.constructBase(this, [ domElement ]);
this.get_domEvents().attach('onclick', Delegate.create(this, this._onClick$2));
}
ScriptFX.UI.Button.prototype = {
_actionArgument$2: null,
_actionName$2: null,
get_actionArgument: function ScriptFX_UI_Button$get_actionArgument() {
return this._actionArgument$2;
},
set_actionArgument: function ScriptFX_UI_Button$set_actionArgument(value) {
this._actionArgument$2 = value;
return value;
},
get_actionName: function ScriptFX_UI_Button$get_actionName() {
return this._actionName$2;
},
set_actionName: function ScriptFX_UI_Button$set_actionName(value) {
this._actionName$2 = value;
return value;
},
add_action: function ScriptFX_UI_Button$add_action(value) {
this.get_events().addHandler(ScriptFX.UI.Button._clickEventKey$2, value);
},
remove_action: function ScriptFX_UI_Button$remove_action(value) {
this.get_events().removeHandler(ScriptFX.UI.Button._clickEventKey$2, value);
},
add_click: function ScriptFX_UI_Button$add_click(value) {
this.get_events().addHandler(ScriptFX.UI.Button._clickEventKey$2, value);
},
remove_click: function ScriptFX_UI_Button$remove_click(value) {
this.get_events().removeHandler(ScriptFX.UI.Button._clickEventKey$2, value);
},
_onClick$2: function ScriptFX_UI_Button$_onClick$2() {
var clickHandler = this.get_events().getHandler(ScriptFX.UI.Button._clickEventKey$2);
if (clickHandler) {
clickHandler.invoke(this, EventArgs.Empty);
}
},
performClick: function ScriptFX_UI_Button$performClick() {
this._onClick$2();
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.CheckBox
ScriptFX.UI.CheckBox = function ScriptFX_UI_CheckBox(domElement) {
ScriptFX.UI.CheckBox.constructBase(this, [ domElement ]);
this.get_domEvents().attach('onclick', Delegate.create(this, this._onClick$2));
}
ScriptFX.UI.CheckBox.prototype = {
get_checked: function ScriptFX_UI_CheckBox$get_checked() {
return (this.get_domElement()).checked;
},
set_checked: function ScriptFX_UI_CheckBox$set_checked(value) {
(this.get_domElement()).checked = value;
return value;
},
add_checkedChanged: function ScriptFX_UI_CheckBox$add_checkedChanged(value) {
this.get_events().addHandler(ScriptFX.UI.CheckBox._checkChangedEventKey$2, value);
},
remove_checkedChanged: function ScriptFX_UI_CheckBox$remove_checkedChanged(value) {
this.get_events().removeHandler(ScriptFX.UI.CheckBox._checkChangedEventKey$2, value);
},
_onClick$2: function ScriptFX_UI_CheckBox$_onClick$2() {
var checkChangedHandler = this.get_events().getHandler(ScriptFX.UI.CheckBox._checkChangedEventKey$2);
if (checkChangedHandler) {
checkChangedHandler.invoke(this, EventArgs.Empty);
}
this.raisePropertyChanged('Checked');
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.EnterKeyBehavior
ScriptFX.UI.EnterKeyBehavior = function ScriptFX_UI_EnterKeyBehavior(element, options) {
ScriptFX.UI.EnterKeyBehavior.constructBase(this, [ element, null ]);
this._clickTarget$1 = options.clickTarget;
this.get_domEvents().attach('onkeypress', Delegate.create(this, this._onElementKeyPress$1));
}
ScriptFX.UI.EnterKeyBehavior.prototype = {
_clickTarget$1: null,
_onElementKeyPress$1: function ScriptFX_UI_EnterKeyBehavior$_onElementKeyPress$1() {
if ((window.event.keyCode === ScriptFX.UI.Key.enter) && (!this._clickTarget$1.disabled)) {
window.event.cancelBubble = true;
window.event.returnValue = false;
this._clickTarget$1.click();
}
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.Label
ScriptFX.UI.Label = function ScriptFX_UI_Label(domElement) {
ScriptFX.UI.Label.constructBase(this, [ domElement ]);
}
ScriptFX.UI.Label.prototype = {
get_text: function ScriptFX_UI_Label$get_text() {
return this.get_domElement().innerText;
},
set_text: function ScriptFX_UI_Label$set_text(value) {
this.get_domElement().innerText = value;
return value;
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.TextBox
ScriptFX.UI.TextBox = function ScriptFX_UI_TextBox(domElement) {
ScriptFX.UI.TextBox.constructBase(this, [ domElement ]);
this.get_domEvents().attach('onchange', Delegate.create(this, this._onValueChanged$2));
}
ScriptFX.UI.TextBox.prototype = {
get_text: function ScriptFX_UI_TextBox$get_text() {
var watermark = ScriptFX.UI.Behavior.getBehavior(this.get_domElement(), ScriptFX.UI.WatermarkBehavior);
if ((watermark) && watermark.get_isWatermarked()) {
return String.Empty;
}
return (this.get_domElement()).value;
},
set_text: function ScriptFX_UI_TextBox$set_text(value) {
(this.get_domElement()).value = value;
this._onValueChanged$2();
return value;
},
add_textChanged: function ScriptFX_UI_TextBox$add_textChanged(value) {
this.get_events().addHandler(ScriptFX.UI.TextBox._textChangedEventKey$2, value);
},
remove_textChanged: function ScriptFX_UI_TextBox$remove_textChanged(value) {
this.get_events().removeHandler(ScriptFX.UI.TextBox._textChangedEventKey$2, value);
},
_onValueChanged$2: function ScriptFX_UI_TextBox$_onValueChanged$2() {
var textChangedHandler = this.get_events().getHandler(ScriptFX.UI.TextBox._textChangedEventKey$2);
if (textChangedHandler) {
textChangedHandler.invoke(this, EventArgs.Empty);
}
}
}
////////////////////////////////////////////////////////////////////////////////
// ScriptFX.UI.WatermarkBehavior
ScriptFX.UI.WatermarkBehavior = function ScriptFX_UI_WatermarkBehavior(element, options) {
ScriptFX.UI.WatermarkBehavior.constructBase(this, [ element, null ]);
this._options$1 = options;
this.get_domEvents().attach('onfocus', Delegate.create(this, this._onElementFocus$1));
this.get_domEvents().attach('onblur', Delegate.create(this, this._onElementBlur$1));
this.update();
}
ScriptFX.UI.WatermarkBehavior.prototype = {
_options$1: null,
_maxLength$1: 0,
get_isWatermarked: function ScriptFX_UI_WatermarkBehavior$get_isWatermarked() {
return ScriptFX.UI.Element.containsCSSClass(this.get_domElement(), this._options$1.watermarkCssClass);
},
_applyWatermark$1: function ScriptFX_UI_WatermarkBehavior$_applyWatermark$1() {
var element = this.get_domElement();
if (!element.value.length) {
this._maxLength$1 = element.maxLength;
element.maxLength = this._options$1.watermarkText.length;
ScriptFX.UI.Element.addCSSClass(element, this._options$1.watermarkCssClass);
element.value = this._options$1.watermarkText;
}
},
_clearWatermark$1: function ScriptFX_UI_WatermarkBehavior$_clearWatermark$1(focusing) {
var element = this.get_domElement();
if (ScriptFX.UI.Element.containsCSSClass(element, this._options$1.watermarkCssClass)) {
element.maxLength = this._maxLength$1;
ScriptFX.UI.Element.removeCSSClass(element, this._options$1.watermarkCssClass);
if (focusing) {
element.value = '';
}
}
},
dispose: function ScriptFX_UI_WatermarkBehavior$dispose() {
if (!this.get_isDisposed()) {
this._clearWatermark$1(false);
}
ScriptFX.UI.WatermarkBehavior.callBase(this, 'dispose');
},
_onElementFocus$1: function ScriptFX_UI_WatermarkBehavior$_onElementFocus$1() {
this._clearWatermark$1(true);
},
_onElementBlur$1: function ScriptFX_UI_WatermarkBehavior$_onElementBlur$1() {
this._applyWatermark$1();
},
update: function ScriptFX_UI_WatermarkBehavior$update() {
var element = this.get_domElement();
if (!element.value.length) {
this._applyWatermark$1();
}
else {
this._clearWatermark$1(false);
}
}
}
ScriptFX.UI.AutoCompleteBehavior.createClass('ScriptFX.UI.AutoCompleteBehavior', ScriptFX.UI.Behavior);
ScriptFX.UI.AutoCompleteItemEventArgs.createClass('ScriptFX.UI.AutoCompleteItemEventArgs', EventArgs);
ScriptFX.UI.AutoCompleteRequestEventArgs.createClass('ScriptFX.UI.AutoCompleteRequestEventArgs', EventArgs);
ScriptFX.UI.Button.createClass('ScriptFX.UI.Button', ScriptFX.UI.Control, ScriptFX.UI.IAction);
ScriptFX.UI.CheckBox.createClass('ScriptFX.UI.CheckBox', ScriptFX.UI.Control, ScriptFX.UI.IToggle);
ScriptFX.UI.EnterKeyBehavior.createClass('ScriptFX.UI.EnterKeyBehavior', ScriptFX.UI.Behavior);
ScriptFX.UI.Label.createClass('ScriptFX.UI.Label', ScriptFX.UI.Control, ScriptFX.UI.IStaticText);
ScriptFX.UI.TextBox.createClass('ScriptFX.UI.TextBox', ScriptFX.UI.Control, ScriptFX.UI.IEditableText);
ScriptFX.UI.WatermarkBehavior.createClass('ScriptFX.UI.WatermarkBehavior', ScriptFX.UI.Behavior);
ScriptFX.UI.Button._clickEventKey$2 = 'click';
ScriptFX.UI.CheckBox._checkChangedEventKey$2 = 'checkChanged';
ScriptFX.UI.TextBox._textChangedEventKey$2 = 'textChanged';
// ---- Do not remove this footer ----
// Generated using Script# v0.4.2.0 (http://projects.nikhilk.net)
// -----------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -