@sutech_jp/datatraveler-react-client 0.1.31 → 0.1.33
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/DataTravelerWebFormBulk.d.ts +16 -0
- package/dist/{DataTravelerBulkWebForm.js → DataTravelerWebFormBulk.js} +46 -36
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/webform.d.ts +4 -57
- package/package.json +1 -1
- package/dist/DataTravelerBulkWebForm.d.ts +0 -17
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VFC } from 'react';
|
|
2
|
+
import { Session } from './types';
|
|
3
|
+
import { ThemeOptions } from './types/theme';
|
|
4
|
+
import { ComponentOptions } from './types/webform';
|
|
5
|
+
declare type Props = {
|
|
6
|
+
session: Session | undefined;
|
|
7
|
+
width?: string | number;
|
|
8
|
+
height?: string | number;
|
|
9
|
+
customStyles?: ThemeOptions;
|
|
10
|
+
options?: ComponentOptions;
|
|
11
|
+
dataIds: string[];
|
|
12
|
+
handleCompleteInput?: (editId: string) => Promise<void>;
|
|
13
|
+
handleBack?: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const DataTravelerWebFormBulk: VFC<Props>;
|
|
16
|
+
export {};
|
|
@@ -36,12 +36,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.DataTravelerWebFormBulk = void 0;
|
|
40
40
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
41
|
var react_1 = require("react");
|
|
42
42
|
var targetOrigin_1 = require("./util/targetOrigin");
|
|
43
|
-
var
|
|
44
|
-
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,
|
|
43
|
+
var DataTravelerWebFormBulk = function (_a) {
|
|
44
|
+
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, dataIds = _a.dataIds, options = _a.options, handleCompleteInput = _a.handleCompleteInput, handleBack = _a.handleBack;
|
|
45
45
|
var iframe = (0, react_1.useRef)(null);
|
|
46
46
|
var sendMessage = (0, react_1.useCallback)(function (action, props, requestId) {
|
|
47
47
|
var _a;
|
|
@@ -49,49 +49,59 @@ var DataTravelerBulkWebForm = function (_a) {
|
|
|
49
49
|
if (!iframeWindow)
|
|
50
50
|
return;
|
|
51
51
|
iframeWindow.postMessage({
|
|
52
|
-
from: '
|
|
52
|
+
from: 'dataTravelerWebformBulkClient',
|
|
53
53
|
action: action,
|
|
54
54
|
props: props,
|
|
55
55
|
messageId: requestId,
|
|
56
56
|
}, (0, targetOrigin_1.getTargetOrigin)(session === null || session === void 0 ? void 0 : session.newUrl));
|
|
57
57
|
}, [session === null || session === void 0 ? void 0 : session.newUrl]);
|
|
58
58
|
var handleMessage = (0, react_1.useCallback)(function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
-
var message, from, action,
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
var message, from, action, editId;
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
switch (_a.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
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)) {
|
|
64
|
+
return [2 /*return*/];
|
|
65
|
+
}
|
|
66
|
+
message = e.data;
|
|
67
|
+
from = message === null || message === void 0 ? void 0 : message.from;
|
|
68
|
+
action = message === null || message === void 0 ? void 0 : message.action;
|
|
69
|
+
if (from !== 'dataTravelerWebformBulk') {
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
if (!(action === 'onAuthorized')) return [3 /*break*/, 1];
|
|
73
|
+
sendMessage('onShow', {
|
|
74
|
+
width: width,
|
|
75
|
+
height: height,
|
|
76
|
+
customStyles: customStyles,
|
|
77
|
+
options: options,
|
|
78
|
+
dataIds: dataIds,
|
|
79
|
+
});
|
|
80
|
+
return [3 /*break*/, 4];
|
|
81
|
+
case 1:
|
|
82
|
+
if (!(action === 'onCompleteInput')) return [3 /*break*/, 3];
|
|
83
|
+
if (!handleCompleteInput)
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
editId = message.payload.editId;
|
|
86
|
+
return [4 /*yield*/, handleCompleteInput(editId)];
|
|
87
|
+
case 2:
|
|
88
|
+
_a.sent();
|
|
89
|
+
return [3 /*break*/, 4];
|
|
90
|
+
case 3:
|
|
91
|
+
if (action === 'onBack') {
|
|
92
|
+
if (!handleBack)
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
handleBack();
|
|
95
|
+
}
|
|
96
|
+
_a.label = 4;
|
|
97
|
+
case 4: return [2 /*return*/];
|
|
63
98
|
}
|
|
64
|
-
message = e.data;
|
|
65
|
-
from = message === null || message === void 0 ? void 0 : message.from;
|
|
66
|
-
action = message === null || message === void 0 ? void 0 : message.action;
|
|
67
|
-
if (from !== 'dataTravelerBulkWebform') {
|
|
68
|
-
return [2 /*return*/];
|
|
69
|
-
}
|
|
70
|
-
if (action === 'onAuthorized') {
|
|
71
|
-
sendMessage('onShow', {
|
|
72
|
-
width: width,
|
|
73
|
-
height: height,
|
|
74
|
-
customStyles: customStyles,
|
|
75
|
-
application: application,
|
|
76
|
-
schema: schema,
|
|
77
|
-
dataIds: dataIds,
|
|
78
|
-
layoutId: layoutId,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else if (action === 'onChange') {
|
|
82
|
-
if (!onChange) {
|
|
83
|
-
return [2 /*return*/];
|
|
84
|
-
}
|
|
85
|
-
_a = message.payload, property = _a.property, rowIndex = _a.rowIndex, value = _a.value, values = _a.values;
|
|
86
|
-
onChange(property, rowIndex, value, values);
|
|
87
|
-
}
|
|
88
|
-
return [2 /*return*/];
|
|
89
99
|
});
|
|
90
|
-
}); }, [customStyles,
|
|
100
|
+
}); }, [customStyles, handleCompleteInput, handleBack, options, sendMessage, session === null || session === void 0 ? void 0 : session.newUrl, width, height, dataIds]);
|
|
91
101
|
(0, react_1.useEffect)(function () {
|
|
92
102
|
window.addEventListener('message', handleMessage);
|
|
93
103
|
return function () { return window.removeEventListener('message', handleMessage); };
|
|
94
104
|
}, [handleMessage]);
|
|
95
|
-
return (0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "
|
|
105
|
+
return (0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "dataTravelerWebFormBulk", src: session === null || session === void 0 ? void 0 : session.newUrl, style: { width: width, height: height, border: 0 } });
|
|
96
106
|
};
|
|
97
|
-
exports.
|
|
107
|
+
exports.DataTravelerWebFormBulk = DataTravelerWebFormBulk;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./DataTravelerImport"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./DataTravelerWebFormBulk"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/webform.d.ts
CHANGED
|
@@ -1,62 +1,9 @@
|
|
|
1
|
-
export declare type ItemValue = string | number | boolean | Date | null;
|
|
2
|
-
export declare type ObjectValue = {
|
|
3
|
-
[key: string]: ItemValue | ObjectValue | ArrayValue;
|
|
4
|
-
};
|
|
5
|
-
export declare type ArrayValue = ObjectValue[];
|
|
6
|
-
export declare type BusinessData = ObjectValue;
|
|
7
1
|
export declare type ComponentOptions = {
|
|
8
2
|
title?: string;
|
|
9
3
|
requiredIndicator?: 'simple' | 'filled' | 'outlined';
|
|
10
|
-
showReportGenerationButton?: boolean;
|
|
11
4
|
showBackButton?: boolean;
|
|
5
|
+
settings?: {
|
|
6
|
+
showLayoutSettingMenu?: boolean;
|
|
7
|
+
showOptionsMenu?: boolean;
|
|
8
|
+
};
|
|
12
9
|
};
|
|
13
|
-
export declare type CustomValidationResult = {
|
|
14
|
-
type: 'custom';
|
|
15
|
-
property: string;
|
|
16
|
-
error: boolean;
|
|
17
|
-
message?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare type ExtensionSchemaDef = {
|
|
20
|
-
container: ExtensionSchemaContainer;
|
|
21
|
-
properties: ExtensionSchemaProperty[];
|
|
22
|
-
};
|
|
23
|
-
export declare type ExtensionSchemaContainer = {
|
|
24
|
-
property: string;
|
|
25
|
-
caption: string;
|
|
26
|
-
};
|
|
27
|
-
export declare type ExtensionSchemaProperty = TextProperty | NumberProperty | DateProperty | DatetimeProperty | BooleanProperty;
|
|
28
|
-
export declare type PropertyBase = {
|
|
29
|
-
property: string;
|
|
30
|
-
caption: string;
|
|
31
|
-
required?: boolean;
|
|
32
|
-
};
|
|
33
|
-
export declare type TextProperty = {
|
|
34
|
-
type: 'text';
|
|
35
|
-
minLength?: number;
|
|
36
|
-
maxLength?: number;
|
|
37
|
-
} & PropertyBase;
|
|
38
|
-
export declare type NumberProperty = {
|
|
39
|
-
type: 'number';
|
|
40
|
-
min?: number;
|
|
41
|
-
max?: number;
|
|
42
|
-
minAcceptEqual?: boolean;
|
|
43
|
-
maxAcceptEqual?: boolean;
|
|
44
|
-
precision?: number;
|
|
45
|
-
} & PropertyBase;
|
|
46
|
-
export declare type DateProperty = {
|
|
47
|
-
type: 'date';
|
|
48
|
-
min?: Date;
|
|
49
|
-
max?: Date;
|
|
50
|
-
minAcceptEqual?: boolean;
|
|
51
|
-
maxAcceptEqual?: boolean;
|
|
52
|
-
} & PropertyBase;
|
|
53
|
-
export declare type DatetimeProperty = {
|
|
54
|
-
type: 'datetime';
|
|
55
|
-
min?: Date;
|
|
56
|
-
max?: Date;
|
|
57
|
-
minAcceptEqual?: boolean;
|
|
58
|
-
maxAcceptEqual?: boolean;
|
|
59
|
-
} & PropertyBase;
|
|
60
|
-
export declare type BooleanProperty = {
|
|
61
|
-
type: 'boolean';
|
|
62
|
-
} & PropertyBase;
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { VFC } from 'react';
|
|
2
|
-
import { Session } from './types';
|
|
3
|
-
import { ThemeOptions } from './types/theme';
|
|
4
|
-
import { BusinessData, ItemValue } from './types/webform';
|
|
5
|
-
declare type Props = {
|
|
6
|
-
session: Session | undefined;
|
|
7
|
-
width?: string | number;
|
|
8
|
-
height?: string | number;
|
|
9
|
-
customStyles?: ThemeOptions;
|
|
10
|
-
application: string;
|
|
11
|
-
schema: string;
|
|
12
|
-
dataIds: string[];
|
|
13
|
-
layoutId: number;
|
|
14
|
-
onChange?: (property: string, rowIndex: number | undefined, value: ItemValue, values: BusinessData) => void;
|
|
15
|
-
};
|
|
16
|
-
export declare const DataTravelerBulkWebForm: VFC<Props>;
|
|
17
|
-
export {};
|