@@ -2,7 +2,10 @@ import { hidePropertiesIn, hidePropertyIn, Properties } from "@mendix/pluggable-
2
2
import {
3
3
RowLayoutProps ,
4
4
StructurePreviewProps ,
5
- structurePreviewPalette
5
+ structurePreviewPalette ,
6
+ rowLayout ,
7
+ container ,
8
+ text
6
9
} from "@mendix/widget-plugin-platform/preview/structure-preview-api" ;
7
10
import { DocumentViewerPreviewProps } from "typings/DocumentViewerProps" ;
8
11
@@ -18,7 +21,7 @@ export function getProperties(values: DocumentViewerPreviewProps, defaultPropert
18
21
"minHeightUnit" ,
19
22
"maxHeight" ,
20
23
"maxHeightUnit" ,
21
- "OverflowY "
24
+ "overflowY "
22
25
] ) ;
23
26
}
24
27
@@ -27,78 +30,47 @@ export function getProperties(values: DocumentViewerPreviewProps, defaultPropert
27
30
}
28
31
29
32
if ( values . maxHeightUnit === "none" ) {
30
- hidePropertiesIn ( defaultProperties , values , [ "maxHeight" , "OverflowY " ] ) ;
33
+ hidePropertiesIn ( defaultProperties , values , [ "maxHeight" , "overflowY " ] ) ;
31
34
}
32
35
33
36
return defaultProperties ;
34
37
}
35
38
36
39
export function getPreview ( values : DocumentViewerPreviewProps , isDarkMode : boolean ) : StructurePreviewProps {
37
40
const palette = structurePreviewPalette [ isDarkMode ? "dark" : "light" ] ;
38
- const titleHeader : RowLayoutProps = {
39
- type : "RowLayout" ,
41
+ const titleHeader : RowLayoutProps = rowLayout ( {
40
42
columnSize : "fixed" ,
41
43
backgroundColor : palette . background . topbarData ,
42
44
borders : true ,
43
- borderWidth : 1 ,
44
- children : [
45
- {
46
- type : "Container" ,
47
- padding : 4 ,
48
- children : [
49
- {
50
- type : "Text" ,
51
- content : "Document Viewer" ,
52
- fontColor : palette . text . data
53
- }
54
- ]
55
- }
56
- ]
57
- } ;
58
- const content = {
59
- type : "RowLayout" ,
45
+ borderWidth : 1
46
+ } ) (
47
+ container ( {
48
+ padding : 4
49
+ } ) ( text ( { fontColor : palette . text . data } ) ( "Document Viewer" ) )
50
+ ) ;
51
+
52
+ const content = rowLayout ( {
60
53
columnSize : "fixed" ,
61
- borders : true ,
62
- children : [
63
- {
64
- type : "Container" ,
65
- children : [
66
- {
67
- type : "RowLayout" ,
68
- grow : 2 ,
69
- columnSize : "grow" ,
70
- backgroundColor : values . readOnly
71
- ? palette . background . containerDisabled
72
- : palette . background . container ,
73
- children : [
74
- {
75
- type : "Container" ,
76
- grow : 1 ,
77
- padding : 4 ,
78
- children : [
79
- {
80
- type : "Text" ,
81
- content : getCustomCaption ( values ) ,
82
- fontColor : palette . text . data
83
- }
84
- ]
85
- }
86
- ] ,
87
- padding : 8
88
- }
89
- ] ,
90
- backgroundColor : palette . background . container ,
91
- borderRadius : 8
92
- }
93
- ]
94
- } as RowLayoutProps ;
54
+ borders : true
55
+ } ) (
56
+ container ( ) (
57
+ rowLayout ( {
58
+ grow : 2 ,
59
+ columnSize : "grow" ,
60
+ backgroundColor : values . readOnly ? palette . background . containerDisabled : palette . background . container
61
+ } ) (
62
+ container ( {
63
+ grow : 1 ,
64
+ padding : 4
65
+ } ) ( text ( { fontColor : palette . text . data } ) ( getCustomCaption ( values ) ) )
66
+ )
67
+ )
68
+ ) ;
95
69
96
- return {
97
- type : "Container" ,
70
+ return container ( {
98
71
borderRadius : 2 ,
99
- borderWidth : 1 ,
100
- children : [ titleHeader , content ]
101
- } ;
72
+ borderWidth : 1
73
+ } ) ( titleHeader , content ) ;
102
74
}
103
75
104
76
export function getCustomCaption ( values : DocumentViewerPreviewProps ) : string {
0 commit comments