1
1
diff --git a/node_modules/@dhis2/app-service-plugin/build/cjs/Plugin.js b/node_modules/@dhis2/app-service-plugin/build/cjs/Plugin.js
2
- index ffd1cf0..e9515dd 100644
2
+ index ffd1cf0..9994d97 100644
3
3
--- a/node_modules/@dhis2/app-service-plugin/build/cjs/Plugin.js
4
4
+++ b/node_modules/@dhis2/app-service-plugin/build/cjs/Plugin.js
5
5
@@ -38,6 +38,8 @@ const Plugin = _ref3 => {
@@ -11,17 +11,38 @@ index ffd1cf0..e9515dd 100644
11
11
...propsToPassNonMemoized
12
12
} = _ref3;
13
13
const iframeRef = (0, _react.useRef)(null);
14
- @@ -79,7 +81,8 @@ const Plugin = _ref3 => {
14
+ @@ -54,7 +56,14 @@ const Plugin = _ref3 => {
15
+ const [communicationReceived, setCommunicationReceived] = (0, _react.useState)(false);
16
+ const [prevCommunicationReceived, setPrevCommunicationReceived] = (0, _react.useState)(false);
17
+ const [inErrorState, setInErrorState] = (0, _react.useState)(false);
18
+ + // height and width values to be set by callbacks passed to the plugin
19
+ + // (these default sizes will be quickly overwritten by the plugin)
20
+ + // in order to behave like a normal block element, by default, the height
21
+ + // will be set by plugin contents, this state will be used
22
+ const [resizedHeight, setPluginHeight] = (0, _react.useState)(150);
23
+ + // ...and by default, plugin width will be defined by the container
24
+ + // (width = 100%), so this state won't be used unless the `clientWidth`
25
+ + // prop is used to have plugin width defined by plugin contents
26
+ const [resizedWidth, setPluginWidth] = (0, _react.useState)(500);
27
+
28
+ // since we do not know what props are passed, the dependency array has to be keys of whatever is standard prop
29
+ @@ -76,10 +85,13 @@ const Plugin = _ref3 => {
30
+ const iframeProps = {
31
+ ...memoizedPropsToPass,
32
+ alertsAdd,
33
+ + // if a dimension is specified or container driven, don't send
34
+ + // a resize callback to the plugin
15
35
setPluginHeight: !height ? setPluginHeight : null,
16
- setPluginWidth: !width ? setPluginWidth : null,
36
+ - setPluginWidth: !width ? setPluginWidth : null,
37
+ + setPluginWidth: !width && clientWidth ? setPluginWidth : null,
17
38
setInErrorState,
18
39
- setCommunicationReceived
19
40
+ setCommunicationReceived,
20
41
+ clientWidth
21
42
};
22
43
23
44
// if iframe has not sent initial request, set up a listener
24
- @@ -112,17 +115,18 @@ const Plugin = _ref3 => {
45
+ @@ -112,17 +124,21 @@ const Plugin = _ref3 => {
25
46
appShortName: pluginShortName
26
47
});
27
48
}
@@ -42,9 +63,12 @@ index ffd1cf0..e9515dd 100644
42
63
+ return /*#__PURE__*/_react.default.createElement("iframe", {
43
64
+ ref: iframeRef,
44
65
+ src: pluginSource,
45
- + className: className,
66
+ + className: className
67
+ + // if clientWidth is set, then we want width to be set by plugin.
68
+ + // otherwise,
69
+ + ,
46
70
+ width: clientWidth ? resizedWidth : width !== null && width !== void 0 ? width : '100%',
47
- + height: height !== null && height !== void 0 ? height : resizedHeight + 'px' ,
71
+ + height: height !== null && height !== void 0 ? height : resizedHeight,
48
72
+ style: {
49
73
+ border: 'none'
50
74
+ }
@@ -53,7 +77,7 @@ index ffd1cf0..e9515dd 100644
53
77
exports.Plugin = Plugin;
54
78
\ No newline at end of file
55
79
diff --git a/node_modules/@dhis2/app-service-plugin/build/es/Plugin.js b/node_modules/@dhis2/app-service-plugin/build/es/Plugin.js
56
- index f3d29cd..6470e0f 100644
80
+ index f3d29cd..9878c4c 100644
57
81
--- a/node_modules/@dhis2/app-service-plugin/build/es/Plugin.js
58
82
+++ b/node_modules/@dhis2/app-service-plugin/build/es/Plugin.js
59
83
@@ -29,6 +29,8 @@ export const Plugin = _ref3 => {
@@ -65,17 +89,38 @@ index f3d29cd..6470e0f 100644
65
89
...propsToPassNonMemoized
66
90
} = _ref3;
67
91
const iframeRef = useRef(null);
68
- @@ -70,7 +72,8 @@ export const Plugin = _ref3 => {
92
+ @@ -45,7 +47,14 @@ export const Plugin = _ref3 => {
93
+ const [communicationReceived, setCommunicationReceived] = useState(false);
94
+ const [prevCommunicationReceived, setPrevCommunicationReceived] = useState(false);
95
+ const [inErrorState, setInErrorState] = useState(false);
96
+ + // height and width values to be set by callbacks passed to the plugin
97
+ + // (these default sizes will be quickly overwritten by the plugin)
98
+ + // in order to behave like a normal block element, by default, the height
99
+ + // will be set by plugin contents, this state will be used
100
+ const [resizedHeight, setPluginHeight] = useState(150);
101
+ + // ...and by default, plugin width will be defined by the container
102
+ + // (width = 100%), so this state won't be used unless the `clientWidth`
103
+ + // prop is used to have plugin width defined by plugin contents
104
+ const [resizedWidth, setPluginWidth] = useState(500);
105
+
106
+ // since we do not know what props are passed, the dependency array has to be keys of whatever is standard prop
107
+ @@ -67,10 +76,13 @@ export const Plugin = _ref3 => {
108
+ const iframeProps = {
109
+ ...memoizedPropsToPass,
110
+ alertsAdd,
111
+ + // if a dimension is specified or container driven, don't send
112
+ + // a resize callback to the plugin
69
113
setPluginHeight: !height ? setPluginHeight : null,
70
- setPluginWidth: !width ? setPluginWidth : null,
114
+ - setPluginWidth: !width ? setPluginWidth : null,
115
+ + setPluginWidth: !width && clientWidth ? setPluginWidth : null,
71
116
setInErrorState,
72
117
- setCommunicationReceived
73
118
+ setCommunicationReceived,
74
119
+ clientWidth
75
120
};
76
121
77
122
// if iframe has not sent initial request, set up a listener
78
- @@ -103,16 +106,17 @@ export const Plugin = _ref3 => {
123
+ @@ -103,16 +115,20 @@ export const Plugin = _ref3 => {
79
124
appShortName: pluginShortName
80
125
});
81
126
}
@@ -96,9 +141,12 @@ index f3d29cd..6470e0f 100644
96
141
+ return /*#__PURE__*/React.createElement("iframe", {
97
142
+ ref: iframeRef,
98
143
+ src: pluginSource,
99
- + className: className,
144
+ + className: className
145
+ + // if clientWidth is set, then we want width to be set by plugin.
146
+ + // otherwise,
147
+ + ,
100
148
+ width: clientWidth ? resizedWidth : width !== null && width !== void 0 ? width : '100%',
101
- + height: height !== null && height !== void 0 ? height : resizedHeight + 'px' ,
149
+ + height: height !== null && height !== void 0 ? height : resizedHeight,
102
150
+ style: {
103
151
+ border: 'none'
104
152
+ }
0 commit comments