@cfinnestad/react-form-builder 0.2.51 → 0.3.0
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.
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Builder/Builder.d.ts +1 -0
- package/dist/cjs/types/components/Editor/Editor.d.ts +14 -0
- package/dist/cjs/types/components/Editor/Editor.stories.d.ts +15 -0
- package/dist/cjs/types/components/Editor/index.d.ts +1 -0
- package/dist/cjs/types/components/Items/Items.d.ts +4 -4
- package/dist/cjs/types/components/Render/Render.d.ts +1 -0
- package/dist/esm/index.js +9 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Builder/Builder.d.ts +1 -0
- package/dist/esm/types/components/Editor/Editor.d.ts +14 -0
- package/dist/esm/types/components/Editor/Editor.stories.d.ts +15 -0
- package/dist/esm/types/components/Editor/index.d.ts +1 -0
- package/dist/esm/types/components/Items/Items.d.ts +4 -4
- package/dist/esm/types/components/Render/Render.d.ts +1 -0
- package/dist/index.d.ts +6 -4
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { AnyItem } from "../Items";
|
|
3
|
+
import { RenderOptions } from "../Render";
|
|
4
|
+
export type EditorProps = {
|
|
5
|
+
Data: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
Items: AnyItem[];
|
|
9
|
+
SetItems?: Dispatch<SetStateAction<AnyItem[]>>;
|
|
10
|
+
Options: RenderOptions;
|
|
11
|
+
};
|
|
12
|
+
declare const Editor: ({ Data, Items, SetItems, Options }: EditorProps) => React.JSX.Element;
|
|
13
|
+
export declare const setDefaults: (items: AnyItem[], data: object) => AnyItem[];
|
|
14
|
+
export default Editor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
import { TextSubtype } from "../Items";
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ Data, Items, SetItems, Options }: import("./Editor").EditorProps) => import("react").JSX.Element;
|
|
7
|
+
tags: string[];
|
|
8
|
+
argTypes: {
|
|
9
|
+
Items: TextSubtype[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Primary: Story;
|
|
15
|
+
export declare const EditorWithoutData: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Editor';
|
|
@@ -20,7 +20,7 @@ export type Options = {
|
|
|
20
20
|
SetItem: Dispatch<SetStateAction<AnyItem>>;
|
|
21
21
|
setItems: Dispatch<SetStateAction<AnyItem[]>>;
|
|
22
22
|
setModal?: Dispatch<SetStateAction<boolean>>;
|
|
23
|
-
|
|
23
|
+
Mode?: String;
|
|
24
24
|
getError: (error: string, item: AnyItem) => string | undefined;
|
|
25
25
|
searchableOptions?: {
|
|
26
26
|
[key: string]: (input?: string) => Promise<Option[]> | Option[];
|
|
@@ -111,6 +111,8 @@ export type HiddenItem = NamedItem & {
|
|
|
111
111
|
type: 'Hidden';
|
|
112
112
|
deprecated?: boolean;
|
|
113
113
|
value: string;
|
|
114
|
+
editable?: boolean;
|
|
115
|
+
backend_only?: boolean;
|
|
114
116
|
};
|
|
115
117
|
export type HTMLItem = BaseItem & {
|
|
116
118
|
type: 'HTML';
|
|
@@ -133,6 +135,7 @@ export type FieldItem = NamedItem & {
|
|
|
133
135
|
label?: string;
|
|
134
136
|
deprecated?: boolean;
|
|
135
137
|
backend_only?: boolean;
|
|
138
|
+
editable?: boolean;
|
|
136
139
|
helperText?: string;
|
|
137
140
|
subtype: string;
|
|
138
141
|
custom?: {
|
|
@@ -144,7 +147,6 @@ export type FieldItem = NamedItem & {
|
|
|
144
147
|
export type OptionSubtype = FieldItem & {
|
|
145
148
|
label: string;
|
|
146
149
|
value?: string | string[];
|
|
147
|
-
editable?: boolean;
|
|
148
150
|
searchableOptionsName?: string;
|
|
149
151
|
options: Option[];
|
|
150
152
|
};
|
|
@@ -181,7 +183,6 @@ export type TextSubtype = FieldItem & {
|
|
|
181
183
|
maxRows?: number;
|
|
182
184
|
minLength?: number;
|
|
183
185
|
maxLength?: number;
|
|
184
|
-
editable?: boolean;
|
|
185
186
|
};
|
|
186
187
|
export type EmailSubtype = FieldItem & {
|
|
187
188
|
label: string;
|
|
@@ -223,7 +224,6 @@ export type BooleanSubtype = FieldItem & {
|
|
|
223
224
|
subtype: 'Boolean';
|
|
224
225
|
description: string;
|
|
225
226
|
value?: boolean;
|
|
226
|
-
editable?: boolean;
|
|
227
227
|
};
|
|
228
228
|
export type AnyItem = BaseItem | FieldItem | GroupItem | HTMLItem | HiddenItem | SelectSubtype | RadioSubtype | CheckboxSubtype | TextSubtype | EmailSubtype | NumberSubtype | DateSubtype | BooleanSubtype | PhoneSubtype | AutocompleteSubtype;
|
|
229
229
|
export type ItemType = {
|
|
@@ -25,6 +25,7 @@ export type RenderOptions = {
|
|
|
25
25
|
custom?: {
|
|
26
26
|
[key: string]: any;
|
|
27
27
|
};
|
|
28
|
+
mode?: "build" | "edit" | "render";
|
|
28
29
|
};
|
|
29
30
|
declare const Render: ({ Items, SetItems, Options }: RenderProps) => JSX.Element;
|
|
30
31
|
export declare const RenderedObject: (items: AnyItem[]) => {};
|