neft
Version:
Universal Platform
49 lines (37 loc) • 1.3 kB
text/coffeescript
module.exports = (File, Input) -> class InputText extends Input
= 'InputText'
= 'File.Input.Text'
JSON_CTOR_ID = = File.JSON_CTORS.push(InputText) - 1
{JSON_NODE, JSON_TEXT, JSON_BINDING} = Input
JSON_ARGS_LENGTH = Input.JSON_ARGS_LENGTH
= (file, arr, obj) ->
unless obj
node = file.node.getChildByAccessPath arr[JSON_NODE]
obj = new InputText file, node, arr[JSON_TEXT], arr[JSON_BINDING]
obj
constructor: (file, node, text, bindingConfig) ->
Input.call @, file, node, text, bindingConfig
if file.isClone
()
`//<development>`
if is InputText
Object.seal @
`//</development>`
getValue: ->
.text
setValue: (val) ->
unless val?
val = ''
else if typeof val isnt 'string'
val += ''
.text = val
clone: (original, file) ->
node = original.node.getCopiedElement , file.node
new InputText file, node, ,
toJSON: (key, arr) ->
unless arr
arr = new Array JSON_ARGS_LENGTH
arr[0] = JSON_CTOR_ID
super key, arr
arr