Skip to content

Commit 6fc0903

Browse files
committed
Finish documentation of UIDL widgets.
1 parent 2d0d40a commit 6fc0903

2 files changed

Lines changed: 254 additions & 12 deletions

File tree

UIDL.md

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,246 @@ All attributes are optional but either `group` or `outputKey` and one of
127127
(optional, string type, minimum length: 1)
128128
* `cancelText`: text of the cancel button
129129
(optional, string type, minimum length: 1)
130+
131+
### Keyword: `item`
132+
* Keyword: `item`
133+
* Type: `entry`
134+
* Function: display a single line text entry of a form
135+
* Children: none
136+
###### Attributes:
137+
* `label`: label of the text entry
138+
(required, string type, minimum length: 1)
139+
* `disabled`: is the entry initially disabled?
140+
(optional, boolean type)
141+
* `hint`: hint text for the entry
142+
(optional, string type, minimum length: 1)
143+
* `placeHolder`: text initially shown in the entry area
144+
(optional, string type, minimum length: 1)
145+
* `minLen`: minimum length of a valid entry
146+
(optional, integer type, minimum value: 0)
147+
* `maxLen`: maximum length of a valid entry
148+
(optional, integer type, minimum value: 0)
149+
* `regexp`: regular expression that a valid entry has to match
150+
(optional, string type, minimum length: 1)
151+
* `failText`: text shown if the validation of entry text fails
152+
(optional, string type, minimum length: 1)
153+
* `outputKey`: key of the entry data for writing to output
154+
(optional, string type, valid identifier)
155+
156+
### Keyword: `item`
157+
* Keyword: `item`
158+
* Type: `multiLineEntry`
159+
* Function: display a multiple line text entry of a form
160+
* Children: none
161+
###### Attributes:
162+
* `label`: label of the text entry
163+
(required, string type, minimum length: 1)
164+
* `disabled`: is the entry initially disabled?
165+
(optional, boolean type)
166+
* `hint`: hint text for the entry
167+
(optional, string type, minimum length: 1)
168+
* `placeHolder`: text initially shown in the entry area
169+
(optional, string type, minimum length: 1)
170+
* `minLen`: minimum length of a valid entry
171+
(optional, integer type, minimum value: 0)
172+
* `maxLen`: maximum length of a valid entry
173+
(optional, integer type, minimum value: 0)
174+
* `regexp`: regular expression that a valid entry has to match
175+
(optional, string type, minimum length: 1)
176+
* `failText`: text shown if the validation of entry text fails
177+
(optional, string type, minimum length: 1)
178+
* `outputKey`: key of the entry data for writing to output
179+
(optional, string type, valid identifier)
180+
181+
### Keyword: `item`
182+
* Keyword: `item`
183+
* Type: `passwordEntry`
184+
* Function: display a text entry for passwords (hidden text) of a form
185+
* Children: none
186+
###### Attributes:
187+
* `label`: label of the text entry
188+
(required, string type, minimum length: 1)
189+
* `disabled`: is the entry initially disabled?
190+
(optional, boolean type)
191+
* `hint`: hint text for the entry
192+
(optional, string type, minimum length: 1)
193+
* `placeHolder`: text initially shown in the entry area
194+
(optional, string type, minimum length: 1)
195+
* `minLen`: minimum length of a valid entry
196+
(optional, integer type, minimum value: 0)
197+
* `maxLen`: maximum length of a valid entry
198+
(optional, integer type, minimum value: 0)
199+
* `regexp`: regular expression that a valid entry has to match
200+
(optional, string type, minimum length: 1)
201+
* `failText`: text shown if the validation of entry text fails
202+
(optional, string type, minimum length: 1)
203+
* `outputKey`: key of the entry data for writing to output
204+
(optional, string type, valid identifier)
205+
206+
### Keyword: `item`
207+
* Keyword: `item`
208+
* Type: `checkBox`
209+
* Function: display a checkbox of a form
210+
* Children: none
211+
###### Attributes:
212+
* `label`: label of the checkbox
213+
(required, string type, minimum length: 1)
214+
* `disabled`: is the checkbox initially disabled?
215+
(optional, boolean type)
216+
* `hint`: hint text for the checkbox
217+
(optional, string type, minimum length: 1)
218+
* `subLabel`: text displayed next to the checkbox itself
219+
(optional, string type, minimum length: 1)
220+
* `outputKey`: key of the entry data for writing to output
221+
(optional, string type, valid identifier)
222+
223+
### Keyword: `item`
224+
* Keyword: `item`
225+
* Type: `checkGroup`
226+
* Function: display a group of checkboxes of a form
227+
* Children: none
228+
###### Attributes:
229+
* `label`: label of the checkboxes
230+
(required, string type, minimum length: 1)
231+
* `disabled`: are the checkboxes initially disabled?
232+
(optional, boolean type)
233+
* `hint`: hint text for the checkboxes
234+
(optional, string type, minimum length: 1)
235+
* `options`: texts displayed next to the checkboxes
236+
(required, list of strings type, minimum length: 1)
237+
* `initiallySelected`: initially selected checkboxes
238+
(optional, list of strings type, minimum length: 0)
239+
* `outputKey`: key of the entry data for writing to output
240+
(optional, string type, valid identifier)
241+
242+
### Keyword: `item`
243+
* Keyword: `item`
244+
* Type: `radioGroup`
245+
* Function: display a group of radio buttons of a form
246+
* Children: none
247+
###### Attributes:
248+
* `label`: label of the radio button group
249+
(required, string type, minimum length: 1)
250+
* `disabled`: are the buttons initially disabled?
251+
(optional, boolean type)
252+
* `hint`: hint text for the radio buttons
253+
(optional, string type, minimum length: 1)
254+
* `options`: texts displayed next to the checkboxes
255+
(required, list of strings type, minimum length: 2)
256+
* `initiallySelected`: initially selected checkboxes
257+
(optional, list of strings type, minimum length: 1)
258+
* `horizontal`: are the buttons arranged horizontally?
259+
(optional, boolean type)
260+
* `required`: has one button to be selected?
261+
(optional, boolean type)
262+
* `outputKey`: key of the entry data for writing to output
263+
(optional, string type, valid identifier)
264+
265+
### Keyword: `item`, Type `select`
266+
* Keyword: `item`
267+
* Type: `select`
268+
* Function: display a select entry (a.k.a. drop-down list) of a form
269+
* Children: none
270+
###### Attributes:
271+
* `label`: label of the select entry
272+
(required, string type, minimum length: 1)
273+
* `disabled`: are the entry initially disabled?
274+
(optional, boolean type)
275+
* `hint`: hint text for the select entry
276+
(optional, string type, minimum length: 1)
277+
* `placeHolder`: text initially shown in the entry area
278+
(optional, string type, minimum length: 1)
279+
* `options`: texts displayed next to the checkboxes
280+
(required, list of strings type, minimum length: 2)
281+
* `initiallySelected`: initially selected checkboxes
282+
(optional, string type, minimum length: 1)
283+
* `outputKey`: key of the entry data for writing to output
284+
(optional, string type, valid identifier)
285+
286+
### Keyword: `item`, Type `selectEntry`
287+
* Keyword: `item`
288+
* Type: `selectEntry`
289+
* Function: display a mix of a select and a text entry of a form
290+
* Children: none
291+
###### Attributes:
292+
* `label`: label of the select entry
293+
(required, string type, minimum length: 1)
294+
* `disabled`: is the entry initially disabled?
295+
(optional, boolean type)
296+
* `hint`: hint text for the select entry
297+
(optional, string type, minimum length: 1)
298+
* `placeHolder`: text initially shown in the entry area
299+
(optional, string type, minimum length: 1)
300+
* `options`: texts displayed next to the checkboxes
301+
(required, list of strings type, minimum length: 0)
302+
* `minLen`: minimum length of a valid entry
303+
(optional, integer type, minimum value: 0)
304+
* `maxLen`: maximum length of a valid entry
305+
(optional, integer type, minimum value: 0)
306+
* `regexp`: regular expression that a valid entry has to match
307+
(optional, string type, minimum length: 1)
308+
* `failText`: text shown if the validation of entry text fails
309+
(optional, string type, minimum length: 1)
310+
* `outputKey`: key of the entry data for writing to output
311+
(optional, string type, valid identifier)
312+
313+
### Keyword: `item`, Type `slider`
314+
* Keyword: `item`
315+
* Type: `slider`
316+
* Function: display a value slider in a form
317+
* Children: none
318+
###### Attributes:
319+
* `label`: label of the slider
320+
(required, string type, minimum length: 1)
321+
* `disabled`: is the slider initially disabled?
322+
(optional, boolean type)
323+
* `hint`: hint text for the slider
324+
(optional, string type, minimum length: 1)
325+
* `min`: minimum value of a valid entry
326+
(optional, float type, any value except `NaN`, `+inf` and `-inf`)
327+
* `max`: maximum value of a valid entry
328+
(optional, float type, any value except `NaN`, `+inf` and `-inf`)
329+
* `step`: the gap between valid values
330+
(optional, float type, minimum value: 0.0)
331+
* `initialValue`: initial value of the slider
332+
(optional, float type, any value except `NaN`, `+inf` and `-inf`)
333+
* `outputKey`: key of the entry data for writing to output
334+
(optional, string type, valid identifier)
335+
336+
### Keyword: `item`, Type `richText`
337+
* Keyword: `item`
338+
* Type: `richText`
339+
* Function: display some formated text in a form
340+
* Children: none
341+
###### Attributes:
342+
* `label`: label of the text
343+
(optional, string type, minimum length: 1)
344+
* `hint`: hint text for the slider
345+
(optional, string type, minimum length: 1)
346+
* `text`: text in MarkDown format to be displayed
347+
(required, string type, minimum length: 1)
348+
* `scroll`: scrollbars for the text
349+
(optional, string type, `horizontal`, `vertical`, `both` or `none`)
350+
351+
### Keyword: `item`, Type `hyperlink`
352+
* Keyword: `item`
353+
* Type: `hyperlink`
354+
* Function: display a hyperlink (HTTP or HTTPS) in a form
355+
* Children: none
356+
###### Attributes:
357+
* `label`: label of the text
358+
(optional, string type, minimum length: 1)
359+
* `hint`: hint text for the slider
360+
(optional, string type, minimum length: 1)
361+
* `text`: text to be displayed
362+
(required, string type, minimum length: 1)
363+
* `url`: destination of the link as HTTP or HTTPS
364+
(required, string type, valid HTTP or HTTPS URL)
365+
366+
### Keyword: `item`, Type `separator`
367+
* Keyword: `item`
368+
* Type: `separator`
369+
* Function: display a separator in a form
370+
* Children: none
371+
###### Attributes:
372+
None.

