@sutech_jp/raas-react-client 0.1.44 → 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.
@@ -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, operation, values_4, logId, operating;
78
- return __generator(this, function (_d) {
79
- switch (_d.label) {
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 = _d.sent();
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 = _d.sent();
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
- _c = message.payload, operation = _c.operation, values_4 = _c.values;
152
- onChangeRow(operation, values_4);
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
- _d.label = 6;
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/raas-react-client",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "react client for raas produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",