@sutech_jp/raas-react-client 0.1.42 → 0.1.43

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.
@@ -13,7 +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
- onCompleteInput?: (dataList: BusinessDataList) => void;
16
+ onCompleteInput?: (dataList: BusinessDataList) => Promise<void>;
17
17
  onChangeOperating?: (operating: boolean) => void;
18
18
  onBack?: () => void;
19
19
  };
@@ -76,61 +76,79 @@ var ReportWebFormBulk = function (_a) {
76
76
  var handleMessage = (0, react_1.useCallback)(function (e) { return __awaiter(void 0, void 0, void 0, function () {
77
77
  var message, from, action, _a, property, rowIndex, value, dataList_1, _b, operation, dataList_2, dataList_3, operating;
78
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*/];
79
+ switch (_c.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
+ dataList: dataList,
95
+ extensionSchemaDef: extensionSchemaDef,
96
+ options: options,
97
+ });
98
+ // 初期化完了状態にする
99
+ setInitialized(true);
100
+ return [3 /*break*/, 6];
101
+ case 1:
102
+ if (!(action === 'onChange')) return [3 /*break*/, 2];
103
+ if (!onChange) {
104
+ return [2 /*return*/];
105
+ }
106
+ _a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, dataList_1 = _a.dataList;
107
+ onChange(property, rowIndex, value, dataList_1);
108
+ return [3 /*break*/, 6];
109
+ case 2:
110
+ if (!(action === 'onChangeRow')) return [3 /*break*/, 3];
111
+ if (!onChangeRow) {
112
+ return [2 /*return*/];
113
+ }
114
+ _b = message.payload, operation = _b.operation, dataList_2 = _b.dataList;
115
+ onChangeRow(operation, dataList_2);
116
+ return [3 /*break*/, 6];
117
+ case 3:
118
+ if (!(action === 'onCompleteInput')) return [3 /*break*/, 5];
119
+ if (!onCompleteInput) {
120
+ // 結果メッセージを送信
121
+ sendMessage('onCompleted', {}, message.messageId);
122
+ return [2 /*return*/];
123
+ }
124
+ dataList_3 = message.payload;
125
+ // 入力完了処理を同期待ちする
126
+ return [4 /*yield*/, onCompleteInput(dataList_3)
127
+ // 結果メッセージを送信
128
+ ];
129
+ case 4:
130
+ // 入力完了処理を同期待ちする
131
+ _c.sent();
132
+ // 結果メッセージを送信
133
+ sendMessage('onCompleted', {}, message.messageId);
134
+ return [3 /*break*/, 6];
135
+ case 5:
136
+ if (action === 'onChangeOperating') {
137
+ if (!onChangeOperating) {
138
+ return [2 /*return*/];
139
+ }
140
+ operating = message.payload;
141
+ onChangeOperating(operating);
142
+ }
143
+ else if (action === 'onBack') {
144
+ if (!onBack) {
145
+ return [2 /*return*/];
146
+ }
147
+ onBack();
148
+ }
149
+ _c.label = 6;
150
+ case 6: return [2 /*return*/];
81
151
  }
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
152
  });
135
153
  }); }, [
136
154
  customStyles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/raas-react-client",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "react client for raas produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",