ui/widget/widget.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func RegisterAll() error {
6262
Validate: valid.ExactStringValidator("entry"),
6363
},
6464
ui.AttrOutputKey: {
65-
Validate: valid.StringValidator(1, 0, nil),
65+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
6666
},
6767
"label": {
6868
Required: true,
@@ -106,7 +106,7 @@ func RegisterAll() error {
106106
Validate: valid.ExactStringValidator("multiLineEntry"),
107107
},
108108
ui.AttrOutputKey: {
109-
Validate: valid.StringValidator(1, 0, nil),
109+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
110110
},
111111
"label": {
112112
Required: true,
@@ -150,7 +150,7 @@ func RegisterAll() error {
150150
Validate: valid.ExactStringValidator("passwordEntry"),
151151
},
152152
ui.AttrOutputKey: {
153-
Validate: valid.StringValidator(1, 0, nil),
153+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
154154
},
155155
"label": {
156156
Required: true,
@@ -194,7 +194,7 @@ func RegisterAll() error {
194194
Validate: valid.ExactStringValidator("checkBox"),
195195
},
196196
ui.AttrOutputKey: {
197-
Validate: valid.StringValidator(1, 0, nil),
197+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
198198
},
199199
"label": {
200200
Required: true,
@@ -226,7 +226,7 @@ func RegisterAll() error {
226226
Validate: valid.ExactStringValidator("checkGroup"),
227227
},
228228
ui.AttrOutputKey: {
229-
Validate: valid.StringValidator(1, 0, nil),
229+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
230230
},
231231
"label": {
232232
Required: true,
@@ -264,7 +264,6 @@ func RegisterAll() error {
264264
Validate: valid.ExactStringValidator("hyperlink"),
265265
},
266266
"label": {
267-
Required: true,
268267
Validate: valid.StringValidator(1, 0, nil),
269268
},
270269
"hint": {
@@ -295,7 +294,7 @@ func RegisterAll() error {
295294
Validate: valid.ExactStringValidator("radioGroup"),
296295
},
297296
ui.AttrOutputKey: {
298-
Validate: valid.StringValidator(1, 0, nil),
297+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
299298
},
300299
"label": {
301300
Required: true,
@@ -338,7 +337,7 @@ func RegisterAll() error {
338337
Validate: valid.ExactStringValidator("richText"),
339338
},
340339
"label": {
341-
Validate: valid.StringValidator(0, 0, nil),
340+
Validate: valid.StringValidator(1, 0, nil),
342341
},
343342
"hint": {
344343
Validate: valid.StringValidator(1, 0, nil),
@@ -367,7 +366,7 @@ func RegisterAll() error {
367366
Validate: valid.ExactStringValidator("select"),
368367
},
369368
ui.AttrOutputKey: {
370-
Validate: valid.StringValidator(1, 0, nil),
369+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
371370
},
372371
"label": {
373372
Required: true,
@@ -384,7 +383,7 @@ func RegisterAll() error {
384383
},
385384
"options": {
386385
Required: true,
387-
Validate: valid.ListValidator(0, math.MaxInt,
386+
Validate: valid.ListValidator(2, math.MaxInt,
388387
valid.StringValidator(1, 0, nil)),
389388
},
390389
"initiallySelected": {
@@ -407,7 +406,7 @@ func RegisterAll() error {
407406
Validate: valid.ExactStringValidator("selectEntry"),
408407
},
409408
ui.AttrOutputKey: {
410-
Validate: valid.StringValidator(1, 0, nil),
409+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
411410
},
412411
"label": {
413412
Required: true,
@@ -472,7 +471,7 @@ func RegisterAll() error {
472471
Validate: valid.ExactStringValidator("slider"),
473472
},
474473
ui.AttrOutputKey: {
475-
Validate: valid.StringValidator(1, 0, nil),
474+
Validate: valid.StringValidator(1, 0, ui.NameRegex),
476475
},
477476
"label": {
478477
Required: true,

0 commit comments

Comments
 (0)