@sutech_jp/raas-react-client 0.0.18 → 0.0.20
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.
|
@@ -3,7 +3,9 @@ declare type LayoutGalleryProps = {
|
|
|
3
3
|
url: string;
|
|
4
4
|
width?: string | number;
|
|
5
5
|
height?: string | number;
|
|
6
|
-
onSelectLayout
|
|
6
|
+
onSelectLayout?: (layoutId: number) => void;
|
|
7
|
+
onEditLayout?: (layoutId: number) => void;
|
|
8
|
+
onCreateLayout?: () => void;
|
|
7
9
|
};
|
|
8
10
|
export declare const ReportLayoutGallery: FC<LayoutGalleryProps>;
|
|
9
11
|
export {};
|
|
@@ -4,17 +4,30 @@ exports.ReportLayoutGallery = void 0;
|
|
|
4
4
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
var ReportLayoutGallery = function (_a) {
|
|
7
|
-
var url = _a.url, _b = _a.width, width = _b === void 0 ? '100%' : _b, _c = _a.height, height = _c === void 0 ? '100%' : _c, onSelectLayout = _a.onSelectLayout;
|
|
7
|
+
var url = _a.url, _b = _a.width, width = _b === void 0 ? '100%' : _b, _c = _a.height, height = _c === void 0 ? '100%' : _c, onSelectLayout = _a.onSelectLayout, onEditLayout = _a.onEditLayout, onCreateLayout = _a.onCreateLayout;
|
|
8
8
|
var handleMessage = (0, react_1.useCallback)(function (e) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
var from = (_a = e.data) === null || _a === void 0 ? void 0 : _a.from;
|
|
11
|
+
var action = (_b = e.data) === null || _b === void 0 ? void 0 : _b.action;
|
|
12
|
+
if (from !== 'gallery') {
|
|
13
|
+
return;
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
if (action === 'selectLayout') {
|
|
16
|
+
onSelectLayout && onSelectLayout((_c = e.data) === null || _c === void 0 ? void 0 : _c.layoutId);
|
|
17
|
+
}
|
|
18
|
+
else if (action === 'editLayout') {
|
|
19
|
+
onEditLayout && onEditLayout((_d = e.data) === null || _d === void 0 ? void 0 : _d.layoutId);
|
|
20
|
+
}
|
|
21
|
+
else if (action === 'createLayout') {
|
|
22
|
+
onCreateLayout && onCreateLayout();
|
|
23
|
+
}
|
|
24
|
+
}, [onCreateLayout, onEditLayout, onSelectLayout]);
|
|
14
25
|
(0, react_1.useEffect)(function () {
|
|
15
26
|
window.addEventListener('message', handleMessage);
|
|
16
27
|
return function () { return window.removeEventListener('message', handleMessage); };
|
|
17
28
|
}, [handleMessage]);
|
|
18
|
-
|
|
29
|
+
var operation = "".concat(onSelectLayout !== undefined ? 's' : '').concat(onEditLayout !== undefined ? 'e' : '').concat(onCreateLayout !== undefined ? 'c' : '');
|
|
30
|
+
var operationalURL = "".concat(url).concat(operation ? "?operation=".concat(operation) : '');
|
|
31
|
+
return (0, jsx_runtime_1.jsx)("iframe", { id: "gallery", src: operationalURL, style: { width: width, height: height, border: 0 } });
|
|
19
32
|
};
|
|
20
33
|
exports.ReportLayoutGallery = ReportLayoutGallery;
|