@uniai-fe/ui-legacy 0.1.27 → 0.1.28
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/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
FormProvider,
|
|
5
|
+
type FieldValues,
|
|
6
|
+
type UseFormReturn,
|
|
7
|
+
} from "react-hook-form";
|
|
4
8
|
|
|
5
9
|
export default function ModalFormProvider({
|
|
10
|
+
formMethods,
|
|
6
11
|
children,
|
|
7
12
|
}: {
|
|
13
|
+
formMethods: UseFormReturn<FieldValues>;
|
|
8
14
|
children: React.ReactNode;
|
|
9
15
|
}) {
|
|
10
|
-
const formMethods = useForm({ mode: "all" });
|
|
11
16
|
return <FormProvider {...formMethods}>{children}</FormProvider>;
|
|
12
17
|
}
|
|
@@ -7,7 +7,14 @@ import ModalFormProvider from "../form/Provider";
|
|
|
7
7
|
|
|
8
8
|
export default function ModalLayoutContainer({
|
|
9
9
|
stackKey,
|
|
10
|
-
modalProps: {
|
|
10
|
+
modalProps: {
|
|
11
|
+
data,
|
|
12
|
+
isModalForm,
|
|
13
|
+
formOptions,
|
|
14
|
+
formMethods,
|
|
15
|
+
isHeader,
|
|
16
|
+
isNoTitle,
|
|
17
|
+
},
|
|
11
18
|
isDraggable,
|
|
12
19
|
}: ModalComponentPropsType) {
|
|
13
20
|
const Layout = (
|
|
@@ -22,11 +29,11 @@ export default function ModalLayoutContainer({
|
|
|
22
29
|
isNoTitle={isNoTitle}
|
|
23
30
|
/>
|
|
24
31
|
)}
|
|
25
|
-
{isModalForm ? (
|
|
26
|
-
<
|
|
32
|
+
{isModalForm || formOptions ? (
|
|
33
|
+
<Form.Provider {...formOptions}>
|
|
27
34
|
<ModalBody body={data?.body} />
|
|
28
35
|
{data?.footerBtns && <ModalFooter btns={data.footerBtns} />}
|
|
29
|
-
</
|
|
36
|
+
</Form.Provider>
|
|
30
37
|
) : (
|
|
31
38
|
<>
|
|
32
39
|
<ModalBody body={data?.body} />
|
|
@@ -36,8 +43,8 @@ export default function ModalLayoutContainer({
|
|
|
36
43
|
</>
|
|
37
44
|
);
|
|
38
45
|
|
|
39
|
-
return typeof
|
|
40
|
-
<
|
|
46
|
+
return typeof formMethods !== "undefined" ? (
|
|
47
|
+
<ModalFormProvider formMethods={formMethods}>{Layout}</ModalFormProvider>
|
|
41
48
|
) : (
|
|
42
49
|
Layout
|
|
43
50
|
);
|
|
@@ -25,6 +25,7 @@ export default function ModalBasicContainer({
|
|
|
25
25
|
data,
|
|
26
26
|
isModalForm,
|
|
27
27
|
formOptions,
|
|
28
|
+
formMethods,
|
|
28
29
|
isNoTitle,
|
|
29
30
|
},
|
|
30
31
|
} = stackData;
|
|
@@ -40,7 +41,14 @@ export default function ModalBasicContainer({
|
|
|
40
41
|
>
|
|
41
42
|
<ModalLayoutContainer
|
|
42
43
|
stackKey={stackKey}
|
|
43
|
-
modalProps={{
|
|
44
|
+
modalProps={{
|
|
45
|
+
data,
|
|
46
|
+
isModalForm,
|
|
47
|
+
formOptions,
|
|
48
|
+
formMethods,
|
|
49
|
+
isHeader,
|
|
50
|
+
isNoTitle,
|
|
51
|
+
}}
|
|
44
52
|
/>
|
|
45
53
|
</StyledModalBasic.container>
|
|
46
54
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LinkProps } from "next/link";
|
|
2
2
|
import type { ButtonDefaultPropsType } from "../button";
|
|
3
|
+
import type { FieldValues } from "react-hook-form";
|
|
3
4
|
|
|
4
5
|
// 모달 활성화 타입
|
|
5
6
|
export type ModalShowType = "init" | boolean;
|
|
@@ -60,16 +61,21 @@ export type ModalPropsType = Partial<{
|
|
|
60
61
|
isFooter: boolean;
|
|
61
62
|
initDragPos: ModalPositionDataType;
|
|
62
63
|
/**
|
|
63
|
-
* @deprecated
|
|
64
|
+
* @deprecated formMethods를 활용할 것.
|
|
64
65
|
*/
|
|
65
66
|
isModalForm: boolean;
|
|
66
67
|
/**
|
|
67
68
|
* FormProvider 옵션
|
|
69
|
+
* @deprecated formMethods를 활용할 것.
|
|
68
70
|
*/
|
|
69
71
|
formOptions: Partial<{
|
|
70
72
|
options: UseFormProps<FormDataType>;
|
|
71
73
|
callback: (params: UseFormReturn<FormDataType>) => void | undefined;
|
|
72
74
|
}>;
|
|
75
|
+
/**
|
|
76
|
+
* modal context
|
|
77
|
+
*/
|
|
78
|
+
formMethods: UseFormReturn<FieldValues>;
|
|
73
79
|
role: string;
|
|
74
80
|
show: ModalShowType; // init: 최초 렌더링 시 / on: 활성화 / off: 비활성화
|
|
75
81
|
showDelay: number;
|