tp-react-elements-dev 1.4.4 → 1.4.7
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 +96 -46
- package/dist/components/Form/FormRender.d.ts +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3344 -1586
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3351 -1592
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,46 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
## How to use the Library
|
|
2
|
+
This Library is a reusable component gives intialvalues and validation schema for useForm and you can render Form Field Components without adding any text fields.
|
|
3
|
+
|
|
4
|
+
```js
|
|
5
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
6
|
+
import { useForm } from "react-hook-form";
|
|
7
|
+
import { RenderForm, useFormValidatingContext } from "tp-react-elements-dev";
|
|
8
|
+
import { FormSectionPropsItem } from "tp-react-elements-dev/dist/components/Form/FormRender";
|
|
9
|
+
const App = () => {
|
|
10
|
+
const formArray:FormSectionPropsItem[]= [
|
|
11
|
+
{
|
|
12
|
+
name: "userName",
|
|
13
|
+
label: "User Name",
|
|
14
|
+
inputType: "text",
|
|
15
|
+
required: true,
|
|
16
|
+
errorMessage: "Please enter",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "password",
|
|
20
|
+
label: "Password",
|
|
21
|
+
inputType: "number",
|
|
22
|
+
required: true,
|
|
23
|
+
errorMessage: "Please enter",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "date",
|
|
27
|
+
label: "Password",
|
|
28
|
+
inputType: "datepicker",
|
|
29
|
+
required: true,
|
|
30
|
+
errorMessage: "Please select message",
|
|
31
|
+
minDate:'30/06/2024',
|
|
32
|
+
maxDate:'22/07/2024'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "password1",
|
|
36
|
+
label: "Password New",
|
|
37
|
+
inputType: "password",
|
|
38
|
+
required: true,
|
|
39
|
+
errorMessage: "Please select message",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "daterange",
|
|
43
|
+
label: "Password",
|
|
44
|
+
required:true,
|
|
45
|
+
inputType: "multiselect",
|
|
46
|
+
options:[]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "daterangepicker",
|
|
50
|
+
label: "Date range Picker",
|
|
51
|
+
required:true,
|
|
52
|
+
inputType: "dateRangePicker",
|
|
53
|
+
monthSpan:1
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "status",
|
|
57
|
+
label: "sdf",
|
|
58
|
+
inputType: "toggleSwitch",
|
|
59
|
+
monthSpan:1
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "yearpicker",
|
|
63
|
+
label: "Year",
|
|
64
|
+
required:true,
|
|
65
|
+
inputType: "yearpicker",
|
|
66
|
+
monthSpan:1
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "monthpicker",
|
|
70
|
+
label: "Month Picker",
|
|
71
|
+
required:true,
|
|
72
|
+
inputType: "monthpicker",
|
|
73
|
+
monthSpan:1
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "file",
|
|
77
|
+
label: "File Upload",
|
|
78
|
+
required:true,
|
|
79
|
+
inputType: "file",
|
|
80
|
+
monthSpan:1
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
const { initialValues, validationSchema } = useFormValidatingContext(
|
|
84
|
+
formArray
|
|
85
|
+
);
|
|
86
|
+
const form=useForm({
|
|
87
|
+
defaultValues:initialValues,
|
|
88
|
+
resolver:yupResolver(validationSchema)
|
|
89
|
+
})
|
|
90
|
+
return (
|
|
91
|
+
<RenderForm formArray={formArray} name={"form1"} form={form} numberOfColumns={2} />
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default App
|
|
96
|
+
```
|
|
@@ -7,21 +7,23 @@ interface OptionsProps {
|
|
|
7
7
|
export interface FormSectionPropsItem {
|
|
8
8
|
name: string;
|
|
9
9
|
label: string;
|
|
10
|
-
inputType: "text" | "password" | "number" | "select" | "datepicker" | "multiselect" | "select-v2" | "register-number" | "decimal" | "alpha-numerical" | "yearpicker" | "dateRangePicker" | "monthpicker" | "multiselect" | "file" | "textarea" | "toggleSwitch";
|
|
10
|
+
inputType: "text" | "password" | "number" | "select" | "datepicker" | "multiselect" | "select-v2" | "register-number" | "decimal" | "alpha-numerical" | "yearpicker" | "dateRangePicker" | "monthpicker" | "multiselect" | "file" | "textarea" | "phoneNumber" | "pincode" | "email" | "toggleSwitch";
|
|
11
11
|
options?: OptionsProps[];
|
|
12
12
|
required?: boolean;
|
|
13
13
|
errorMessage?: string;
|
|
14
14
|
helperText?: string;
|
|
15
15
|
disable?: boolean;
|
|
16
16
|
onChangeFn?: (e: string | number | undefined | null | boolean) => void;
|
|
17
|
+
onBlurFn?: (e: string | number | undefined | null | boolean) => void;
|
|
17
18
|
maxLength?: number;
|
|
18
19
|
minDate?: string;
|
|
19
20
|
maxDate?: string;
|
|
20
21
|
placeholder?: string;
|
|
21
|
-
minRows?: string;
|
|
22
|
+
minRows?: string | number;
|
|
22
23
|
CustomProps?: string;
|
|
23
24
|
numberOfColumns?: number;
|
|
24
25
|
monthSpan?: number;
|
|
26
|
+
variant?: string;
|
|
25
27
|
}
|
|
26
28
|
export interface FormRenderProps {
|
|
27
29
|
item: FormSectionPropsItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { useForm as useFormElement } from "react-hook-form";
|
|
1
2
|
export { default as RenderForm } from "./components/Form/FormRenderWrapper";
|
|
2
3
|
export { default as useFormValidatingContext } from "./components/Form/FormConstants";
|
|
3
4
|
export { default as DeleteField } from "./components/DeleteComponent/DeleteField";
|
|
4
5
|
export { default as SessionTimeoutField } from "./components/SessionTimeOut/SessionTimeOut";
|
|
6
|
+
export { useFormElement };
|