Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/phuix/PHUIXFormControl.js
Show All 9 Lines | members: { | ||||
_node: null, | _node: null, | ||||
_labelNode: null, | _labelNode: null, | ||||
_errorNode: null, | _errorNode: null, | ||||
_inputNode: null, | _inputNode: null, | ||||
_className: null, | _className: null, | ||||
_valueSetCallback: null, | _valueSetCallback: null, | ||||
_valueGetCallback: null, | _valueGetCallback: null, | ||||
_rawInputNode: null, | _rawInputNode: null, | ||||
_tokenizer: null, | |||||
setLabel: function(label) { | setLabel: function(label) { | ||||
JX.DOM.setContent(this._getLabelNode(), label); | JX.DOM.setContent(this._getLabelNode(), label); | ||||
return this; | return this; | ||||
}, | }, | ||||
setError: function(error) { | setError: function(error) { | ||||
JX.DOM.setContent(this._getErrorNode(), error); | JX.DOM.setContent(this._getErrorNode(), error); | ||||
Show All 39 Lines | setControl: function(type, spec) { | ||||
JX.$E('Bad Input Type'); | JX.$E('Bad Input Type'); | ||||
return; | return; | ||||
} | } | ||||
JX.DOM.setContent(node, input.node); | JX.DOM.setContent(node, input.node); | ||||
this._valueGetCallback = input.get; | this._valueGetCallback = input.get; | ||||
this._valueSetCallback = input.set; | this._valueSetCallback = input.set; | ||||
this._rawInputNode = input.node; | this._rawInputNode = input.node; | ||||
this._tokenizer = input.tokenizer || null; | |||||
return this; | return this; | ||||
}, | }, | ||||
setValue: function(value) { | setValue: function(value) { | ||||
this._valueSetCallback(value); | this._valueSetCallback(value); | ||||
return this; | return this; | ||||
}, | }, | ||||
getValue: function() { | getValue: function() { | ||||
return this._valueGetCallback(); | return this._valueGetCallback(); | ||||
}, | }, | ||||
getRawInputNode: function() { | getRawInputNode: function() { | ||||
return this._rawInputNode; | return this._rawInputNode; | ||||
}, | }, | ||||
getTokenizer: function() { | |||||
return this._tokenizer; | |||||
}, | |||||
getNode: function() { | getNode: function() { | ||||
if (!this._node) { | if (!this._node) { | ||||
var attrs = { | var attrs = { | ||||
className: 'aphront-form-control ' + this._className + ' grouped' | className: 'aphront-form-control ' + this._className + ' grouped' | ||||
}; | }; | ||||
var content = [ | var content = [ | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | _newTokenizer: function(spec) { | ||||
} | } | ||||
} | } | ||||
set_value(spec.value || {}); | set_value(spec.value || {}); | ||||
return { | return { | ||||
node: build.node, | node: build.node, | ||||
get: get_value, | get: get_value, | ||||
set: set_value | set: set_value, | ||||
tokenizer: build.tokenizer | |||||
}; | }; | ||||
}, | }, | ||||
_newSelect: function(spec) { | _newSelect: function(spec) { | ||||
var node = JX.Prefab.renderSelect( | var node = JX.Prefab.renderSelect( | ||||
spec.options, | spec.options, | ||||
spec.value, | spec.value, | ||||
{}, | {}, | ||||
▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines |