coffeescript-ui
Version:
Coffeescript User Interface System
97 lines (85 loc) • 2.05 kB
text/coffeescript
###
* coffeescript-ui - Coffeescript User Interface System (CUI)
* Copyright (c) 2013 - 2016 Programmfabrik GmbH
* MIT Licence
* https://github.com/programmfabrik/coffeescript-ui, http://www.coffeescript-ui.org
###
class CUI.Output extends CUI.DataFieldInput
initOpts: ->
super()
placeholder:
default: ""
check: String
text:
check: String
# set to yes for placeholder and text and value
markdown:
mandatory: true
default: false
check: Boolean
getValue:
check: Function
multiline:
check: Boolean
default: true
mandatory: true
allow_delete:
mandatory: true
default: false
check: Boolean
readOpts: ->
super()
for k in ["undo_support", "check_changed", "mark_changed"]
@["_"+k] = false
@
init: ->
= new CUI.Label(markdown: , multiline: , class: "cui-data-field-output-label" ) #"cui-data-field-output-label"
# WHY is that here, same in DataField...
# disable: ->
#
# enable: ->
#
setText: (txt) ->
if CUI.util.isEmpty(txt)
.addClass("cui-output-empty")
txt =
else
.removeClass("cui-output-empty")
.setText(txt, or false)
checkValue: ->
# CUI.Output does not care about values
displayValue: ->
super()
if
ret =
if not CUI.util.isEmpty(ret)
?.show()
else
?.hide()
if CUI.util.isContent(ret)
else
@
getValue: ->
value = super()
if
.call(@, value, )
else
value
render: ->
super()
if and
= new CUI.Button
icon: "remove"
appearance: "flat"
onClick: =>
@