@sutech_jp/raas-react-client 0.1.40 → 0.1.42
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/webform.d.ts +21 -0
- package/dist/webform/ReportWebForm.d.ts +2 -1
- package/dist/webform/ReportWebForm.js +15 -7
- package/dist/webform/ReportWebFormBulk.d.ts +21 -0
- package/dist/webform/ReportWebFormBulk.js +169 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export { ReportLayoutGallery } from './gallery/ReportLayoutGallery';
|
|
|
6
6
|
export { ReportTenantInfo } from './tenantInfo/ReportTenantInfo';
|
|
7
7
|
export { ReportOrganizer } from './organizer/ReportOrganizer';
|
|
8
8
|
export { ReportWebForm } from './webform/ReportWebForm';
|
|
9
|
+
export { ReportWebFormBulk } from './webform/ReportWebFormBulk';
|
|
9
10
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ReportWebForm = exports.ReportOrganizer = exports.ReportTenantInfo = exports.ReportLayoutGallery = exports.createLocalSession = exports.useReportPaperForm = exports.ReportPaperForm = exports.ReportDesigner = exports.ReportConfig = void 0;
|
|
17
|
+
exports.ReportWebFormBulk = exports.ReportWebForm = exports.ReportOrganizer = exports.ReportTenantInfo = exports.ReportLayoutGallery = exports.createLocalSession = exports.useReportPaperForm = exports.ReportPaperForm = exports.ReportDesigner = exports.ReportConfig = void 0;
|
|
18
18
|
var ReportConfig_1 = require("./config/ReportConfig");
|
|
19
19
|
Object.defineProperty(exports, "ReportConfig", { enumerable: true, get: function () { return ReportConfig_1.ReportConfig; } });
|
|
20
20
|
var ReportDesigner_1 = require("./designer/ReportDesigner");
|
|
@@ -32,4 +32,6 @@ var ReportOrganizer_1 = require("./organizer/ReportOrganizer");
|
|
|
32
32
|
Object.defineProperty(exports, "ReportOrganizer", { enumerable: true, get: function () { return ReportOrganizer_1.ReportOrganizer; } });
|
|
33
33
|
var ReportWebForm_1 = require("./webform/ReportWebForm");
|
|
34
34
|
Object.defineProperty(exports, "ReportWebForm", { enumerable: true, get: function () { return ReportWebForm_1.ReportWebForm; } });
|
|
35
|
+
var ReportWebFormBulk_1 = require("./webform/ReportWebFormBulk");
|
|
36
|
+
Object.defineProperty(exports, "ReportWebFormBulk", { enumerable: true, get: function () { return ReportWebFormBulk_1.ReportWebFormBulk; } });
|
|
35
37
|
__exportStar(require("./types"), exports);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ThemeOptions } from './theme';
|
|
2
2
|
export { ThemeOptions, PaletteOptions, TypographyOptions, ColorOptions, Grayscale, TypographyVariants } from './theme';
|
|
3
|
-
export type { ItemValue, ObjectValue, ArrayValue, BusinessData, ComponentOptions, CustomValidationResult, } from './webform';
|
|
3
|
+
export type { ItemValue, ObjectValue, ArrayValue, BusinessData, BusinessDataList, ComponentOptions, CustomValidationResult, RowOperation, AddRowOperation, DeleteRowOperation, MoveRowOperation, } from './webform';
|
|
4
4
|
export declare type Layout = any;
|
|
5
5
|
export declare type CustomData = any[];
|
|
6
6
|
export declare type ReportOptions = any[];
|
package/dist/types/webform.d.ts
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
|
+
export declare type RowOperation = AddRowOperation | DeleteRowOperation | MoveRowOperation;
|
|
2
|
+
export declare type AddRowOperation = {
|
|
3
|
+
type: 'add';
|
|
4
|
+
property: string;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
};
|
|
7
|
+
export declare type DeleteRowOperation = {
|
|
8
|
+
type: 'delete';
|
|
9
|
+
property: string;
|
|
10
|
+
rowIndex: number;
|
|
11
|
+
};
|
|
12
|
+
export declare type MoveRowOperation = {
|
|
13
|
+
type: 'move';
|
|
14
|
+
property: string;
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
};
|
|
1
18
|
export declare type ItemValue = string | number | boolean | Date | null;
|
|
2
19
|
export declare type ObjectValue = {
|
|
3
20
|
[key: string]: ItemValue | ObjectValue | ArrayValue;
|
|
4
21
|
};
|
|
5
22
|
export declare type ArrayValue = ObjectValue[];
|
|
6
23
|
export declare type BusinessData = ObjectValue;
|
|
24
|
+
export declare type BusinessDataList = Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
values: BusinessData;
|
|
27
|
+
}>;
|
|
7
28
|
export declare type ComponentOptions = {
|
|
8
29
|
title?: string;
|
|
9
30
|
requiredIndicator?: 'simple' | 'filled' | 'outlined';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VFC } from 'react';
|
|
2
|
-
import { BusinessData, CustomValidationResult, ComponentOptions, ItemValue, ExtensionSchemaDef } from 'src/types/webform';
|
|
2
|
+
import { BusinessData, CustomValidationResult, ComponentOptions, ItemValue, ExtensionSchemaDef, RowOperation } from 'src/types/webform';
|
|
3
3
|
import { Session } from '../types';
|
|
4
4
|
import { ThemeOptions } from '../types/theme';
|
|
5
5
|
declare type Props = {
|
|
@@ -15,6 +15,7 @@ declare type Props = {
|
|
|
15
15
|
validate?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => Promise<CustomValidationResult>;
|
|
16
16
|
validateAll?: (values: BusinessData) => Promise<CustomValidationResult[]>;
|
|
17
17
|
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => void;
|
|
18
|
+
onChangeRow?: (operation: RowOperation, values: BusinessData) => void;
|
|
18
19
|
onGenerate?: (logId: string) => void;
|
|
19
20
|
onChangeOperating?: (operating: boolean) => void;
|
|
20
21
|
onBack?: () => void;
|
|
@@ -57,7 +57,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
57
57
|
var react_1 = require("react");
|
|
58
58
|
var targetOrigin_1 = require("../util/targetOrigin");
|
|
59
59
|
var ReportWebForm = function (_a) {
|
|
60
|
-
var session = _a.session, _b = _a.width, width = _b === void 0 ? '100%' : _b, _c = _a.height, height = _c === void 0 ? '100%' : _c, customStyles = _a.customStyles, layoutId = _a.layoutId, values = _a.values, fileName = _a.fileName, extensionSchemaDef = _a.extensionSchemaDef, options = _a.options, validate = _a.validate, validateAll = _a.validateAll, onChange = _a.onChange, onGenerate = _a.onGenerate, onChangeOperating = _a.onChangeOperating, onBack = _a.onBack;
|
|
60
|
+
var session = _a.session, _b = _a.width, width = _b === void 0 ? '100%' : _b, _c = _a.height, height = _c === void 0 ? '100%' : _c, customStyles = _a.customStyles, layoutId = _a.layoutId, values = _a.values, fileName = _a.fileName, extensionSchemaDef = _a.extensionSchemaDef, options = _a.options, validate = _a.validate, validateAll = _a.validateAll, onChange = _a.onChange, onChangeRow = _a.onChangeRow, onGenerate = _a.onGenerate, onChangeOperating = _a.onChangeOperating, onBack = _a.onBack;
|
|
61
61
|
var _d = __read((0, react_1.useState)(false), 2), initialized = _d[0], setInitialized = _d[1];
|
|
62
62
|
var prevInitialized = (0, react_1.useRef)(false);
|
|
63
63
|
var iframe = (0, react_1.useRef)(null);
|
|
@@ -74,9 +74,9 @@ var ReportWebForm = function (_a) {
|
|
|
74
74
|
}, (0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl));
|
|
75
75
|
}, [session === null || session === void 0 ? void 0 : session.newUrl]);
|
|
76
76
|
var handleMessage = (0, react_1.useCallback)(function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
-
var message, from, action, _a, property, rowIndex, value, values_1, result_1, result, values_2, results, _b, property, rowIndex, value, values_3, logId, operating;
|
|
78
|
-
return __generator(this, function (
|
|
79
|
-
switch (
|
|
77
|
+
var message, from, action, _a, property, rowIndex, value, values_1, result_1, result, values_2, results, _b, property, rowIndex, value, values_3, _c, operation, values_4, logId, operating;
|
|
78
|
+
return __generator(this, function (_d) {
|
|
79
|
+
switch (_d.label) {
|
|
80
80
|
case 0:
|
|
81
81
|
if ((0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl) !== '*' && e.origin !== (0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl)) {
|
|
82
82
|
return [2 /*return*/];
|
|
@@ -116,7 +116,7 @@ var ReportWebForm = function (_a) {
|
|
|
116
116
|
// バリデーション結果を送信
|
|
117
117
|
];
|
|
118
118
|
case 2:
|
|
119
|
-
result =
|
|
119
|
+
result = _d.sent();
|
|
120
120
|
// バリデーション結果を送信
|
|
121
121
|
sendMessage('onValidated', result, message.messageId);
|
|
122
122
|
return [3 /*break*/, 6];
|
|
@@ -132,7 +132,7 @@ var ReportWebForm = function (_a) {
|
|
|
132
132
|
// バリデーション結果を送信
|
|
133
133
|
];
|
|
134
134
|
case 4:
|
|
135
|
-
results =
|
|
135
|
+
results = _d.sent();
|
|
136
136
|
// バリデーション結果を送信
|
|
137
137
|
sendMessage('onValidatedAll', results, message.messageId);
|
|
138
138
|
return [3 /*break*/, 6];
|
|
@@ -144,6 +144,13 @@ var ReportWebForm = function (_a) {
|
|
|
144
144
|
_b = message.payload, property = _b.property, rowIndex = _b.rowIndex, value = _b.value, values_3 = _b.values;
|
|
145
145
|
onChange(property, rowIndex, value, values_3);
|
|
146
146
|
}
|
|
147
|
+
else if (action === 'onChangeRow') {
|
|
148
|
+
if (!onChangeRow) {
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
_c = message.payload, operation = _c.operation, values_4 = _c.values;
|
|
152
|
+
onChangeRow(operation, values_4);
|
|
153
|
+
}
|
|
147
154
|
else if (action === 'onGenerate') {
|
|
148
155
|
if (!onGenerate) {
|
|
149
156
|
return [2 /*return*/];
|
|
@@ -164,7 +171,7 @@ var ReportWebForm = function (_a) {
|
|
|
164
171
|
}
|
|
165
172
|
onBack();
|
|
166
173
|
}
|
|
167
|
-
|
|
174
|
+
_d.label = 6;
|
|
168
175
|
case 6: return [2 /*return*/];
|
|
169
176
|
}
|
|
170
177
|
});
|
|
@@ -176,6 +183,7 @@ var ReportWebForm = function (_a) {
|
|
|
176
183
|
onBack,
|
|
177
184
|
onChange,
|
|
178
185
|
onChangeOperating,
|
|
186
|
+
onChangeRow,
|
|
179
187
|
onGenerate,
|
|
180
188
|
options,
|
|
181
189
|
sendMessage,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VFC } from 'react';
|
|
2
|
+
import { BusinessDataList, ComponentOptions, ItemValue, ExtensionSchemaDef, RowOperation } from 'src/types/webform';
|
|
3
|
+
import { Session } from '../types';
|
|
4
|
+
import { ThemeOptions } from '../types/theme';
|
|
5
|
+
declare type Props = {
|
|
6
|
+
session: Session | undefined;
|
|
7
|
+
width?: string | number;
|
|
8
|
+
height?: string | number;
|
|
9
|
+
customStyles?: ThemeOptions;
|
|
10
|
+
layoutId: number;
|
|
11
|
+
dataList?: BusinessDataList;
|
|
12
|
+
extensionSchemaDef?: ExtensionSchemaDef;
|
|
13
|
+
options?: ComponentOptions;
|
|
14
|
+
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, dataList: BusinessDataList) => void;
|
|
15
|
+
onChangeRow?: (operation: RowOperation, dataList: BusinessDataList) => void;
|
|
16
|
+
onCompleteInput?: (dataList: BusinessDataList) => void;
|
|
17
|
+
onChangeOperating?: (operating: boolean) => void;
|
|
18
|
+
onBack?: () => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const ReportWebFormBulk: VFC<Props>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.ReportWebFormBulk = void 0;
|
|
56
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
57
|
+
var react_1 = require("react");
|
|
58
|
+
var targetOrigin_1 = require("../util/targetOrigin");
|
|
59
|
+
var ReportWebFormBulk = function (_a) {
|
|
60
|
+
var session = _a.session, _b = _a.width, width = _b === void 0 ? '100%' : _b, _c = _a.height, height = _c === void 0 ? '100%' : _c, customStyles = _a.customStyles, layoutId = _a.layoutId, dataList = _a.dataList, extensionSchemaDef = _a.extensionSchemaDef, options = _a.options, onChange = _a.onChange, onChangeRow = _a.onChangeRow, onCompleteInput = _a.onCompleteInput, onChangeOperating = _a.onChangeOperating, onBack = _a.onBack;
|
|
61
|
+
var _d = __read((0, react_1.useState)(false), 2), initialized = _d[0], setInitialized = _d[1];
|
|
62
|
+
var prevInitialized = (0, react_1.useRef)(false);
|
|
63
|
+
var iframe = (0, react_1.useRef)(null);
|
|
64
|
+
var sendMessage = (0, react_1.useCallback)(function (action, props, requestId) {
|
|
65
|
+
var _a;
|
|
66
|
+
var iframeWindow = (_a = iframe.current) === null || _a === void 0 ? void 0 : _a.contentWindow;
|
|
67
|
+
if (!iframeWindow)
|
|
68
|
+
return;
|
|
69
|
+
iframeWindow.postMessage({
|
|
70
|
+
from: 'webformClient',
|
|
71
|
+
action: action,
|
|
72
|
+
props: props,
|
|
73
|
+
messageId: requestId,
|
|
74
|
+
}, (0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl));
|
|
75
|
+
}, [session === null || session === void 0 ? void 0 : session.newUrl]);
|
|
76
|
+
var handleMessage = (0, react_1.useCallback)(function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var message, from, action, _a, property, rowIndex, value, dataList_1, _b, operation, dataList_2, dataList_3, operating;
|
|
78
|
+
return __generator(this, function (_c) {
|
|
79
|
+
if ((0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl) !== '*' && e.origin !== (0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl)) {
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
message = e.data;
|
|
83
|
+
from = message === null || message === void 0 ? void 0 : message.from;
|
|
84
|
+
action = message === null || message === void 0 ? void 0 : message.action;
|
|
85
|
+
if (from !== 'webform') {
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
if (action === 'onAuthorized') {
|
|
89
|
+
sendMessage('onShow', {
|
|
90
|
+
customStyles: customStyles,
|
|
91
|
+
layoutId: layoutId,
|
|
92
|
+
dataList: dataList,
|
|
93
|
+
extensionSchemaDef: extensionSchemaDef,
|
|
94
|
+
options: options,
|
|
95
|
+
});
|
|
96
|
+
// 初期化完了状態にする
|
|
97
|
+
setInitialized(true);
|
|
98
|
+
}
|
|
99
|
+
else if (action === 'onChange') {
|
|
100
|
+
if (!onChange) {
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, dataList_1 = _a.dataList;
|
|
104
|
+
onChange(property, rowIndex, value, dataList_1);
|
|
105
|
+
}
|
|
106
|
+
else if (action === 'onChangeRow') {
|
|
107
|
+
if (!onChangeRow) {
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
_b = message.payload, operation = _b.operation, dataList_2 = _b.dataList;
|
|
111
|
+
onChangeRow(operation, dataList_2);
|
|
112
|
+
}
|
|
113
|
+
else if (action === 'onCompleteInput') {
|
|
114
|
+
if (!onCompleteInput) {
|
|
115
|
+
return [2 /*return*/];
|
|
116
|
+
}
|
|
117
|
+
dataList_3 = message.payload;
|
|
118
|
+
onCompleteInput(dataList_3);
|
|
119
|
+
}
|
|
120
|
+
else if (action === 'onChangeOperating') {
|
|
121
|
+
if (!onChangeOperating) {
|
|
122
|
+
return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
operating = message.payload;
|
|
125
|
+
onChangeOperating(operating);
|
|
126
|
+
}
|
|
127
|
+
else if (action === 'onBack') {
|
|
128
|
+
if (!onBack) {
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
onBack();
|
|
132
|
+
}
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
});
|
|
135
|
+
}); }, [
|
|
136
|
+
customStyles,
|
|
137
|
+
dataList,
|
|
138
|
+
extensionSchemaDef,
|
|
139
|
+
layoutId,
|
|
140
|
+
onBack,
|
|
141
|
+
onChange,
|
|
142
|
+
onChangeOperating,
|
|
143
|
+
onChangeRow,
|
|
144
|
+
onCompleteInput,
|
|
145
|
+
options,
|
|
146
|
+
sendMessage,
|
|
147
|
+
session === null || session === void 0 ? void 0 : session.newUrl,
|
|
148
|
+
]);
|
|
149
|
+
// リスナーの登録は必ず先に済ませる必要があるため、useLayoutEffect を使用する
|
|
150
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
151
|
+
window.addEventListener('message', handleMessage);
|
|
152
|
+
return function () { return window.removeEventListener('message', handleMessage); };
|
|
153
|
+
}, [handleMessage]);
|
|
154
|
+
(0, react_1.useEffect)(function () {
|
|
155
|
+
// 前回の initialized の値を取得
|
|
156
|
+
var wasInitialized = prevInitialized.current;
|
|
157
|
+
// initialized が true になった直後は、データ更新メッセージを送信する必要がないため
|
|
158
|
+
// initialized に加えて、前回の initialized(wasInitialized) を確認し、
|
|
159
|
+
// 両方が true の場合のみデータ更新メッセージを送信する
|
|
160
|
+
if (initialized && wasInitialized) {
|
|
161
|
+
// データの更新があった場合は、データを送信する
|
|
162
|
+
sendMessage('onUpdateData', dataList);
|
|
163
|
+
}
|
|
164
|
+
// 現在の initialized の値を保存
|
|
165
|
+
prevInitialized.current = initialized;
|
|
166
|
+
}, [initialized, dataList, sendMessage]);
|
|
167
|
+
return (0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "webform", src: session === null || session === void 0 ? void 0 : session.newUrl, style: { width: width, height: height, border: 0 } });
|
|
168
|
+
};
|
|
169
|
+
exports.ReportWebFormBulk = ReportWebFormBulk;
|