@goldenpine/react-form-builder2 0.18.4-patch.1
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/LICENSE +7 -0
- package/README.md +250 -0
- package/dist/1.app.js +1 -0
- package/dist/app.css +38 -0
- package/dist/app.css.map +1 -0
- package/dist/app.js +71 -0
- package/lib/ItemTypes.js +11 -0
- package/lib/UUID.js +67 -0
- package/lib/dynamic-option-list.js +189 -0
- package/lib/fieldset/FieldSet.js +121 -0
- package/lib/fieldset/index.js +13 -0
- package/lib/form-dynamic-edit.js +57 -0
- package/lib/form-elements/component-drag-handle.js +91 -0
- package/lib/form-elements/component-drag-layer.js +69 -0
- package/lib/form-elements/component-drag-preview.js +61 -0
- package/lib/form-elements/component-header.js +30 -0
- package/lib/form-elements/component-label.js +30 -0
- package/lib/form-elements/custom-element.js +74 -0
- package/lib/form-elements/date-picker.js +185 -0
- package/lib/form-elements/header-bar.js +55 -0
- package/lib/form-elements/index.js +1144 -0
- package/lib/form-elements/myxss.js +30 -0
- package/lib/form-elements/star-rating.js +338 -0
- package/lib/form-elements-edit.js +740 -0
- package/lib/form-place-holder.js +52 -0
- package/lib/form-validator.js +104 -0
- package/lib/form.js +592 -0
- package/lib/functions/index.js +47 -0
- package/lib/index.js +142 -0
- package/lib/language-provider/IntlMessages.js +16 -0
- package/lib/language-provider/entries/en-us.js +17 -0
- package/lib/language-provider/entries/fa-ir.js +17 -0
- package/lib/language-provider/entries/it-it.js +17 -0
- package/lib/language-provider/entries/vi-vn.js +17 -0
- package/lib/language-provider/index.js +41 -0
- package/lib/language-provider/locales/en-us.json +117 -0
- package/lib/language-provider/locales/fa-ir.json +109 -0
- package/lib/language-provider/locales/it-it.json +109 -0
- package/lib/language-provider/locales/vi-vn.json +96 -0
- package/lib/multi-column/MultiColumnRow.js +137 -0
- package/lib/multi-column/dustbin.js +156 -0
- package/lib/multi-column/grip.js +52 -0
- package/lib/multi-column/index.js +24 -0
- package/lib/preview.js +392 -0
- package/lib/sortable-element.js +177 -0
- package/lib/sortable-form-elements.js +66 -0
- package/lib/stores/registry.js +42 -0
- package/lib/stores/requests.js +31 -0
- package/lib/stores/store.js +139 -0
- package/lib/toolbar-draggable-item.js +60 -0
- package/lib/toolbar-group-item.js +40 -0
- package/lib/toolbar.js +726 -0
- package/package.json +118 -0
- package/types/index.d.ts +184 -0
package/package.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goldenpine/react-form-builder2",
|
|
3
|
+
"version": "0.18.4-patch.1",
|
|
4
|
+
"description": "A complete form builder for react.",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/goldenpine/react-form-builder.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"lib",
|
|
17
|
+
"dist",
|
|
18
|
+
"types"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react",
|
|
22
|
+
"react-component",
|
|
23
|
+
"form",
|
|
24
|
+
"builder",
|
|
25
|
+
"ui",
|
|
26
|
+
"drag",
|
|
27
|
+
"drop"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=12.0.0"
|
|
31
|
+
},
|
|
32
|
+
"author": "Kiho Chang",
|
|
33
|
+
"contributors": [
|
|
34
|
+
{
|
|
35
|
+
"name": "Zach Robichaud",
|
|
36
|
+
"email": "zach2825@gmail.com",
|
|
37
|
+
"url": "https://turtlebytes.com"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"beedle": "^0.8.1",
|
|
42
|
+
"classnames": "^2.2.6",
|
|
43
|
+
"cors": "^2.8.5",
|
|
44
|
+
"date-fns": "^2.16.1",
|
|
45
|
+
"draft-js": "^0.11.7",
|
|
46
|
+
"draftjs-to-html": "^0.9.1",
|
|
47
|
+
"es6-promise": "^4.2.8",
|
|
48
|
+
"fbemitter": "^3.0.0",
|
|
49
|
+
"file-saver": "^2.0.5",
|
|
50
|
+
"immutability-helper": "^3.1.1",
|
|
51
|
+
"isomorphic-fetch": "^3.0.0",
|
|
52
|
+
"prop-types": "^15.7.2",
|
|
53
|
+
"react-bootstrap-slider": "^2.2.3",
|
|
54
|
+
"react-datepicker": "^3.4.1",
|
|
55
|
+
"react-dnd": "^11.1.3",
|
|
56
|
+
"react-dnd-html5-backend": "^11.1.3",
|
|
57
|
+
"react-draft-wysiwyg": "^1.14.7",
|
|
58
|
+
"react-intl": "^5.24.3",
|
|
59
|
+
"react-select": "^3.2.0",
|
|
60
|
+
"react-signature-canvas": "^1.0.3",
|
|
61
|
+
"react-textarea-autosize": "^7.1.2",
|
|
62
|
+
"xss": "^1.0.8"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"react": ">=16.8.6",
|
|
66
|
+
"react-dom": ">=16.8.6"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@babel/cli": "^7.26.4",
|
|
70
|
+
"@babel/core": "^7.12.10",
|
|
71
|
+
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
72
|
+
"@babel/plugin-proposal-json-strings": "^7.12.1",
|
|
73
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
74
|
+
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
75
|
+
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
76
|
+
"@babel/preset-env": "^7.12.11",
|
|
77
|
+
"@babel/preset-react": "^7.26.3",
|
|
78
|
+
"@babel/runtime-corejs2": "^7.12.5",
|
|
79
|
+
"add": "^2.0.6",
|
|
80
|
+
"babel-eslint": "^10.1.0",
|
|
81
|
+
"babel-loader": "^8.2.2",
|
|
82
|
+
"copyfiles": "^2.4.1",
|
|
83
|
+
"css-loader": "^3.6.0",
|
|
84
|
+
"ejs": "^2.7.4",
|
|
85
|
+
"eslint": "^6.8.0",
|
|
86
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
87
|
+
"eslint-plugin-import": "^2.22.1",
|
|
88
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
89
|
+
"eslint-plugin-react": "^7.22.0",
|
|
90
|
+
"express": "^4.17.1",
|
|
91
|
+
"multer": "^1.4.2",
|
|
92
|
+
"react": "^16.14.0",
|
|
93
|
+
"react-dom": "^16.14.0",
|
|
94
|
+
"rimraf": "^3.0.2",
|
|
95
|
+
"sass": "^1.52.3",
|
|
96
|
+
"sass-loader": "^10.0.0",
|
|
97
|
+
"style-loader": "^1.3.0",
|
|
98
|
+
"webpack": "^4.46.0",
|
|
99
|
+
"webpack-cli": "^3.3.12",
|
|
100
|
+
"webpack-dev-server": "^3.11.2"
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production --config webpack.production.config.js",
|
|
104
|
+
"build:dev": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode development",
|
|
105
|
+
"build:umd": "webpack --mode development --config webpack.production.config.js",
|
|
106
|
+
"build:style": "sass ./scss/application.scss dist/app.css --style compressed",
|
|
107
|
+
"build:lib": "npm run transpile && npm run build:style",
|
|
108
|
+
"build:dist": "npm run build && npm run copy:dist",
|
|
109
|
+
"clean": "rimraf dist",
|
|
110
|
+
"copy:dist": "copyfiles -f \"./dist/*\" \"./public/dist\"",
|
|
111
|
+
"prepublishOnly": "npm run clean && NODE_OPTIONS=--openssl-legacy-provider npm run build:lib && NODE_OPTIONS=--openssl-legacy-provider npm run build",
|
|
112
|
+
"watch": "webpack --watch",
|
|
113
|
+
"start": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --hot --mode development",
|
|
114
|
+
"serve:api": "node server/index.js",
|
|
115
|
+
"pretranspile": "rimraf lib",
|
|
116
|
+
"transpile": "babel --out-dir lib src --copy-files"
|
|
117
|
+
}
|
|
118
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/* eslint-disable max-classes-per-file */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
type BaseElement = {
|
|
5
|
+
id: string;
|
|
6
|
+
element:
|
|
7
|
+
| "Header Text"
|
|
8
|
+
| "Label"
|
|
9
|
+
| "Paragraph"
|
|
10
|
+
| "Line Break"
|
|
11
|
+
| "Dropdown"
|
|
12
|
+
| "Tags"
|
|
13
|
+
| "Checkboxes"
|
|
14
|
+
| "Multiple Choice"
|
|
15
|
+
| "Text Input"
|
|
16
|
+
| "Number Input"
|
|
17
|
+
| "Multi-line Input"
|
|
18
|
+
| "Two Column Row"
|
|
19
|
+
| "Three Column Row"
|
|
20
|
+
| "Multi Column Row"
|
|
21
|
+
| "Image"
|
|
22
|
+
| "Rating"
|
|
23
|
+
| "Date"
|
|
24
|
+
| "Signature"
|
|
25
|
+
| "Web site"
|
|
26
|
+
| "Fieldset"
|
|
27
|
+
| "File Attachment"
|
|
28
|
+
| "Range"
|
|
29
|
+
| "Camera";
|
|
30
|
+
showDescription?: boolean;
|
|
31
|
+
required: boolean;
|
|
32
|
+
canHaveAlternateForm: boolean;
|
|
33
|
+
canHaveDisplayHorizontal: boolean;
|
|
34
|
+
canHaveOptionCorrect: boolean;
|
|
35
|
+
canHaveOptionValue: boolean;
|
|
36
|
+
canHavePageBreakBefore: boolean;
|
|
37
|
+
canPopulateFromApi: boolean;
|
|
38
|
+
text: string;
|
|
39
|
+
};
|
|
40
|
+
export type StaticElement = {
|
|
41
|
+
bold: boolean;
|
|
42
|
+
content: string;
|
|
43
|
+
inline?: boolean;
|
|
44
|
+
italic: boolean;
|
|
45
|
+
static: true;
|
|
46
|
+
};
|
|
47
|
+
export type FormBuilderInput = {
|
|
48
|
+
canHaveAnswer?: true;
|
|
49
|
+
field_name: string;
|
|
50
|
+
label: string;
|
|
51
|
+
};
|
|
52
|
+
export type Option = {
|
|
53
|
+
key: string;
|
|
54
|
+
label?: string;
|
|
55
|
+
text: string;
|
|
56
|
+
value: string;
|
|
57
|
+
};
|
|
58
|
+
export type SelectableElement = {
|
|
59
|
+
options: Option[];
|
|
60
|
+
} & FormBuilderInput;
|
|
61
|
+
export type ImageElement = {
|
|
62
|
+
field_name: string;
|
|
63
|
+
src: string;
|
|
64
|
+
};
|
|
65
|
+
export type DateElement = {
|
|
66
|
+
dateFormat: string;
|
|
67
|
+
defaultToday: boolean;
|
|
68
|
+
readOnly: boolean;
|
|
69
|
+
showTimeSelect: boolean;
|
|
70
|
+
showTimeSelectOnly: boolean;
|
|
71
|
+
showTimeInput: boolean;
|
|
72
|
+
timeFormat: string;
|
|
73
|
+
} & FormBuilderInput;
|
|
74
|
+
export type RangeElement = {
|
|
75
|
+
max_label: string;
|
|
76
|
+
max_value: number;
|
|
77
|
+
min_label: string;
|
|
78
|
+
min_value: number;
|
|
79
|
+
} & FormBuilderInput;
|
|
80
|
+
export type FileElement = {
|
|
81
|
+
_href: string;
|
|
82
|
+
file_path: string;
|
|
83
|
+
field_name: string;
|
|
84
|
+
} & StaticElement;
|
|
85
|
+
export type WebsiteElement = {
|
|
86
|
+
href: string;
|
|
87
|
+
} & StaticElement;
|
|
88
|
+
export type SignatureElement = {
|
|
89
|
+
readOnly: boolean;
|
|
90
|
+
} & FormBuilderInput;
|
|
91
|
+
export type TaskData = BaseElement &
|
|
92
|
+
(| StaticElement
|
|
93
|
+
| FormBuilderInput
|
|
94
|
+
| SelectableElement
|
|
95
|
+
| ImageElement
|
|
96
|
+
| DateElement
|
|
97
|
+
| RangeElement
|
|
98
|
+
| WebsiteElement
|
|
99
|
+
| FileElement
|
|
100
|
+
| SignatureElement
|
|
101
|
+
// eslint-disable-next-line no-use-before-define
|
|
102
|
+
| FormBuilderLayout
|
|
103
|
+
);
|
|
104
|
+
export type FormBuilderLayout = {
|
|
105
|
+
isContainer: true;
|
|
106
|
+
childItems: TaskData[];
|
|
107
|
+
field_name: string;
|
|
108
|
+
};
|
|
109
|
+
export type FormBuilderPostData = {
|
|
110
|
+
task_data: TaskData[];
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type ToolbarItem = {
|
|
114
|
+
key: string;
|
|
115
|
+
name: string;
|
|
116
|
+
static: boolean;
|
|
117
|
+
icon: string;
|
|
118
|
+
content: string;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export interface FormBuilderProps {
|
|
122
|
+
toolbarItems?: ToolbarItem[];
|
|
123
|
+
files?: any[];
|
|
124
|
+
locale?: string;
|
|
125
|
+
url?: string;
|
|
126
|
+
showCorrectColumn?: boolean;
|
|
127
|
+
show_description?: boolean;
|
|
128
|
+
onLoad?: () => Promise<FormBuilderPostData>;
|
|
129
|
+
onPost?: (data: FormBuilderPostData) => void;
|
|
130
|
+
saveUrl?: string;
|
|
131
|
+
saveAlways?: boolean;
|
|
132
|
+
editMode?: boolean;
|
|
133
|
+
renderEditForm?: (props: BaseElement) => React.ReactNode;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export class ReactFormBuilder extends React.Component<FormBuilderProps> {}
|
|
137
|
+
|
|
138
|
+
export interface FormGeneratorOnSubmitParams {
|
|
139
|
+
id: number;
|
|
140
|
+
name: string;
|
|
141
|
+
custom_name: string;
|
|
142
|
+
value: string | string[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface FormGeneratorProps {
|
|
146
|
+
form_action: string;
|
|
147
|
+
form_method: string;
|
|
148
|
+
action_name?: string;
|
|
149
|
+
onBlur?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
150
|
+
onSubmit?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
151
|
+
onChange?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
152
|
+
data: any[];
|
|
153
|
+
back_action?: string;
|
|
154
|
+
back_name?: string;
|
|
155
|
+
locale?: string;
|
|
156
|
+
task_id?: number;
|
|
157
|
+
answer_data?: any[];
|
|
158
|
+
authenticity_token?: string;
|
|
159
|
+
hide_actions?: boolean;
|
|
160
|
+
skip_validations?: boolean;
|
|
161
|
+
option_key_value?: 'key' | 'value';
|
|
162
|
+
download_path?: string;
|
|
163
|
+
display_short?: boolean;
|
|
164
|
+
read_only?: boolean;
|
|
165
|
+
// eslint-disable-next-line no-undef
|
|
166
|
+
variables?: Record<any, any>;
|
|
167
|
+
submitButton?: JSX.Element;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export class ReactFormGenerator extends React.Component<FormGeneratorProps> {}
|
|
171
|
+
|
|
172
|
+
export type ActionType = "load" | "updateOrder" | "delete";
|
|
173
|
+
|
|
174
|
+
export class ElementStore {
|
|
175
|
+
static dispatch: (type: ActionType, data: any) => void;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export class Registry {
|
|
179
|
+
static register: (name: string, component: React.ReactNode) => void;
|
|
180
|
+
|
|
181
|
+
static list: () => string[];
|
|
182
|
+
|
|
183
|
+
static get: (name: string) => React.ReactNode;
|
|
184
|
+
}
|