taskforge-forms 0.0.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/README.md +189 -0
- package/dist/excel/Options sheet.xlsx +0 -0
- package/dist/excel/list_sheet.xlsx +0 -0
- package/dist/excel/table_sheet.xlsx +0 -0
- package/dist/index.css +1 -0
- package/dist/place.png +0 -0
- package/dist/taskforge-forms.es.js +8253 -0
- package/dist/taskforge-forms.umd.js +60 -0
- package/dist/vite.svg +1 -0
- package/package.json +92 -0
- package/types/App.d.ts +3 -0
- package/types/assets/svgs/back.d.ts +1 -0
- package/types/assets/svgs/calendar.d.ts +1 -0
- package/types/assets/svgs/close.d.ts +1 -0
- package/types/components/ApiExample.d.ts +2 -0
- package/types/components/ColumnExample.d.ts +2 -0
- package/types/components/CustomSearchSelect.d.ts +14 -0
- package/types/components/CustomSelect.d.ts +23 -0
- package/types/components/CutomDatePicker.d.ts +16 -0
- package/types/components/DataTable/index.d.ts +22 -0
- package/types/components/DocumentSign.d.ts +2 -0
- package/types/components/FileReaderComponent.d.ts +8 -0
- package/types/components/ImageViewer.d.ts +4 -0
- package/types/components/Loader.d.ts +2 -0
- package/types/components/MultiSelectInput.d.ts +13 -0
- package/types/components/OptionsExample.d.ts +2 -0
- package/types/components/PhoneInput.d.ts +19 -0
- package/types/components/SearchSelect.d.ts +21 -0
- package/types/components/TableInputColumns.d.ts +1 -0
- package/types/components/TableInputElement.d.ts +6 -0
- package/types/components/UniversalFileViewer.d.ts +1 -0
- package/types/components/ValidateExample.d.ts +2 -0
- package/types/components/editor/bottom-bar.d.ts +5 -0
- package/types/components/editor/element-canvas.d.ts +17 -0
- package/types/components/editor/element-render.d.ts +3 -0
- package/types/components/editor/form-preview.d.ts +4 -0
- package/types/components/editor/index.d.ts +2 -0
- package/types/components/editor/layout.d.ts +16 -0
- package/types/components/editor/main.d.ts +5 -0
- package/types/components/editor/preview-modal.d.ts +9 -0
- package/types/components/editor/sidebar.d.ts +2 -0
- package/types/components/editor/topbar.d.ts +10 -0
- package/types/components/elements/amount-input.d.ts +4 -0
- package/types/components/elements/basic-text.d.ts +4 -0
- package/types/components/elements/cascade-dropdown.d.ts +25 -0
- package/types/components/elements/checkbox-input.d.ts +4 -0
- package/types/components/elements/country-bank.d.ts +6 -0
- package/types/components/elements/data-grid.d.ts +4 -0
- package/types/components/elements/date-input.d.ts +4 -0
- package/types/components/elements/divider.d.ts +3 -0
- package/types/components/elements/document-sign.d.ts +17 -0
- package/types/components/elements/element-container.d.ts +13 -0
- package/types/components/elements/element-editor.d.ts +8 -0
- package/types/components/elements/email-input.d.ts +4 -0
- package/types/components/elements/file-input.d.ts +4 -0
- package/types/components/elements/grid-input.d.ts +20 -0
- package/types/components/elements/header.d.ts +4 -0
- package/types/components/elements/link-element.d.ts +5 -0
- package/types/components/elements/long-text.d.ts +4 -0
- package/types/components/elements/matrix-input.d.ts +4 -0
- package/types/components/elements/multi-input-options.d.ts +13 -0
- package/types/components/elements/multi-input.d.ts +15 -0
- package/types/components/elements/multi-select-input.d.ts +5 -0
- package/types/components/elements/password-input.d.ts +4 -0
- package/types/components/elements/phone-input.d.ts +4 -0
- package/types/components/elements/radio-input.d.ts +4 -0
- package/types/components/elements/rating-input.d.ts +13 -0
- package/types/components/elements/section-editor.d.ts +7 -0
- package/types/components/elements/section-input.d.ts +4 -0
- package/types/components/elements/select-input.d.ts +4 -0
- package/types/components/elements/spacer.d.ts +3 -0
- package/types/components/elements/table-input.d.ts +4 -0
- package/types/components/elements/text-input.d.ts +5 -0
- package/types/components/elements/validate-input.d.ts +4 -0
- package/types/components/elements/visibility-editor.d.ts +1 -0
- package/types/components/forms/dynamic-input.d.ts +24 -0
- package/types/components/forms/file-uploader.d.ts +18 -0
- package/types/components/ui/AppButton.d.ts +18 -0
- package/types/components/ui/AppIcon.d.ts +5 -0
- package/types/components/ui/AppTab.d.ts +17 -0
- package/types/components/viewer/elements-render.d.ts +4 -0
- package/types/components/viewer/index.d.ts +21 -0
- package/types/components/viewer/multi-page.d.ts +5 -0
- package/types/components/viewer/single-page.d.ts +5 -0
- package/types/components/viewer/validation.d.ts +25 -0
- package/types/context/editor-context.d.ts +38 -0
- package/types/index.d.ts +3 -0
- package/types/main.d.ts +1 -0
- package/types/pages/builder/index.d.ts +3 -0
- package/types/pages/viewer/index.d.ts +16 -0
- package/types/utils/contants.d.ts +123 -0
- package/types/utils/getAllQuestions.d.ts +8 -0
- package/types/utils/isValidImage.d.ts +1 -0
- package/types/utils/localStorageControl.d.ts +4 -0
- package/types/utils/mapIdToValue.d.ts +1 -0
- package/types/utils/normalizeRows.d.ts +4 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface RatingProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
onChange?: (rating: number) => void;
|
|
7
|
+
size?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
element: any;
|
|
10
|
+
validationData: any;
|
|
11
|
+
}
|
|
12
|
+
declare const Rating: React.FC<RatingProps>;
|
|
13
|
+
export default Rating;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function VisibilityEditor({ register, setValue, trigger, watch, id, }: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UseFormRegister, FieldErrors } from "react-hook-form";
|
|
2
|
+
interface InputProps {
|
|
3
|
+
label: string;
|
|
4
|
+
name: string;
|
|
5
|
+
register?: UseFormRegister<any>;
|
|
6
|
+
errors?: FieldErrors;
|
|
7
|
+
element?: any;
|
|
8
|
+
type?: "text" | "checkbox" | "number" | "amount" | "textarea";
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
isFloating?: boolean;
|
|
12
|
+
setValue?: any;
|
|
13
|
+
value?: any;
|
|
14
|
+
trigger?: any;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
watch?: any;
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
description?: string;
|
|
21
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const DynamicInput: ({ label, name, register, errors, className, type, placeholder, isFloating, setValue, value, trigger, prefix, disabled, watch, min, max, description, onChange, }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type FileItem = {
|
|
2
|
+
base64: string;
|
|
3
|
+
type: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
interface FileUploadProps {
|
|
7
|
+
onFileLoaded: (data: FileItem[] | null) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
handleDeleteFile?: () => void;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
list?: FileItem[] | null;
|
|
12
|
+
accept?: {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
export default function FileUpload({ onFileLoaded, disabled, handleDeleteFile, multiple, list, accept, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ButtonProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
btnClass?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
iconPosition?: "left" | "right";
|
|
9
|
+
iconClass?: string;
|
|
10
|
+
loadingClass?: string;
|
|
11
|
+
link?: string;
|
|
12
|
+
div?: boolean;
|
|
13
|
+
type?: "button" | "submit" | "reset";
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
declare const Button: React.FC<ButtonProps>;
|
|
18
|
+
export default Button;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
interface Tab {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
interface TabsComponentProps {
|
|
7
|
+
tabs: Tab[];
|
|
8
|
+
className?: string;
|
|
9
|
+
count?: {
|
|
10
|
+
[key: string]: number;
|
|
11
|
+
};
|
|
12
|
+
setActiveTab: (key: string) => void;
|
|
13
|
+
activeTab: string;
|
|
14
|
+
btnClass?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const TabsComponent: FC<TabsComponentProps>;
|
|
17
|
+
export default TabsComponent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export interface AnswerElement {
|
|
3
|
+
id: string;
|
|
4
|
+
value: any;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export type RenderType = "multi" | "single";
|
|
8
|
+
export interface FormRendererProps {
|
|
9
|
+
form_data: any[];
|
|
10
|
+
answerData?: any[];
|
|
11
|
+
ignoreValidation?: boolean;
|
|
12
|
+
onSubmitData?: (data: any[]) => void;
|
|
13
|
+
onGetValues?: (data: any[]) => void;
|
|
14
|
+
isReadOnly?: boolean;
|
|
15
|
+
renderType?: RenderType;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
hideFooter?: boolean;
|
|
18
|
+
uploadUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: React.NamedExoticComponent<FormRendererProps>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as yup from "yup";
|
|
2
|
+
interface QuestionData {
|
|
3
|
+
id: string;
|
|
4
|
+
type: "textField" | "longText" | "numberField" | "amountField" | "selectField" | "checkbox" | "email" | "date" | "matrix" | "url";
|
|
5
|
+
isRequired?: boolean;
|
|
6
|
+
requiredMessage?: string;
|
|
7
|
+
minLength?: number;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minAmount?: number;
|
|
10
|
+
maxAmount?: number;
|
|
11
|
+
minLengthMessage?: string;
|
|
12
|
+
maxLengthMessage?: string;
|
|
13
|
+
minAmountMessage?: string;
|
|
14
|
+
maxAmountMessage?: string;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Section {
|
|
18
|
+
questionData: QuestionData[];
|
|
19
|
+
}
|
|
20
|
+
export declare function generateDynamicSchema(data: Section[]): yup.ObjectSchema<{
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
}, yup.AnyObject, {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}, "">;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface EditorProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const EditorContext: React.Context<{
|
|
6
|
+
showPreview: boolean;
|
|
7
|
+
setShowPreview: React.Dispatch<React.SetStateAction<boolean>>;
|
|
8
|
+
formData: any;
|
|
9
|
+
setFormData: React.Dispatch<React.SetStateAction<any>>;
|
|
10
|
+
handleDragStop: (e: any, elementId: string) => void;
|
|
11
|
+
removeElement: (elementId: string, sectionId: string) => void;
|
|
12
|
+
updateElementPosition: (updatedFormData: any[], sectionId: string) => void;
|
|
13
|
+
addElement: (element: any, sectionId: string) => void;
|
|
14
|
+
addElementInPosition: (element: any, sectionId: string, index: any) => void;
|
|
15
|
+
updateElement: (value: any, sectionId: string) => void;
|
|
16
|
+
updateSection: (value: any, sectionId: string) => void;
|
|
17
|
+
setIsDragging: (value: boolean) => void;
|
|
18
|
+
isDragging: boolean;
|
|
19
|
+
uploadUrl: string;
|
|
20
|
+
setUploadUrl: (e: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Universal element move:
|
|
23
|
+
* - canvas → canvas (reorder by index)
|
|
24
|
+
* - grid → canvas (eject; targetIndex = insertion point)
|
|
25
|
+
* - canvas → grid (inject into col; targetGridId + targetCol required)
|
|
26
|
+
* - grid → grid (transfer between cells)
|
|
27
|
+
*/
|
|
28
|
+
moveElement: (opts: {
|
|
29
|
+
draggedId: string;
|
|
30
|
+
sectionId: string;
|
|
31
|
+
targetIndex?: number;
|
|
32
|
+
targetId?: string;
|
|
33
|
+
targetGridId?: string;
|
|
34
|
+
targetCol?: number;
|
|
35
|
+
}) => void;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
38
|
+
export default EditorContext;
|
package/types/index.d.ts
ADDED
package/types/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BuilderProps } from "../../components/editor/layout";
|
|
2
|
+
declare const HomePage: ({ onSubmit, questionData, isReadOnly, config, title, loading, goBackUrl, onPublish, previewLoading, saveLoading, publishLoading, onTitleChange, uploadUrl, }: BuilderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default HomePage;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface RenderProps {
|
|
3
|
+
onSubmit?: (e: any) => void;
|
|
4
|
+
answerData?: any;
|
|
5
|
+
isReadOnly?: boolean;
|
|
6
|
+
form_data?: any;
|
|
7
|
+
ignoreValidation?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
config?: any;
|
|
10
|
+
renderType?: "multi" | "single";
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
hideFooter?: boolean;
|
|
13
|
+
onGetValues?: (e: any) => void;
|
|
14
|
+
uploadUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
export default function Viewer({ answerData, form_data, ignoreValidation, onSubmit, isReadOnly, loading, config, renderType, children, hideFooter, onGetValues, uploadUrl, }: RenderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export declare enum ElementKind {
|
|
2
|
+
BASIC_TEXT = "basicText",
|
|
3
|
+
TEXT = "textField",
|
|
4
|
+
LONG_TEXT = "longText",
|
|
5
|
+
SELECT = "selectField",
|
|
6
|
+
CASCADE_SELECT = "cascadeSelect",
|
|
7
|
+
MULTI_SELECT = "multiSelect",
|
|
8
|
+
VALIDATE_INPUT = "validateInput",
|
|
9
|
+
NUMBER = "numberField",
|
|
10
|
+
AMOUNT = "amountField",
|
|
11
|
+
DATE = "date",
|
|
12
|
+
URL = "url",
|
|
13
|
+
PASSWORD = "password",
|
|
14
|
+
CHECKBOX = "checkbox",
|
|
15
|
+
PHONE = "phoneField",
|
|
16
|
+
RADIO = "radio",
|
|
17
|
+
EMAIL = "email",
|
|
18
|
+
FILE = "file",
|
|
19
|
+
COUNTRY = "country",
|
|
20
|
+
RATING = "rating",
|
|
21
|
+
DATA_GRID = "dataGrid",
|
|
22
|
+
TABLE_INPUT = "tableInput",
|
|
23
|
+
DIVIDER = "divider",
|
|
24
|
+
SPACER = "spacer",
|
|
25
|
+
SECTION = "section",
|
|
26
|
+
GRID = "grid",
|
|
27
|
+
MATRIX = "matrix"
|
|
28
|
+
}
|
|
29
|
+
export interface DataColumnType {
|
|
30
|
+
field: string;
|
|
31
|
+
headerName: string;
|
|
32
|
+
width?: number;
|
|
33
|
+
editable?: boolean;
|
|
34
|
+
type?: string;
|
|
35
|
+
validate?: boolean;
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
38
|
+
export interface OptionType {
|
|
39
|
+
label: string;
|
|
40
|
+
value: any;
|
|
41
|
+
id: string;
|
|
42
|
+
key?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ElementType {
|
|
45
|
+
type: ElementKind;
|
|
46
|
+
label: string;
|
|
47
|
+
icon: string;
|
|
48
|
+
inputLabel: string;
|
|
49
|
+
inputType: string;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
value?: any;
|
|
54
|
+
maxLength?: number | null;
|
|
55
|
+
minLength?: number | null;
|
|
56
|
+
maxAmount?: number | null;
|
|
57
|
+
minAmount?: number | null;
|
|
58
|
+
isReadOnly?: boolean;
|
|
59
|
+
isDisabled?: boolean;
|
|
60
|
+
isRequired?: boolean;
|
|
61
|
+
requiredMessage?: string;
|
|
62
|
+
minLengthMessage?: string;
|
|
63
|
+
maxLengthMessage?: string;
|
|
64
|
+
minAmountMessage?: string;
|
|
65
|
+
maxAmountMessage?: string;
|
|
66
|
+
options?: OptionType[];
|
|
67
|
+
options1?: OptionType[];
|
|
68
|
+
options2?: OptionType[];
|
|
69
|
+
columns?: number;
|
|
70
|
+
dataColumns?: DataColumnType[];
|
|
71
|
+
prefix?: string | null;
|
|
72
|
+
inputMode?: string;
|
|
73
|
+
pattern?: string;
|
|
74
|
+
selectType?: string;
|
|
75
|
+
dateType?: string;
|
|
76
|
+
dateFormat?: string;
|
|
77
|
+
minDate?: string | null;
|
|
78
|
+
maxDate?: string | null;
|
|
79
|
+
canHaveDateRange?: boolean;
|
|
80
|
+
allowYearPicker?: boolean;
|
|
81
|
+
url?: string;
|
|
82
|
+
method?: string;
|
|
83
|
+
responseType?: string;
|
|
84
|
+
customClass?: string | null;
|
|
85
|
+
elementClass?: string;
|
|
86
|
+
gridPosition?: any;
|
|
87
|
+
gridId?: string | null;
|
|
88
|
+
isHidden: boolean;
|
|
89
|
+
visibilityDependentFields?: string;
|
|
90
|
+
visibilityDependentFieldsValue?: any;
|
|
91
|
+
isMultiple: boolean;
|
|
92
|
+
acceptedFiles: any[];
|
|
93
|
+
showState?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export declare const countryOptions: OptionType[];
|
|
96
|
+
export declare const Elements: ElementType[];
|
|
97
|
+
export declare const CategorizedElements: Readonly<{
|
|
98
|
+
textFields: ElementKind[];
|
|
99
|
+
selectionFields: ElementKind[];
|
|
100
|
+
dateAndTime: ElementKind[];
|
|
101
|
+
fileAndMedia: ElementKind[];
|
|
102
|
+
layoutAndDisplay: ElementKind[];
|
|
103
|
+
advancedData: ElementKind[];
|
|
104
|
+
}>;
|
|
105
|
+
export declare const dateFormats: {
|
|
106
|
+
label: string;
|
|
107
|
+
value: string;
|
|
108
|
+
}[];
|
|
109
|
+
export declare const AllowValidationPrefix: string[];
|
|
110
|
+
export declare const AllowValidationMaxMin: string[];
|
|
111
|
+
export declare const AllowValidationPlaceholder: string[];
|
|
112
|
+
export declare const AllowValidationAmount: string[];
|
|
113
|
+
export declare const noAllowValidation: string[];
|
|
114
|
+
export declare const AllowOptions: string[];
|
|
115
|
+
export declare const AllowApiOptions: string[];
|
|
116
|
+
export declare const AllowTableOptions: string[];
|
|
117
|
+
export declare const AllowTextOptions: string[];
|
|
118
|
+
export declare const noAllowEdit: string[];
|
|
119
|
+
export declare const allowValue: string[];
|
|
120
|
+
export declare const FileTypes: {
|
|
121
|
+
value: string;
|
|
122
|
+
label: string;
|
|
123
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isValidImage(value: any): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapIdToValue(answerData: any): any;
|