@sutech_jp/datatraveler-react-client 0.0.17 → 0.0.18

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.
@@ -1,12 +1,10 @@
1
1
  import { ReactElement } from 'react';
2
- import { Binder, CsvParseSetting, DataTravelerResult, EntitySchema, Mapper } from './types';
2
+ import { Binder, DataTravelerResult, Mapper } from './types';
3
3
  declare type Props<D> = {
4
4
  application: string;
5
5
  schema: string;
6
6
  url: string;
7
- entitySchemas: EntitySchema[];
8
7
  googleToken?: string;
9
- csvParseSetting?: CsvParseSetting;
10
8
  onImport: (result: DataTravelerResult<D>) => void;
11
9
  onCancel?: () => void;
12
10
  currentData?: D[];
@@ -15,5 +13,5 @@ declare type Props<D> = {
15
13
  width?: number;
16
14
  height?: number;
17
15
  };
18
- export declare const DataTravelerImport: <D>({ application, schema, url, entitySchemas, googleToken, csvParseSetting, currentData, mapper, binder, width, height, onImport, onCancel, }: Props<D>) => ReactElement;
16
+ export declare const DataTravelerImport: <D>({ application, schema, url, googleToken, currentData, mapper, binder, width, height, onImport, onCancel, }: Props<D>) => ReactElement;
19
17
  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 application = _a.application, schema = _a.schema, url = _a.url, entitySchemas = _a.entitySchemas, googleToken = _a.googleToken, _b = _a.csvParseSetting, csvParseSetting = _b === void 0 ? {} : _b, _c = _a.currentData, currentData = _c === void 0 ? [] : _c, _d = _a.mapper, mapper = _d === void 0 ? {} : _d, _e = _a.binder, binder = _e === void 0 ? {} : _e, width = _a.width, height = _a.height, onImport = _a.onImport, onCancel = _a.onCancel;
7
+ var application = _a.application, schema = _a.schema, url = _a.url, googleToken = _a.googleToken, _b = _a.currentData, currentData = _b === void 0 ? [] : _b, _c = _a.mapper, mapper = _c === void 0 ? {} : _c, _d = _a.binder, binder = _d === void 0 ? {} : _d, 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;
@@ -24,8 +24,6 @@ var DataTravelerImport = function (_a) {
24
24
  action: 'onShow',
25
25
  application: application,
26
26
  schema: schema,
27
- entitySchemas: entitySchemas,
28
- csvParseSetting: csvParseSetting,
29
27
  currentData: currentData,
30
28
  mapper: mapper,
31
29
  binder: binder,
@@ -43,20 +41,7 @@ var DataTravelerImport = function (_a) {
43
41
  else if (action === 'onCancel') {
44
42
  onCancel && onCancel();
45
43
  }
46
- }, [
47
- application,
48
- schema,
49
- entitySchemas,
50
- csvParseSetting,
51
- currentData,
52
- mapper,
53
- binder,
54
- onCancel,
55
- googleToken,
56
- width,
57
- height,
58
- onImport,
59
- ]);
44
+ }, [application, schema, currentData, mapper, binder, onCancel, googleToken, width, height, onImport]);
60
45
  (0, react_1.useEffect)(function () {
61
46
  window.addEventListener('message', handleMessage);
62
47
  return function () { return window.removeEventListener('message', handleMessage); };
package/dist/types.d.ts CHANGED
@@ -1,65 +1,7 @@
1
- export declare type EntitySchema = {
2
- property: string;
3
- } & (TextEntitySchema | NumberEntitySchema | DateEntitySchema | ArrayEntitySchema | ObjectEntitySchema | OriginalEntitySchema);
4
- declare type ValueEntitySchema<T> = {
5
- key?: boolean;
6
- mapping?: {
7
- name: string;
8
- property: string;
9
- matcher: string;
10
- };
11
- binding?: {
12
- name: string;
13
- property: string;
14
- };
15
- default?: T;
16
- notNull?: boolean;
17
- allow?: T[];
18
- ignoreUpdate?: T[];
19
- generator?: Generator;
20
- };
21
- declare type Generator = {
22
- sum?: (string | number)[];
23
- multiple?: (string | number)[];
24
- };
25
- declare type TextEntitySchema = {
26
- type: 'text';
27
- } & ValueEntitySchema<string>;
28
- declare type NumberEntitySchema = {
29
- type: 'number';
30
- } & ValueEntitySchema<number>;
31
- declare type DateEntitySchema = {
32
- type: 'date';
33
- } & ValueEntitySchema<Date>;
34
- declare type ArrayEntitySchema = {
35
- type: 'array';
36
- children: EntitySchema[];
37
- };
38
- declare type ObjectEntitySchema = {
39
- type: 'object';
40
- children: EntitySchema[];
41
- };
42
- declare type OriginalEntitySchema = {
43
- type: 'original';
44
- };
45
1
  export declare type Mapper = Record<string, Record<string, any>[]>;
46
2
  export declare type Binder = Record<string, Record<string, any>>;
47
- export declare type CsvParseSetting = {
48
- ignore?: {
49
- columnName: string;
50
- values: string[];
51
- }[];
52
- lastRow?: {
53
- condition: {
54
- columnName: string;
55
- values: string[];
56
- }[];
57
- errorWhenNotFound?: boolean;
58
- };
59
- };
60
3
  export declare type DataTravelerResult<D> = {
61
4
  insert: D[];
62
5
  update: D[];
63
6
  dataImportLogId: string;
64
7
  };
65
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/datatraveler-react-client",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "react client for data traveler produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",