@@ -34,66 +34,75 @@ export type Problem = {
3434} ;
3535
3636type BaseProps = {
37- type : "Image" | "Container" | "RowLayout" | "Text" | "DropZone" | "Selectable" | "Datasource" ;
38- grow ?: number ; // optionally sets a growth factor if used in a layout (default = 1)
39- }
37+ type : "Image" | "Container" | "RowLayout" | "Text" | "DropZone" | "Selectable" | "Datasource" ;
38+ grow ?: number ; // optionally sets a growth factor if used in a layout (default = 1)
39+ } ;
4040
4141type ImageProps = BaseProps & {
42- type : "Image" ;
43- document ?: string ; // svg image
44- data ?: string ; // base64 image
45- property ?: object ; // widget image property object from Values API
46- width ?: number ; // sets a fixed maximum width
47- height ?: number ; // sets a fixed maximum height
48- }
42+ type : "Image" ;
43+ document ?: string ; // svg image
44+ data ?: string ; // base64 image
45+ property ?: object ; // widget image property object from Values API
46+ width ?: number ; // sets a fixed maximum width
47+ height ?: number ; // sets a fixed maximum height
48+ } ;
4949
5050type ContainerProps = BaseProps & {
51- type : "Container" | "RowLayout" ;
52- children : PreviewProps [ ] ; // any other preview element
53- borders ?: boolean ; // sets borders around the layout to visually group its children
54- borderRadius ?: number ; // integer. Can be used to create rounded borders
55- backgroundColor ?: string ; // HTML color, formatted #RRGGBB
56- borderWidth ?: number ; // sets the border width
57- padding ?: number ; // integer. adds padding around the container
58- }
51+ type : "Container" | "RowLayout" ;
52+ children : PreviewProps [ ] ; // any other preview element
53+ borders ?: boolean ; // sets borders around the layout to visually group its children
54+ borderRadius ?: number ; // integer. Can be used to create rounded borders
55+ backgroundColor ?: string ; // HTML color, formatted #RRGGBB
56+ borderWidth ?: number ; // sets the border width
57+ padding ?: number ; // integer. adds padding around the container
58+ } ;
5959
6060type RowLayoutProps = ContainerProps & {
61- type : "RowLayout" ;
62- columnSize ?: "fixed" | "grow" // default is fixed
63- }
61+ type : "RowLayout" ;
62+ columnSize ?: "fixed" | "grow" ; // default is fixed
63+ } ;
6464
6565type TextProps = BaseProps & {
66- type : "Text" ;
67- content : string ; // text that should be shown
68- fontSize ?: number ; // sets the font size
69- fontColor ?: string ; // HTML color, formatted #RRGGBB
70- bold ?: boolean ;
71- italic ?: boolean ;
72- }
66+ type : "Text" ;
67+ content : string ; // text that should be shown
68+ fontSize ?: number ; // sets the font size
69+ fontColor ?: string ; // HTML color, formatted #RRGGBB
70+ bold ?: boolean ;
71+ italic ?: boolean ;
72+ } ;
7373
7474type DropZoneProps = BaseProps & {
75- type : "DropZone" ;
76- property : object ; // widgets property object from Values API
77- placeholder : string ; // text to be shown inside the dropzone when empty
78- showDataSourceHeader ?: boolean ; // true by default. Toggles whether to show a header containing information about the datasource
79- }
80-
75+ type : "DropZone" ;
76+ property : object ; // widgets property object from Values API
77+ placeholder : string ; // text to be shown inside the dropzone when empty
78+ showDataSourceHeader ?: boolean ; // true by default. Toggles whether to show a header containing information about the datasource
79+ } ;
8180
8281type SelectableProps = BaseProps & {
83- type : "Selectable" ;
84- object : object ; // object property instance from the Value API
85- child : PreviewProps ; // any type of preview property to visualize the object instance
86- }
82+ type : "Selectable" ;
83+ object : object ; // object property instance from the Value API
84+ child : PreviewProps ; // any type of preview property to visualize the object instance
85+ } ;
8786
8887type DatasourceProps = BaseProps & {
89- type : "Datasource" ;
90- property : object | null ; // datasource property object from Values API
91- child ?: PreviewProps ; // any type of preview property component (optional)
92- }
93-
94- export type PreviewProps = ImageProps | ContainerProps | RowLayoutProps | TextProps | DropZoneProps | SelectableProps | DatasourceProps ;
88+ type : "Datasource" ;
89+ property : object | null ; // datasource property object from Values API
90+ child ?: PreviewProps ; // any type of preview property component (optional)
91+ } ;
9592
96- export function getProperties ( _values : CodeEditorPreviewProps , defaultProperties : Properties /*, target: Platform*/ ) : Properties {
93+ export type PreviewProps =
94+ | ImageProps
95+ | ContainerProps
96+ | RowLayoutProps
97+ | TextProps
98+ | DropZoneProps
99+ | SelectableProps
100+ | DatasourceProps ;
101+
102+ export function getProperties (
103+ _values : CodeEditorPreviewProps ,
104+ defaultProperties : Properties /* target: Platform */
105+ ) : Properties {
97106 // Do the values manipulation here to control the visibility of properties in Studio and Studio Pro conditionally.
98107 /* Example
99108 if (values.myProperty === "custom") {
0 commit comments