@sutech_jp/raas-react-client 0.1.34 → 0.1.36
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.
|
@@ -15,6 +15,7 @@ declare type Props = {
|
|
|
15
15
|
validateAll?: (values: BusinessData) => Promise<CustomValidationResult[]>;
|
|
16
16
|
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => void;
|
|
17
17
|
onGenerate?: (logId: string) => void;
|
|
18
|
+
onChangeOperating?: (operating: boolean) => void;
|
|
18
19
|
onBack?: () => void;
|
|
19
20
|
};
|
|
20
21
|
export declare const ReportWebForm: VFC<Props>;
|
|
@@ -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, options = _a.options, validate = _a.validate, validateAll = _a.validateAll, onChange = _a.onChange, onGenerate = _a.onGenerate, 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, options = _a.options, validate = _a.validate, validateAll = _a.validateAll, onChange = _a.onChange, 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);
|
|
@@ -87,7 +87,7 @@ var ReportWebForm = function (_a) {
|
|
|
87
87
|
prevInitialized.current = initialized;
|
|
88
88
|
}, [initialized, values, sendMessage]);
|
|
89
89
|
var handleMessage = (0, react_1.useCallback)(function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
-
var message, from, action, _a, property, rowIndex, value, values_1, result, values_2, results, _b, property, rowIndex, value, values_3, logId;
|
|
90
|
+
var message, from, action, _a, property, rowIndex, value, values_1, result_1, result, values_2, results, _b, property, rowIndex, value, values_3, logId, operating;
|
|
91
91
|
return __generator(this, function (_c) {
|
|
92
92
|
switch (_c.label) {
|
|
93
93
|
case 0:
|
|
@@ -113,10 +113,17 @@ var ReportWebForm = function (_a) {
|
|
|
113
113
|
return [3 /*break*/, 6];
|
|
114
114
|
case 1:
|
|
115
115
|
if (!(action === 'onValidate')) return [3 /*break*/, 3];
|
|
116
|
+
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, values_1 = _a.values;
|
|
116
117
|
if (!validate) {
|
|
118
|
+
result_1 = {
|
|
119
|
+
type: 'custom',
|
|
120
|
+
property: property,
|
|
121
|
+
error: false,
|
|
122
|
+
message: '',
|
|
123
|
+
};
|
|
124
|
+
sendMessage('onValidated', result_1, message.messageId);
|
|
117
125
|
return [2 /*return*/];
|
|
118
126
|
}
|
|
119
|
-
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, values_1 = _a.values;
|
|
120
127
|
return [4 /*yield*/, validate(property, rowIndex, value, values_1)
|
|
121
128
|
// バリデーション結果を送信
|
|
122
129
|
];
|
|
@@ -128,6 +135,8 @@ var ReportWebForm = function (_a) {
|
|
|
128
135
|
case 3:
|
|
129
136
|
if (!(action === 'onValidateAll')) return [3 /*break*/, 5];
|
|
130
137
|
if (!validateAll) {
|
|
138
|
+
// 空のバリデーション結果を送信
|
|
139
|
+
sendMessage('onValidatedAll', [], message.messageId);
|
|
131
140
|
return [2 /*return*/];
|
|
132
141
|
}
|
|
133
142
|
values_2 = message.payload.values;
|
|
@@ -154,6 +163,13 @@ var ReportWebForm = function (_a) {
|
|
|
154
163
|
logId = message.payload;
|
|
155
164
|
onGenerate(logId);
|
|
156
165
|
}
|
|
166
|
+
else if (action === 'onChangeOperating') {
|
|
167
|
+
if (!onChangeOperating) {
|
|
168
|
+
return [2 /*return*/];
|
|
169
|
+
}
|
|
170
|
+
operating = message.payload;
|
|
171
|
+
onChangeOperating(operating);
|
|
172
|
+
}
|
|
157
173
|
else if (action === 'onBack') {
|
|
158
174
|
if (!onBack) {
|
|
159
175
|
return [2 /*return*/];
|
|
@@ -170,6 +186,7 @@ var ReportWebForm = function (_a) {
|
|
|
170
186
|
layoutId,
|
|
171
187
|
onBack,
|
|
172
188
|
onChange,
|
|
189
|
+
onChangeOperating,
|
|
173
190
|
onGenerate,
|
|
174
191
|
options,
|
|
175
192
|
sendMessage,
|