@sutech_jp/datatraveler-react-client 0.0.9 → 0.0.10

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,6 +13,8 @@ declare type Props<D> = {
13
13
  onCancel?: () => void;
14
14
  currentData?: D[];
15
15
  maps?: DataImportParseMaps;
16
+ width?: number;
17
+ height?: number;
16
18
  };
17
- export declare const DataTravelerImport: <D>({ url, importDef, googleToken, currentData, maps, onImport, onCancel, }: Props<D>) => ReactElement;
19
+ export declare const DataTravelerImport: <D>({ url, importDef, googleToken, currentData, maps, width, height, onImport, onCancel, }: Props<D>) => ReactElement;
18
20
  export {};
@@ -4,7 +4,7 @@ exports.DataTravelerImport = void 0;
4
4
  var jsx_runtime_1 = require("react/jsx-runtime");
5
5
  var react_1 = require("react");
6
6
  var DataTravelerImport = function (_a) {
7
- var url = _a.url, importDef = _a.importDef, googleToken = _a.googleToken, _b = _a.currentData, currentData = _b === void 0 ? [] : _b, _c = _a.maps, maps = _c === void 0 ? {} : _c, onImport = _a.onImport, onCancel = _a.onCancel;
7
+ var url = _a.url, importDef = _a.importDef, googleToken = _a.googleToken, _b = _a.currentData, currentData = _b === void 0 ? [] : _b, _c = _a.maps, maps = _c === void 0 ? {} : _c, width = _a.width, height = _a.height, onImport = _a.onImport, onCancel = _a.onCancel;
8
8
  var iframe = (0, react_1.useRef)(null);
9
9
  var handleMessage = (0, react_1.useCallback)(function (e) {
10
10
  var _a;
@@ -27,6 +27,10 @@ var DataTravelerImport = function (_a) {
27
27
  maps: maps,
28
28
  useCancel: !!onCancel,
29
29
  googleToken: googleToken,
30
+ size: {
31
+ width: width,
32
+ height: height,
33
+ },
30
34
  }, '*');
31
35
  }
32
36
  else if (action === 'onImport') {
@@ -35,14 +39,14 @@ var DataTravelerImport = function (_a) {
35
39
  else if (action === 'onCancel') {
36
40
  onCancel && onCancel();
37
41
  }
38
- }, [importDef, googleToken, currentData, maps, onImport, onCancel]);
42
+ }, [importDef, currentData, maps, onCancel, googleToken, width, height, onImport]);
39
43
  (0, react_1.useEffect)(function () {
40
44
  window.addEventListener('message', handleMessage);
41
45
  return function () { return window.removeEventListener('message', handleMessage); };
42
46
  }, [handleMessage]);
43
47
  return ((0, jsx_runtime_1.jsx)("iframe", { ref: iframe, id: "datatraveler", name: "datatraveler", frameBorder: '0', src: url, style: {
44
- width: 'calc(100vw - 120px)',
45
- height: 'calc(100vh - 120px)',
48
+ width: width !== undefined ? "".concat(width, "px") : '100vw',
49
+ height: height !== undefined ? "".concat(height, "px") : '100vh',
46
50
  } }));
47
51
  };
48
52
  exports.DataTravelerImport = DataTravelerImport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/datatraveler-react-client",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "react client for data traveler produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",