File tree 4 files changed +82
-0
lines changed 4 files changed +82
-0
lines changed Original file line number Diff line number Diff line change
1
+ ###
2
+ * coffeescript-ui - Coffeescript User Interface System (CUI)
3
+ * Copyright (c) 2013 - 2025 Programmfabrik GmbH
4
+ * MIT Licence
5
+ * https://github.com/programmfabrik/coffeescript-ui, http://www.coffeescript-ui.org
6
+ ###
7
+
8
+ class CUI.ColorInput extends CUI.Input
9
+
10
+ initOpts : ->
11
+ super ()
12
+
13
+ readOpts : ->
14
+ @opts .leftControlElement = new CUI.Button
15
+ onClick : (ev , btn ) =>
16
+ @__input .focus ()
17
+ super ()
18
+
19
+ onDataChanged : (ev , info ) ->
20
+ super (ev, info)
21
+ @ __toggleColor ()
22
+
23
+ initValue : ->
24
+ super ()
25
+ if not @__data [@_name ] or @__data [@_name ].length == 0
26
+ @_leftControlElement .hide (true )
27
+ else
28
+ @_leftControlElement .DOM .style .backgroundColor = @__data [@_name ]
29
+ @_leftControlElement .show (true )
30
+
31
+ __toggleColor : ->
32
+ if @__input .value .length > 0 and @ __checkInputInternal ()
33
+ # Set the background color of the @_leftControlElement to the value of the input
34
+ @_leftControlElement .DOM .style .backgroundColor = @__input .value
35
+ @_leftControlElement .show (true )
36
+ else
37
+ @_leftControlElement .hide (true )
Original file line number Diff line number Diff line change
1
+ ###
2
+ * coffeescript-ui - Coffeescript User Interface System (CUI)
3
+ * Copyright (c) 2013 - 2025 Programmfabrik GmbH
4
+ * MIT Licence
5
+ * https://github.com/programmfabrik/coffeescript-ui, http://www.coffeescript-ui.org
6
+ ###
7
+
8
+ class CUI.IconInput extends CUI.Input
9
+
10
+ initOpts : ->
11
+ super ()
12
+
13
+ readOpts : ->
14
+ @opts .leftControlElement = new CUI.Button
15
+ icon : " fa-star"
16
+ onClick : (ev , btn ) =>
17
+ @__input .focus ()
18
+ super ()
19
+
20
+ onDataChanged : (ev , info ) ->
21
+ super (ev, info)
22
+ @ __toggleIcon ()
23
+
24
+ initValue : ->
25
+ super ()
26
+ if not @__data [@_name ] or @__data [@_name ].length == 0
27
+ @_leftControlElement .hide (true )
28
+ else
29
+ @_leftControlElement .setIcon (@__data [@_name ])
30
+
31
+ __toggleIcon : ->
32
+ if @__input .value .length > 0
33
+ @_leftControlElement .setIcon (@__input .value )
34
+ @_leftControlElement .show (true )
35
+ else
36
+ @_leftControlElement .setIcon (" " )
37
+ @_leftControlElement .hide (true )
Original file line number Diff line number Diff line change @@ -153,6 +153,8 @@ class CUI.Input extends CUI.DataFieldInput
153
153
check : [" code" ]
154
154
controlElement :
155
155
check : (v ) -> v instanceof CUI .DOMElement
156
+ leftControlElement :
157
+ check : (v ) -> v instanceof CUI .DOMElement
156
158
157
159
readOpts : ->
158
160
@@ -951,6 +953,10 @@ class CUI.Input extends CUI.DataFieldInput
951
953
CUI .dom .addClass (@_controlElement , ' cui-input-control-element' )
952
954
@ append (@_controlElement , @ getTemplateKeyForRender ())
953
955
956
+ if @_leftControlElement
957
+ CUI .dom .addClass (@_leftControlElement , ' cui-input-control-element' )
958
+ @ prepend (@_leftControlElement , @ getTemplateKeyForRender ())
959
+
954
960
# @append(@getChangedMarker(), @getTemplateKeyForRender())
955
961
956
962
for k in [" empty" , " invalid" , " valid" ]
Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ require('./elements/Input/InputBlock.coffee')
100
100
require (' ./elements/Input/NumberInputBlock.coffee' )
101
101
require (' ./elements/Input/NumberInput.coffee' )
102
102
require (' ./elements/Input/EmailInput.coffee' )
103
+ require (' ./elements/Input/IconInput.coffee' )
104
+ require (' ./elements/Input/ColorInput.coffee' )
103
105
require (' ./elements/Input/CodeInput.coffee' )
104
106
require (' ./elements/DateTime/DateTime.coffee' )
105
107
require (' ./elements/DateTime/Timezone.coffee' )
You can’t perform that action at this time.
0 commit comments