11import { Plugin , SchemaFieldObject } from '@stac-manager/data-core' ;
22
3- export class PluginTest extends Plugin {
4- name = 'FieldsTest ' ;
3+ export class PluginKitchenSink extends Plugin {
4+ name = 'Kitchen Sink ' ;
55
66 editSchema ( ) : SchemaFieldObject {
77 return {
88 type : 'root' ,
99 properties : {
10+ title : {
11+ type : 'string' ,
12+ label : 'Simple text'
13+ } ,
1014 arr_strings : {
11- label : 'Array of Strings' ,
15+ label : 'Array of Strings (default) ' ,
1216 type : 'array' ,
1317 items : {
1418 label : 'String' ,
1519 type : 'string'
1620 }
1721 } ,
18- arrObj : {
19- label : 'Array of Objects (with limits)' ,
22+ arr_strings_tags : {
23+ label : 'Array of Strings (Tags widget)' ,
24+ type : 'array' ,
25+ 'ui:widget' : 'tags' ,
26+ items : {
27+ type : 'string'
28+ }
29+ } ,
30+ arr_strings_tags_opts : {
31+ label : 'Array of Strings (Tags widget with options)' ,
32+ type : 'array' ,
33+ 'ui:widget' : 'tags' ,
34+ items : {
35+ type : 'string' ,
36+ enum : [
37+ [ 'viridis' , 'Viridis' ] ,
38+ [ 'plasma' , 'Plasma' ] ,
39+ [ 'inferno' , 'Inferno' ]
40+ ]
41+ }
42+ } ,
43+ arr_obj : {
44+ label : 'Array of Objects (with limits 1-3)' ,
2045 type : 'array' ,
2146 minItems : 1 ,
2247 maxItems : 3 ,
@@ -31,11 +56,12 @@ export class PluginTest extends Plugin {
3156 label : 'Nickname' ,
3257 type : 'string'
3358 }
34- }
59+ } ,
60+ additionalProperties : true
3561 }
3662 } ,
3763 spatial : {
38- label : 'Spatial Extent ' ,
64+ label : 'Array of array of 4 fields ' ,
3965 type : 'array' ,
4066 minItems : 1 ,
4167 items : {
@@ -55,7 +81,7 @@ export class PluginTest extends Plugin {
5581 }
5682 } ,
5783 checkbox : {
58- label : 'Select multiple strings' ,
84+ label : 'Select multiple strings (default) ' ,
5985 type : 'array' ,
6086 items : {
6187 type : 'string' ,
@@ -66,8 +92,21 @@ export class PluginTest extends Plugin {
6692 ]
6793 }
6894 } ,
95+ checkbox_as_select : {
96+ label : 'Select multiple strings (Select widget)' ,
97+ type : 'array' ,
98+ 'ui:widget' : 'select' ,
99+ items : {
100+ type : 'string' ,
101+ enum : [
102+ [ 'viridis' , 'viridis' ] ,
103+ [ 'plasma' , 'plasma' ] ,
104+ [ 'inferno' , 'inferno' ]
105+ ]
106+ }
107+ } ,
69108 radio : {
70- label : 'Select one string radio (default)' ,
109+ label : 'Select one string (default)' ,
71110 type : 'string' ,
72111 enum : [
73112 [ 'viridis' , 'viridis' ] ,
@@ -76,7 +115,7 @@ export class PluginTest extends Plugin {
76115 ]
77116 } ,
78117 select : {
79- label : 'Select one string' ,
118+ label : 'Select one string (Select widget) ' ,
80119 type : 'string' ,
81120 'ui:widget' : 'select' ,
82121 enum : [
@@ -85,12 +124,30 @@ export class PluginTest extends Plugin {
85124 [ 'inferno' , 'inferno' ]
86125 ]
87126 } ,
88- arrayCheckboxes : {
89- label : 'Array of Checkboxes' ,
127+ array_checkboxes : {
128+ label : 'Array of array of strings (default) ' ,
129+ type : 'array' ,
130+ items : {
131+ label : 'Group' ,
132+ type : 'array' ,
133+ items : {
134+ label : 'Checkbox option' ,
135+ type : 'string' ,
136+ enum : [
137+ [ 'viridis' , 'viridis' ] ,
138+ [ 'plasma' , 'plasma' ] ,
139+ [ 'inferno' , 'inferno' ]
140+ ]
141+ }
142+ }
143+ } ,
144+ array_checkboxes_as_select : {
145+ label : 'Array of array of strings (Select widget) ' ,
90146 type : 'array' ,
91147 items : {
92148 label : 'Group' ,
93149 type : 'array' ,
150+ 'ui:widget' : 'select' ,
94151 items : {
95152 label : 'Checkbox option' ,
96153 type : 'string' ,
@@ -113,7 +170,7 @@ export class PluginTest extends Plugin {
113170 enterData ( { arr, extent, json, ...rest } : any = { } ) {
114171 return {
115172 ...rest ,
116- arrObj : arr ,
173+ arr_obj : arr ,
117174 spatial : extent ?. spatial ,
118175 json : json || {
119176 key : 'value' ,
@@ -123,9 +180,9 @@ export class PluginTest extends Plugin {
123180 } ;
124181 }
125182
126- exitData ( { arrObj , spatial, ...rest } : any = { } ) {
183+ exitData ( { arr_obj , spatial, ...rest } : any = { } ) {
127184 return {
128- arr : arrObj ,
185+ arr : arr_obj ,
129186 extent : {
130187 spatial : spatial ?. map ( ( inner : string [ ] ) => inner . map ( ( v : string ) => v ) )
131188 } ,
0 commit comments