Coverage for gws-app/gws/plugin/model_widget/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Model widgets. 

2 

3Each subpackage implements one widget type (``gws.ext.object.modelWidget``). 

4A widget tells the client how to display and edit a field. The server side only 

5passes the widget options to the client in the widget props; the widgets 

6themselves are implemented in the client, mostly in the ``index.tsx`` file of 

7the widget package. 

8 

9When a field has no ``widget`` config, it creates a default widget for its type, 

10e.g. ``input`` for text fields or ``featureSelect`` for related features. 

11 

12- ``date``: input for dates. 

13- ``feature_list``: list of related features, with buttons to create, link, edit, unlink and delete. 

14- ``feature_select``: drop-down list of related features. 

15- ``feature_suggest``: input that suggests related features. 

16- ``file``: upload and download of a file. 

17- ``file_list``: list of related features that hold files. 

18- ``float``: input for decimal numbers. 

19- ``geometry``: buttons to draw or edit a geometry. 

20- ``hidden``: the field is not shown. 

21- ``input``: single-line text input. 

22- ``integer``: input for whole numbers. 

23- ``password``: masked password input. 

24- ``select``: drop-down list with a fixed set of values. 

25- ``textarea``: multi-line text input. 

26- ``toggle``: checkbox or radio button. 

27 

28Example:: 

29 

30 fields+ { 

31 name "kind" 

32 type "text" 

33 widget { 

34 type "select" 

35 items [ 

36 { value "a" text "Type A" } 

37 { value "b" text "Type B" } 

38 ] 

39 } 

40 } 

41"""