@sutech_jp/raas-react-client 0.1.44 → 0.1.46
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/webform.d.ts +5 -0
- package/dist/webform/ReportWebForm.d.ts +2 -1
- package/dist/webform/ReportWebForm.js +17 -9
- package/dist/webform/ReportWebFormBulk.js +1 -1
- package/dist/webform/ReportWebFormEdit.d.ts +25 -0
- package/dist/webform/ReportWebFormEdit.js +237 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { ReportTenantInfo } from './tenantInfo/ReportTenantInfo';
|
|
|
7
7
|
export { ReportOrganizer } from './organizer/ReportOrganizer';
|
|
8
8
|
export { ReportWebForm } from './webform/ReportWebForm';
|
|
9
9
|
export { ReportWebFormBulk } from './webform/ReportWebFormBulk';
|
|
10
|
+
export { ReportWebFormEdit } from './webform/ReportWebFormEdit';
|
|
10
11
|
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.ReportWebFormBulk = exports.ReportWebForm = exports.ReportOrganizer = exports.ReportTenantInfo = exports.ReportLayoutGallery = exports.createLocalSession = exports.useReportPaperForm = exports.ReportPaperForm = exports.ReportDesigner = exports.ReportConfig = void 0;
|
|
17
|
+
exports.ReportWebFormEdit = 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");
|
|
@@ -34,4 +34,6 @@ var ReportWebForm_1 = require("./webform/ReportWebForm");
|
|
|
34
34
|
Object.defineProperty(exports, "ReportWebForm", { enumerable: true, get: function () { return ReportWebForm_1.ReportWebForm; } });
|
|
35
35
|
var ReportWebFormBulk_1 = require("./webform/ReportWebFormBulk");
|
|
36
36
|
Object.defineProperty(exports, "ReportWebFormBulk", { enumerable: true, get: function () { return ReportWebFormBulk_1.ReportWebFormBulk; } });
|
|
37
|
+
var ReportWebFormEdit_1 = require("./webform/ReportWebFormEdit");
|
|
38
|
+
Object.defineProperty(exports, "ReportWebFormEdit", { enumerable: true, get: function () { return ReportWebFormEdit_1.ReportWebFormEdit; } });
|
|
37
39
|
__exportStar(require("./types"), exports);
|
package/dist/types/webform.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ export declare type MoveRowOperation = {
|
|
|
16
16
|
to: number;
|
|
17
17
|
};
|
|
18
18
|
export declare type ItemValue = string | number | boolean | Date | null;
|
|
19
|
+
export declare type ColumnChangeValue = {
|
|
20
|
+
property: string;
|
|
21
|
+
listProperty: string;
|
|
22
|
+
value: ItemValue;
|
|
23
|
+
};
|
|
19
24
|
export declare type ObjectValue = {
|
|
20
25
|
[key: string]: ItemValue | ObjectValue | ArrayValue;
|
|
21
26
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VFC } from 'react';
|
|
2
|
-
import { BusinessData, CustomValidationResult, ComponentOptions, ItemValue, ExtensionSchemaDef, RowOperation } from 'src/types/webform';
|
|
2
|
+
import { BusinessData, CustomValidationResult, ComponentOptions, ItemValue, ExtensionSchemaDef, RowOperation, ColumnChangeValue } 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
|
+
onChangeList?: (changes: ColumnChangeValue[], values: BusinessData) => void;
|
|
18
19
|
onChangeRow?: (operation: RowOperation, values: BusinessData) => void;
|
|
19
20
|
onGenerate?: (logId: string) => void;
|
|
20
21
|
onChangeOperating?: (operating: boolean) => 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, onChangeRow = _a.onChangeRow, 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, onChangeList = _a.onChangeList, 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, _c,
|
|
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, changes, values_4, _d, operation, values_5, logId, operating;
|
|
78
|
+
return __generator(this, function (_e) {
|
|
79
|
+
switch (_e.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 = _e.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 = _e.sent();
|
|
136
136
|
// バリデーション結果を送信
|
|
137
137
|
sendMessage('onValidatedAll', results, message.messageId);
|
|
138
138
|
return [3 /*break*/, 6];
|
|
@@ -144,12 +144,19 @@ 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 === 'onChangeList') {
|
|
148
|
+
if (!onChangeList) {
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
_c = message.payload, changes = _c.changes, values_4 = _c.values;
|
|
152
|
+
onChangeList(changes, values_4);
|
|
153
|
+
}
|
|
147
154
|
else if (action === 'onChangeRow') {
|
|
148
155
|
if (!onChangeRow) {
|
|
149
156
|
return [2 /*return*/];
|
|
150
157
|
}
|
|
151
|
-
|
|
152
|
-
onChangeRow(operation,
|
|
158
|
+
_d = message.payload, operation = _d.operation, values_5 = _d.values;
|
|
159
|
+
onChangeRow(operation, values_5);
|
|
153
160
|
}
|
|
154
161
|
else if (action === 'onGenerate') {
|
|
155
162
|
if (!onGenerate) {
|
|
@@ -171,7 +178,7 @@ var ReportWebForm = function (_a) {
|
|
|
171
178
|
}
|
|
172
179
|
onBack();
|
|
173
180
|
}
|
|
174
|
-
|
|
181
|
+
_e.label = 6;
|
|
175
182
|
case 6: return [2 /*return*/];
|
|
176
183
|
}
|
|
177
184
|
});
|
|
@@ -182,6 +189,7 @@ var ReportWebForm = function (_a) {
|
|
|
182
189
|
layoutId,
|
|
183
190
|
onBack,
|
|
184
191
|
onChange,
|
|
192
|
+
onChangeList,
|
|
185
193
|
onChangeOperating,
|
|
186
194
|
onChangeRow,
|
|
187
195
|
onGenerate,
|
|
@@ -191,6 +191,6 @@ var ReportWebFormBulk = function (_a) {
|
|
|
191
191
|
// 現在の initialized の値を保存
|
|
192
192
|
prevInitialized.current = initialized;
|
|
193
193
|
}, [initialized, dataList, sendMessage]);
|
|
194
|
-
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 } });
|
|
194
|
+
return (0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "webform-bulk", src: session === null || session === void 0 ? void 0 : session.newUrl, style: { width: width, height: height, border: 0 } });
|
|
195
195
|
};
|
|
196
196
|
exports.ReportWebFormBulk = ReportWebFormBulk;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VFC } from 'react';
|
|
2
|
+
import { BusinessData, CustomValidationResult, ComponentOptions, ItemValue, ExtensionSchemaDef, RowOperation, ColumnChangeValue } 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
|
+
values?: BusinessData;
|
|
12
|
+
fileName?: string;
|
|
13
|
+
extensionSchemaDef?: ExtensionSchemaDef;
|
|
14
|
+
options?: ComponentOptions;
|
|
15
|
+
validate?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => Promise<CustomValidationResult>;
|
|
16
|
+
validateAll?: (values: BusinessData) => Promise<CustomValidationResult[]>;
|
|
17
|
+
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => void;
|
|
18
|
+
onChangeList?: (changes: ColumnChangeValue[], values: BusinessData) => void;
|
|
19
|
+
onChangeRow?: (operation: RowOperation, values: BusinessData) => void;
|
|
20
|
+
onCompleteInput?: (values: BusinessData) => Promise<void>;
|
|
21
|
+
onChangeOperating?: (operating: boolean) => void;
|
|
22
|
+
onBack?: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const ReportWebFormEdit: VFC<Props>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,237 @@
|
|
|
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.ReportWebFormEdit = 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 ReportWebFormEdit = 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, onChangeList = _a.onChangeList, 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, values_1, result_1, result, values_2, results, _b, property, rowIndex, value, values_3, _c, changes, values_4, _d, operation, values_5, values_6, operating;
|
|
78
|
+
return __generator(this, function (_e) {
|
|
79
|
+
switch (_e.label) {
|
|
80
|
+
case 0:
|
|
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
|
+
return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
message = e.data;
|
|
85
|
+
from = message === null || message === void 0 ? void 0 : message.from;
|
|
86
|
+
action = message === null || message === void 0 ? void 0 : message.action;
|
|
87
|
+
if (from !== 'webform') {
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
if (!(action === 'onAuthorized')) return [3 /*break*/, 1];
|
|
91
|
+
sendMessage('onShow', {
|
|
92
|
+
customStyles: customStyles,
|
|
93
|
+
layoutId: layoutId,
|
|
94
|
+
values: values,
|
|
95
|
+
fileName: fileName,
|
|
96
|
+
extensionSchemaDef: extensionSchemaDef,
|
|
97
|
+
options: options,
|
|
98
|
+
});
|
|
99
|
+
// 初期化完了状態にする
|
|
100
|
+
setInitialized(true);
|
|
101
|
+
return [3 /*break*/, 11];
|
|
102
|
+
case 1:
|
|
103
|
+
if (!(action === 'onValidate')) return [3 /*break*/, 3];
|
|
104
|
+
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, values_1 = _a.values;
|
|
105
|
+
if (!validate) {
|
|
106
|
+
result_1 = {
|
|
107
|
+
type: 'custom',
|
|
108
|
+
property: property,
|
|
109
|
+
error: false,
|
|
110
|
+
message: '',
|
|
111
|
+
};
|
|
112
|
+
sendMessage('onValidated', result_1, message.messageId);
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
}
|
|
115
|
+
return [4 /*yield*/, validate(property, rowIndex, value, values_1)
|
|
116
|
+
// バリデーション結果を送信
|
|
117
|
+
];
|
|
118
|
+
case 2:
|
|
119
|
+
result = _e.sent();
|
|
120
|
+
// バリデーション結果を送信
|
|
121
|
+
sendMessage('onValidated', result, message.messageId);
|
|
122
|
+
return [3 /*break*/, 11];
|
|
123
|
+
case 3:
|
|
124
|
+
if (!(action === 'onValidateAll')) return [3 /*break*/, 5];
|
|
125
|
+
if (!validateAll) {
|
|
126
|
+
// 空のバリデーション結果を送信
|
|
127
|
+
sendMessage('onValidatedAll', [], message.messageId);
|
|
128
|
+
return [2 /*return*/];
|
|
129
|
+
}
|
|
130
|
+
values_2 = message.payload.values;
|
|
131
|
+
return [4 /*yield*/, validateAll(values_2)
|
|
132
|
+
// バリデーション結果を送信
|
|
133
|
+
];
|
|
134
|
+
case 4:
|
|
135
|
+
results = _e.sent();
|
|
136
|
+
// バリデーション結果を送信
|
|
137
|
+
sendMessage('onValidatedAll', results, message.messageId);
|
|
138
|
+
return [3 /*break*/, 11];
|
|
139
|
+
case 5:
|
|
140
|
+
if (!(action === 'onChange')) return [3 /*break*/, 6];
|
|
141
|
+
if (!onChange) {
|
|
142
|
+
return [2 /*return*/];
|
|
143
|
+
}
|
|
144
|
+
_b = message.payload, property = _b.property, rowIndex = _b.rowIndex, value = _b.value, values_3 = _b.values;
|
|
145
|
+
onChange(property, rowIndex, value, values_3);
|
|
146
|
+
return [3 /*break*/, 11];
|
|
147
|
+
case 6:
|
|
148
|
+
if (!(action === 'onChangeList')) return [3 /*break*/, 7];
|
|
149
|
+
if (!onChangeList) {
|
|
150
|
+
return [2 /*return*/];
|
|
151
|
+
}
|
|
152
|
+
_c = message.payload, changes = _c.changes, values_4 = _c.values;
|
|
153
|
+
onChangeList(changes, values_4);
|
|
154
|
+
return [3 /*break*/, 11];
|
|
155
|
+
case 7:
|
|
156
|
+
if (!(action === 'onChangeRow')) return [3 /*break*/, 8];
|
|
157
|
+
if (!onChangeRow) {
|
|
158
|
+
return [2 /*return*/];
|
|
159
|
+
}
|
|
160
|
+
_d = message.payload, operation = _d.operation, values_5 = _d.values;
|
|
161
|
+
onChangeRow(operation, values_5);
|
|
162
|
+
return [3 /*break*/, 11];
|
|
163
|
+
case 8:
|
|
164
|
+
if (!(action === 'onCompleteInput')) return [3 /*break*/, 10];
|
|
165
|
+
if (!onCompleteInput) {
|
|
166
|
+
// 結果メッセージを送信
|
|
167
|
+
sendMessage('onCompleted', {}, message.messageId);
|
|
168
|
+
return [2 /*return*/];
|
|
169
|
+
}
|
|
170
|
+
values_6 = message.payload;
|
|
171
|
+
// 入力完了処理を同期待ちする
|
|
172
|
+
return [4 /*yield*/, onCompleteInput(values_6)
|
|
173
|
+
// 結果メッセージを送信
|
|
174
|
+
];
|
|
175
|
+
case 9:
|
|
176
|
+
// 入力完了処理を同期待ちする
|
|
177
|
+
_e.sent();
|
|
178
|
+
// 結果メッセージを送信
|
|
179
|
+
sendMessage('onCompleted', {}, message.messageId);
|
|
180
|
+
return [3 /*break*/, 11];
|
|
181
|
+
case 10:
|
|
182
|
+
if (action === 'onChangeOperating') {
|
|
183
|
+
if (!onChangeOperating) {
|
|
184
|
+
return [2 /*return*/];
|
|
185
|
+
}
|
|
186
|
+
operating = message.payload;
|
|
187
|
+
onChangeOperating(operating);
|
|
188
|
+
}
|
|
189
|
+
else if (action === 'onBack') {
|
|
190
|
+
if (!onBack) {
|
|
191
|
+
return [2 /*return*/];
|
|
192
|
+
}
|
|
193
|
+
onBack();
|
|
194
|
+
}
|
|
195
|
+
_e.label = 11;
|
|
196
|
+
case 11: return [2 /*return*/];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}); }, [
|
|
200
|
+
customStyles,
|
|
201
|
+
extensionSchemaDef,
|
|
202
|
+
fileName,
|
|
203
|
+
layoutId,
|
|
204
|
+
onBack,
|
|
205
|
+
onChange,
|
|
206
|
+
onChangeList,
|
|
207
|
+
onChangeOperating,
|
|
208
|
+
onChangeRow,
|
|
209
|
+
onCompleteInput,
|
|
210
|
+
options,
|
|
211
|
+
sendMessage,
|
|
212
|
+
session === null || session === void 0 ? void 0 : session.newUrl,
|
|
213
|
+
validate,
|
|
214
|
+
validateAll,
|
|
215
|
+
values,
|
|
216
|
+
]);
|
|
217
|
+
// リスナーの登録は必ず先に済ませる必要があるため、useLayoutEffect を使用する
|
|
218
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
219
|
+
window.addEventListener('message', handleMessage);
|
|
220
|
+
return function () { return window.removeEventListener('message', handleMessage); };
|
|
221
|
+
}, [handleMessage]);
|
|
222
|
+
(0, react_1.useEffect)(function () {
|
|
223
|
+
// 前回の initialized の値を取得
|
|
224
|
+
var wasInitialized = prevInitialized.current;
|
|
225
|
+
// initialized が true になった直後は、データ更新メッセージを送信する必要がないため
|
|
226
|
+
// initialized に加えて、前回の initialized(wasInitialized) を確認し、
|
|
227
|
+
// 両方が true の場合のみデータ更新メッセージを送信する
|
|
228
|
+
if (initialized && wasInitialized) {
|
|
229
|
+
// データの更新があった場合は、データを送信する
|
|
230
|
+
sendMessage('onUpdateData', values);
|
|
231
|
+
}
|
|
232
|
+
// 現在の initialized の値を保存
|
|
233
|
+
prevInitialized.current = initialized;
|
|
234
|
+
}, [initialized, values, sendMessage]);
|
|
235
|
+
return (0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "webform-edit", src: session === null || session === void 0 ? void 0 : session.newUrl, style: { width: width, height: height, border: 0 } });
|
|
236
|
+
};
|
|
237
|
+
exports.ReportWebFormEdit = ReportWebFormEdit;
|