graphql-form 0.0.21 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,4 @@
1
- /// <reference types="react" />
2
- import { WidgetType } from "./models";
3
- export declare function createWidget<Props>({ name, Component, Settings, Description, requirements, displayName }: WidgetType): {
4
- displayName: string | undefined;
5
- Component: import("react").FC<import("@/models").PassedFormProps<any>>;
6
- Settings: import("react").FC<import("@/models").CastToWidgetSettingsPassedForm<any>> | undefined;
7
- Description: import("react").FC<{}> | undefined;
8
- requirements: (props: import("./models").PassedFormProps<any>) => boolean;
1
+ import { WidgetProps } from "./models";
2
+ export declare function createWidget<Props>(params: WidgetProps<Props>): WidgetProps<Props> & {
9
3
  props: Props;
10
- name: string;
11
4
  };
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.createWidget = void 0;
4
- function createWidget(_a) {
5
- var name = _a.name, Component = _a.Component, Settings = _a.Settings, Description = _a.Description, requirements = _a.requirements, displayName = _a.displayName;
6
- return {
7
- displayName: displayName,
8
- Component: Component,
9
- Settings: Settings,
10
- Description: Description,
11
- requirements: requirements,
12
- props: {},
13
- name: name,
14
- };
15
+ function createWidget(params) {
16
+ return __assign(__assign({}, params), { props: {} });
15
17
  }
16
18
  exports.createWidget = createWidget;
17
19
  //# sourceMappingURL=createWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createWidget.js","sourceRoot":"","sources":["../src/createWidget.tsx"],"names":[],"mappings":";;;AAEA,SAAgB,YAAY,CAAQ,EAAiF;QAA/E,IAAI,UAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,WAAW,iBAAA,EAAE,YAAY,kBAAA,EAAE,WAAW,iBAAA;IACnG,OAAO;QACH,WAAW,aAAA;QACX,SAAS,WAAA;QACT,QAAQ,UAAA;QACR,WAAW,aAAA;QACX,YAAY,cAAA;QACZ,KAAK,EAAE,EAAW;QAClB,IAAI,MAAA;KACP,CAAC;AACN,CAAC;AAVD,oCAUC"}
1
+ {"version":3,"file":"createWidget.js","sourceRoot":"","sources":["../src/createWidget.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,SAAgB,YAAY,CAAQ,MAA0B;IAC1D,6BACO,MAAM,KACT,KAAK,EAAE,EAAW,IACpB;AACN,CAAC;AALD,oCAKC"}
package/lib/models.d.ts CHANGED
@@ -70,14 +70,15 @@ export declare type FormLibraryProps = Omit<FormDisplayerProps, 'required' | 'co
70
70
  export declare type CastToWidgetSettingsPassedForm<WidgetData = ReturnedDictType> = Partial<PassedFormProps<Partial<WidgetData>>> & {
71
71
  widgetSettingsChange: (data: WidgetData) => void;
72
72
  };
73
- export declare type WidgetType = {
74
- Component: React.FC<PassedFormProps>;
75
- Settings: React.FC<CastToWidgetSettingsPassedForm> | undefined;
73
+ export declare type WidgetProps<Props> = {
74
+ Component: React.FC<PassedFormProps<Props>>;
75
+ Settings?: React.FC<CastToWidgetSettingsPassedForm<Props>> | undefined;
76
76
  Description?: React.FC;
77
77
  requirements: (props: PassedFormProps) => boolean;
78
78
  displayName?: string;
79
79
  name: string;
80
80
  };
81
+ export declare type WidgetType = WidgetProps<ReturnedDictType>;
81
82
  export declare type FormValue = {
82
83
  value: FormValue;
83
84
  } | {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "graphql-form",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "description": "Easy form creation with GraphQL Editor and React",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "test": "jest",
8
8
  "test:watch": "jest --watch",
9
- "build": "ttsc --build tsconfig.build.json",
10
- "start": "ttsc --build tsconfig.build.json --watch",
9
+ "build": "tsc -p tsconfig.build.json",
10
+ "start": "tsc -p tsconfig.build.json --watch",
11
11
  "lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
12
12
  },
13
13
  "types": "lib/index.d.ts",
@@ -1,13 +1,8 @@
1
- import { WidgetType } from '@/models';
1
+ import { WidgetProps } from '@/models';
2
2
 
3
- export function createWidget<Props>({ name, Component, Settings, Description, requirements, displayName }: WidgetType) {
3
+ export function createWidget<Props>(params: WidgetProps<Props>): WidgetProps<Props> & { props: Props } {
4
4
  return {
5
- displayName,
6
- Component,
7
- Settings,
8
- Description,
9
- requirements,
5
+ ...params,
10
6
  props: {} as Props,
11
- name,
12
7
  };
13
8
  }
package/src/models.ts CHANGED
@@ -90,15 +90,17 @@ export type CastToWidgetSettingsPassedForm<WidgetData = ReturnedDictType> = Part
90
90
  widgetSettingsChange: (data: WidgetData) => void;
91
91
  };
92
92
 
93
- export type WidgetType = {
94
- Component: React.FC<PassedFormProps>;
95
- Settings: React.FC<CastToWidgetSettingsPassedForm> | undefined;
93
+ export type WidgetProps<Props> = {
94
+ Component: React.FC<PassedFormProps<Props>>;
95
+ Settings?: React.FC<CastToWidgetSettingsPassedForm<Props>> | undefined;
96
96
  Description?: React.FC;
97
97
  requirements: (props: PassedFormProps) => boolean;
98
98
  displayName?: string;
99
99
  name: string;
100
100
  };
101
101
 
102
+ export type WidgetType = WidgetProps<ReturnedDictType>;
103
+
102
104
  export type FormValue =
103
105
  | { value: FormValue }
104
106
  | {