@sutech_jp/datatraveler-react-client 0.1.33 → 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.
@@ -1,7 +1,7 @@
1
1
  import { VFC } from 'react';
2
2
  import { Session } from './types';
3
3
  import { ThemeOptions } from './types/theme';
4
- import { ComponentOptions } from './types/webform';
4
+ import { ComponentOptions, ExtensionSchemaDef } from './types/webform';
5
5
  declare type Props = {
6
6
  session: Session | undefined;
7
7
  width?: string | number;
@@ -9,6 +9,7 @@ declare type Props = {
9
9
  customStyles?: ThemeOptions;
10
10
  options?: ComponentOptions;
11
11
  dataIds: string[];
12
+ extensionSchemaDef?: ExtensionSchemaDef;
12
13
  handleCompleteInput?: (editId: string) => Promise<void>;
13
14
  handleBack?: () => void;
14
15
  };
@@ -41,7 +41,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
41
41
  var react_1 = require("react");
42
42
  var targetOrigin_1 = require("./util/targetOrigin");
43
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;
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, options = _a.options, dataIds = _a.dataIds, extensionSchemaDef = _a.extensionSchemaDef, 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;
@@ -76,6 +76,7 @@ var DataTravelerWebFormBulk = function (_a) {
76
76
  customStyles: customStyles,
77
77
  options: options,
78
78
  dataIds: dataIds,
79
+ extensionSchemaDef: extensionSchemaDef,
79
80
  });
80
81
  return [3 /*break*/, 4];
81
82
  case 1:
@@ -97,7 +98,18 @@ var DataTravelerWebFormBulk = function (_a) {
97
98
  case 4: return [2 /*return*/];
98
99
  }
99
100
  });
100
- }); }, [customStyles, handleCompleteInput, handleBack, options, sendMessage, session === null || session === void 0 ? void 0 : session.newUrl, width, height, dataIds]);
101
+ }); }, [
102
+ customStyles,
103
+ handleCompleteInput,
104
+ handleBack,
105
+ options,
106
+ sendMessage,
107
+ session === null || session === void 0 ? void 0 : session.newUrl,
108
+ width,
109
+ height,
110
+ dataIds,
111
+ extensionSchemaDef,
112
+ ]);
101
113
  (0, react_1.useEffect)(function () {
102
114
  window.addEventListener('message', handleMessage);
103
115
  return function () { return window.removeEventListener('message', handleMessage); };
@@ -7,3 +7,47 @@ export declare type ComponentOptions = {
7
7
  showOptionsMenu?: boolean;
8
8
  };
9
9
  };
10
+ export declare type ExtensionSchemaDef = {
11
+ container: ExtensionSchemaContainer;
12
+ properties: ExtensionSchemaProperty[];
13
+ };
14
+ export declare type ExtensionSchemaContainer = {
15
+ property: string;
16
+ caption: string;
17
+ };
18
+ export declare type ExtensionSchemaProperty = TextProperty | NumberProperty | DateProperty | DatetimeProperty | BooleanProperty;
19
+ export declare type PropertyBase = {
20
+ property: string;
21
+ caption: string;
22
+ required?: boolean;
23
+ };
24
+ export declare type TextProperty = {
25
+ type: 'text';
26
+ minLength?: number;
27
+ maxLength?: number;
28
+ } & PropertyBase;
29
+ export declare type NumberProperty = {
30
+ type: 'number';
31
+ min?: number;
32
+ max?: number;
33
+ minAcceptEqual?: boolean;
34
+ maxAcceptEqual?: boolean;
35
+ precision?: number;
36
+ } & PropertyBase;
37
+ export declare type DateProperty = {
38
+ type: 'date';
39
+ min?: Date;
40
+ max?: Date;
41
+ minAcceptEqual?: boolean;
42
+ maxAcceptEqual?: boolean;
43
+ } & PropertyBase;
44
+ export declare type DatetimeProperty = {
45
+ type: 'datetime';
46
+ min?: Date;
47
+ max?: Date;
48
+ minAcceptEqual?: boolean;
49
+ maxAcceptEqual?: boolean;
50
+ } & PropertyBase;
51
+ export declare type BooleanProperty = {
52
+ type: 'boolean';
53
+ } & PropertyBase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sutech_jp/datatraveler-react-client",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "react client for data traveler produced by SuTech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",