@sutech_jp/raas-react-client 0.1.32 → 0.1.34

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.
@@ -18,6 +18,7 @@ export declare type OrganizerOptions = {
18
18
  };
19
19
  export declare type OrganizerRenameOptions = {
20
20
  enable?: boolean;
21
+ enableStamp?: boolean;
21
22
  enableFileName?: boolean;
22
23
  defaultFileNamePattern?: string;
23
24
  };
@@ -11,6 +11,8 @@ export declare type ComponentOptions = {
11
11
  showBackButton?: boolean;
12
12
  };
13
13
  export declare type CustomValidationResult = {
14
+ type: 'custom';
15
+ property: string;
14
16
  error: boolean;
15
17
  message?: string;
16
18
  };
@@ -12,6 +12,7 @@ declare type Props = {
12
12
  fileName?: string;
13
13
  options?: ComponentOptions;
14
14
  validate?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => Promise<CustomValidationResult>;
15
+ validateAll?: (values: BusinessData) => Promise<CustomValidationResult[]>;
15
16
  onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => void;
16
17
  onGenerate?: (logId: string) => void;
17
18
  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 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, 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, 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, _b, property, rowIndex, value, values_2, logId;
90
+ var message, from, action, _a, property, rowIndex, value, values_1, result, values_2, results, _b, property, rowIndex, value, values_3, logId;
91
91
  return __generator(this, function (_c) {
92
92
  switch (_c.label) {
93
93
  case 0:
@@ -110,7 +110,7 @@ var ReportWebForm = function (_a) {
110
110
  });
111
111
  // 初期化完了状態にする
112
112
  setInitialized(true);
113
- return [3 /*break*/, 4];
113
+ return [3 /*break*/, 6];
114
114
  case 1:
115
115
  if (!(action === 'onValidate')) return [3 /*break*/, 3];
116
116
  if (!validate) {
@@ -124,14 +124,28 @@ var ReportWebForm = function (_a) {
124
124
  result = _c.sent();
125
125
  // バリデーション結果を送信
126
126
  sendMessage('onValidated', result, message.messageId);
127
- return [3 /*break*/, 4];
127
+ return [3 /*break*/, 6];
128
128
  case 3:
129
+ if (!(action === 'onValidateAll')) return [3 /*break*/, 5];
130
+ if (!validateAll) {
131
+ return [2 /*return*/];
132
+ }
133
+ values_2 = message.payload.values;
134
+ return [4 /*yield*/, validateAll(values_2)
135
+ // バリデーション結果を送信
136
+ ];
137
+ case 4:
138
+ results = _c.sent();
139
+ // バリデーション結果を送信
140
+ sendMessage('onValidatedAll', results, message.messageId);
141
+ return [3 /*break*/, 6];
142
+ case 5:
129
143
  if (action === 'onChange') {
130
144
  if (!onChange) {
131
145
  return [2 /*return*/];
132
146
  }
133
- _b = message.payload, property = _b.property, rowIndex = _b.rowIndex, value = _b.value, values_2 = _b.values;
134
- onChange(property, rowIndex, value, values_2);
147
+ _b = message.payload, property = _b.property, rowIndex = _b.rowIndex, value = _b.value, values_3 = _b.values;
148
+ onChange(property, rowIndex, value, values_3);
135
149
  }
136
150
  else if (action === 'onGenerate') {
137
151
  if (!onGenerate) {
@@ -146,8 +160,8 @@ var ReportWebForm = function (_a) {
146
160
  }
147
161
  onBack();
148
162
  }
149
- _c.label = 4;
150
- case 4: return [2 /*return*/];
163
+ _c.label = 6;
164
+ case 6: return [2 /*return*/];
151
165
  }
152
166
  });
153
167
  }); }, [
@@ -161,6 +175,7 @@ var ReportWebForm = function (_a) {
161
175
  sendMessage,
162
176
  session === null || session === void 0 ? void 0 : session.newUrl,
163
177
  validate,
178
+ validateAll,
164
179
  values,
165
180
  ]);
166
181
  (0, react_1.useEffect)(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/raas-react-client",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "react client for raas produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",