Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/phuix/PHUIXFormControl.js
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | setControl: function(type, spec) { | ||||
| input = this._newSelect(spec); | input = this._newSelect(spec); | ||||
| break; | break; | ||||
| case 'points': | case 'points': | ||||
| input = this._newPoints(spec); | input = this._newPoints(spec); | ||||
| break; | break; | ||||
| case 'optgroups': | case 'optgroups': | ||||
| input = this._newOptgroups(spec); | input = this._newOptgroups(spec); | ||||
| break; | break; | ||||
| case 'static': | |||||
| input = this._newStatic(spec); | |||||
| break; | |||||
| default: | default: | ||||
| // TODO: Default or better error? | // TODO: Default or better error? | ||||
| 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; | ||||
| ▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | _newSelect: function(spec) { | ||||
| return node.value; | return node.value; | ||||
| }, | }, | ||||
| set: function(value) { | set: function(value) { | ||||
| node.value = value; | node.value = value; | ||||
| } | } | ||||
| }; | }; | ||||
| }, | }, | ||||
| _newStatic: function(spec) { | |||||
| var node = JX.$N( | |||||
| 'div', | |||||
| { | |||||
| className: 'phui-form-static-action' | |||||
| }, | |||||
| spec.description || ''); | |||||
| return { | |||||
| node: node, | |||||
| get: function() { | |||||
| return true; | |||||
| }, | |||||
| set: function() { | |||||
| return; | |||||
| } | |||||
| }; | |||||
| }, | |||||
| _newPoints: function(spec) { | _newPoints: function(spec) { | ||||
| var attrs = { | var attrs = { | ||||
| type: 'text', | type: 'text', | ||||
| value: spec.value | value: spec.value | ||||
| }; | }; | ||||
| var node = JX.$N('input', attrs); | var node = JX.$N('input', attrs); | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||