@sutech_jp/raas-react-client 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ var ReportPaperForm = function (_a) {
34
34
  var url = _a.url, layoutId = _a.layoutId, data = _a.data, onDataUpdate = _a.onDataUpdate, customData = _a.customData, onCustomDataUpdate = _a.onCustomDataUpdate, onRender = _a.onRender, reportOptions = _a.reportOptions, layout = _a.layout, onLayoutUpdate = _a.onLayoutUpdate, _b = _a.editability, editability = _b === void 0 ? 'none' : _b, _c = _a.layoutEditable, layoutEditable = _c === void 0 ? false : _c;
35
35
  var _d = __read((0, react_1.useState)('unauthorized'), 2), formState = _d[0], setFormState = _d[1];
36
36
  var _e = __read((0, react_1.useState)(), 2), contentHeight = _e[0], setContentHeight = _e[1];
37
+ var _f = __read((0, react_1.useState)(false), 2), layoutInitialized = _f[0], setLayoutInitialized = _f[1];
37
38
  var iframe = (0, react_1.useRef)(null);
38
39
  (0, react_1.useEffect)(function () {
39
40
  var _a;
@@ -57,6 +58,8 @@ var ReportPaperForm = function (_a) {
57
58
  var _a;
58
59
  if (formState === 'unauthorized')
59
60
  return;
61
+ if (!layoutInitialized)
62
+ return;
60
63
  if (!data)
61
64
  return;
62
65
  var iframeWindow = (_a = iframe.current) === null || _a === void 0 ? void 0 : _a.contentWindow;
@@ -69,7 +72,7 @@ var ReportPaperForm = function (_a) {
69
72
  customData: customData,
70
73
  options: reportOptions,
71
74
  }, '*');
72
- }, [formState, data, customData, reportOptions]);
75
+ }, [formState, layoutInitialized, data, customData, reportOptions]);
73
76
  var handleMessage = (0, react_1.useCallback)(function (e) {
74
77
  var message = e.data;
75
78
  var from = message === null || message === void 0 ? void 0 : message.from;
@@ -80,8 +83,11 @@ var ReportPaperForm = function (_a) {
80
83
  if (action === 'onAuthorized') {
81
84
  setFormState('authorized');
82
85
  }
83
- else if (action === 'onRender') {
86
+ else if (action === 'onReady') {
87
+ setLayoutInitialized(true);
84
88
  setContentHeight(message === null || message === void 0 ? void 0 : message.contentHeight);
89
+ }
90
+ else if (action === 'onRender') {
85
91
  if (onRender)
86
92
  onRender((message === null || message === void 0 ? void 0 : message.hasRequiredBlank) || false);
87
93
  }
@@ -97,6 +103,7 @@ var ReportPaperForm = function (_a) {
97
103
  }
98
104
  else if (action === 'onEditLayout') {
99
105
  var layout_1 = message.layout;
106
+ setContentHeight(message === null || message === void 0 ? void 0 : message.contentHeight);
100
107
  if (onLayoutUpdate)
101
108
  onLayoutUpdate(layout_1);
102
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/raas-react-client",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "react client for raas produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",