@sutech_jp/raas-react-client 0.1.43 → 0.1.45
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/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,
|
|
@@ -13,6 +13,7 @@ declare type Props = {
|
|
|
13
13
|
options?: ComponentOptions;
|
|
14
14
|
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, dataList: BusinessDataList) => void;
|
|
15
15
|
onChangeRow?: (operation: RowOperation, dataList: BusinessDataList) => void;
|
|
16
|
+
onReset?: (property: string, rowIndex: number | undefined, dataList: BusinessDataList) => void;
|
|
16
17
|
onCompleteInput?: (dataList: BusinessDataList) => Promise<void>;
|
|
17
18
|
onChangeOperating?: (operating: boolean) => void;
|
|
18
19
|
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 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;
|
|
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, onReset = _a.onReset, onCompleteInput = _a.onCompleteInput, 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 ReportWebFormBulk = 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, dataList_1, _b, operation, dataList_2, dataList_3, operating;
|
|
78
|
-
return __generator(this, function (
|
|
79
|
-
switch (
|
|
77
|
+
var message, from, action, _a, property, rowIndex, value, dataList_1, _b, operation, dataList_2, _c, property, rowIndex, dataList_3, dataList_4, 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*/];
|
|
@@ -97,7 +97,7 @@ var ReportWebFormBulk = function (_a) {
|
|
|
97
97
|
});
|
|
98
98
|
// 初期化完了状態にする
|
|
99
99
|
setInitialized(true);
|
|
100
|
-
return [3 /*break*/,
|
|
100
|
+
return [3 /*break*/, 7];
|
|
101
101
|
case 1:
|
|
102
102
|
if (!(action === 'onChange')) return [3 /*break*/, 2];
|
|
103
103
|
if (!onChange) {
|
|
@@ -105,7 +105,7 @@ var ReportWebFormBulk = function (_a) {
|
|
|
105
105
|
}
|
|
106
106
|
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, dataList_1 = _a.dataList;
|
|
107
107
|
onChange(property, rowIndex, value, dataList_1);
|
|
108
|
-
return [3 /*break*/,
|
|
108
|
+
return [3 /*break*/, 7];
|
|
109
109
|
case 2:
|
|
110
110
|
if (!(action === 'onChangeRow')) return [3 /*break*/, 3];
|
|
111
111
|
if (!onChangeRow) {
|
|
@@ -113,26 +113,34 @@ var ReportWebFormBulk = function (_a) {
|
|
|
113
113
|
}
|
|
114
114
|
_b = message.payload, operation = _b.operation, dataList_2 = _b.dataList;
|
|
115
115
|
onChangeRow(operation, dataList_2);
|
|
116
|
-
return [3 /*break*/,
|
|
116
|
+
return [3 /*break*/, 7];
|
|
117
117
|
case 3:
|
|
118
|
-
if (!(action === '
|
|
118
|
+
if (!(action === 'onReset')) return [3 /*break*/, 4];
|
|
119
|
+
if (!onReset) {
|
|
120
|
+
return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
_c = message.payload, property = _c.property, rowIndex = _c.rowIndex, dataList_3 = _c.dataList;
|
|
123
|
+
onReset(property, rowIndex, dataList_3);
|
|
124
|
+
return [3 /*break*/, 7];
|
|
125
|
+
case 4:
|
|
126
|
+
if (!(action === 'onCompleteInput')) return [3 /*break*/, 6];
|
|
119
127
|
if (!onCompleteInput) {
|
|
120
128
|
// 結果メッセージを送信
|
|
121
129
|
sendMessage('onCompleted', {}, message.messageId);
|
|
122
130
|
return [2 /*return*/];
|
|
123
131
|
}
|
|
124
|
-
|
|
132
|
+
dataList_4 = message.payload;
|
|
125
133
|
// 入力完了処理を同期待ちする
|
|
126
|
-
return [4 /*yield*/, onCompleteInput(
|
|
134
|
+
return [4 /*yield*/, onCompleteInput(dataList_4)
|
|
127
135
|
// 結果メッセージを送信
|
|
128
136
|
];
|
|
129
|
-
case
|
|
137
|
+
case 5:
|
|
130
138
|
// 入力完了処理を同期待ちする
|
|
131
|
-
|
|
139
|
+
_d.sent();
|
|
132
140
|
// 結果メッセージを送信
|
|
133
141
|
sendMessage('onCompleted', {}, message.messageId);
|
|
134
|
-
return [3 /*break*/,
|
|
135
|
-
case
|
|
142
|
+
return [3 /*break*/, 7];
|
|
143
|
+
case 6:
|
|
136
144
|
if (action === 'onChangeOperating') {
|
|
137
145
|
if (!onChangeOperating) {
|
|
138
146
|
return [2 /*return*/];
|
|
@@ -146,8 +154,8 @@ var ReportWebFormBulk = function (_a) {
|
|
|
146
154
|
}
|
|
147
155
|
onBack();
|
|
148
156
|
}
|
|
149
|
-
|
|
150
|
-
case
|
|
157
|
+
_d.label = 7;
|
|
158
|
+
case 7: return [2 /*return*/];
|
|
151
159
|
}
|
|
152
160
|
});
|
|
153
161
|
}); }, [
|
|
@@ -159,6 +167,7 @@ var ReportWebFormBulk = function (_a) {
|
|
|
159
167
|
onChange,
|
|
160
168
|
onChangeOperating,
|
|
161
169
|
onChangeRow,
|
|
170
|
+
onReset,
|
|
162
171
|
onCompleteInput,
|
|
163
172
|
options,
|
|
164
173
|
sendMessage,
|