@ehfuse/forma 1.0.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/LICENSE +42 -0
- package/README.md +180 -0
- package/dist/contexts/GlobalFormContext.d.ts +66 -0
- package/dist/contexts/GlobalFormContext.d.ts.map +1 -0
- package/dist/contexts/GlobalFormContext.js +110 -0
- package/dist/contexts/GlobalFormContext.js.map +1 -0
- package/dist/core/FieldStore.d.ts +100 -0
- package/dist/core/FieldStore.d.ts.map +1 -0
- package/dist/core/FieldStore.js +264 -0
- package/dist/core/FieldStore.js.map +1 -0
- package/dist/core/index.d.ts +29 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +36 -0
- package/dist/core/index.js.map +1 -0
- package/dist/esm/contexts/GlobalFormContext.d.ts +66 -0
- package/dist/esm/contexts/GlobalFormContext.d.ts.map +1 -0
- package/dist/esm/contexts/GlobalFormContext.js +106 -0
- package/dist/esm/contexts/GlobalFormContext.js.map +1 -0
- package/dist/esm/core/FieldStore.d.ts +100 -0
- package/dist/esm/core/FieldStore.d.ts.map +1 -0
- package/dist/esm/core/FieldStore.js +260 -0
- package/dist/esm/core/FieldStore.js.map +1 -0
- package/dist/esm/core/index.d.ts +29 -0
- package/dist/esm/core/index.d.ts.map +1 -0
- package/dist/esm/core/index.js +32 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/hooks/useForm.d.ts +67 -0
- package/dist/esm/hooks/useForm.d.ts.map +1 -0
- package/dist/esm/hooks/useForm.js +287 -0
- package/dist/esm/hooks/useForm.js.map +1 -0
- package/dist/esm/hooks/useGlobalForm.d.ts +45 -0
- package/dist/esm/hooks/useGlobalForm.d.ts.map +1 -0
- package/dist/esm/hooks/useGlobalForm.js +61 -0
- package/dist/esm/hooks/useGlobalForm.js.map +1 -0
- package/dist/esm/hooks/useRegisterGlobalForm.d.ts +55 -0
- package/dist/esm/hooks/useRegisterGlobalForm.d.ts.map +1 -0
- package/dist/esm/hooks/useRegisterGlobalForm.js +64 -0
- package/dist/esm/hooks/useRegisterGlobalForm.js.map +1 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +62 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/form.d.ts +120 -0
- package/dist/esm/types/form.d.ts.map +1 -0
- package/dist/esm/types/form.js +29 -0
- package/dist/esm/types/form.js.map +1 -0
- package/dist/esm/types/globalForm.d.ts +265 -0
- package/dist/esm/types/globalForm.d.ts.map +1 -0
- package/dist/esm/types/globalForm.js +39 -0
- package/dist/esm/types/globalForm.js.map +1 -0
- package/dist/esm/types/index.d.ts +31 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +30 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/utils/dotNotation.d.ts +58 -0
- package/dist/esm/utils/dotNotation.d.ts.map +1 -0
- package/dist/esm/utils/dotNotation.js +100 -0
- package/dist/esm/utils/dotNotation.js.map +1 -0
- package/dist/esm/utils/index.d.ts +27 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +27 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/hooks/useForm.d.ts +67 -0
- package/dist/hooks/useForm.d.ts.map +1 -0
- package/dist/hooks/useForm.js +290 -0
- package/dist/hooks/useForm.js.map +1 -0
- package/dist/hooks/useGlobalForm.d.ts +45 -0
- package/dist/hooks/useGlobalForm.d.ts.map +1 -0
- package/dist/hooks/useGlobalForm.js +64 -0
- package/dist/hooks/useGlobalForm.js.map +1 -0
- package/dist/hooks/useRegisterGlobalForm.d.ts +55 -0
- package/dist/hooks/useRegisterGlobalForm.d.ts.map +1 -0
- package/dist/hooks/useRegisterGlobalForm.js +67 -0
- package/dist/hooks/useRegisterGlobalForm.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/types/form.d.ts +120 -0
- package/dist/types/form.d.ts.map +1 -0
- package/dist/types/form.js +30 -0
- package/dist/types/form.js.map +1 -0
- package/dist/types/globalForm.d.ts +265 -0
- package/dist/types/globalForm.d.ts.map +1 -0
- package/dist/types/globalForm.js +43 -0
- package/dist/types/globalForm.js.map +1 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +34 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/dotNotation.d.ts +58 -0
- package/dist/utils/dotNotation.d.ts.map +1 -0
- package/dist/utils/dotNotation.js +104 -0
- package/dist/utils/dotNotation.js.map +1 -0
- package/dist/utils/index.d.ts +27 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +32 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,yBAAyB;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,kCAAkC;AAClC,OAAO,EACH,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,8BAA8B,CAAC;AAEtC,2BAA2B;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,gCAAgC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA0BrE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,8CAA8C;IAC3D,MAAM,EAAE,+BAA+B;IACvC,KAAK,EAAE,kBAAkB;IACzB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE;QACN,4DAA4D;QAC5D,kDAAkD;QAClD,wCAAwC;QACxC,8BAA8B;QAC9B,6BAA6B;QAC7B,qCAAqC;KACxC;CACK,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* form.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 기본 폼 관련 타입 정의 | Basic form-related type definitions
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
import { FieldStore } from "../core/FieldStore";
|
|
29
|
+
type SelectChangeEvent<T = string> = {
|
|
30
|
+
target: {
|
|
31
|
+
name?: string;
|
|
32
|
+
value: T;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type PickerChangeHandlerContext<T> = any;
|
|
36
|
+
/**
|
|
37
|
+
* 폼 이벤트 타입 정의 | Form event type definitions
|
|
38
|
+
* MUI 컴포넌트들의 다양한 이벤트 타입을 통합 | Unified event types for various MUI components
|
|
39
|
+
*/
|
|
40
|
+
export type FormChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | SelectChangeEvent | SelectChangeEvent<string | number> | {
|
|
41
|
+
target: {
|
|
42
|
+
name: string;
|
|
43
|
+
value: any;
|
|
44
|
+
};
|
|
45
|
+
onChange?: (value: any, context: PickerChangeHandlerContext<any>) => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* DatePicker 전용 핸들러 타입
|
|
49
|
+
* MUI DatePicker 컴포넌트와의 통합을 위한 타입
|
|
50
|
+
*/
|
|
51
|
+
export type DatePickerChangeHandler = (fieldName: string) => (value: any, context?: PickerChangeHandlerContext<any>) => void;
|
|
52
|
+
/**
|
|
53
|
+
* useForm 훅의 Props 타입 | useForm hook Props type
|
|
54
|
+
*/
|
|
55
|
+
export interface UseFormProps<T extends Record<string, any>> {
|
|
56
|
+
/** 폼의 초기값 | Initial form values */
|
|
57
|
+
initialValues: T;
|
|
58
|
+
/** 폼 제출 핸들러 | Form submission handler */
|
|
59
|
+
onSubmit?: (values: T) => Promise<void> | void;
|
|
60
|
+
/** 폼 검증 핸들러 | Form validation handler */
|
|
61
|
+
onValidate?: (values: T) => Promise<boolean> | boolean;
|
|
62
|
+
/** 폼 제출 완료 후 콜백 | Callback after form submission completion */
|
|
63
|
+
onComplete?: (values: T) => void;
|
|
64
|
+
/** 내부 API - 전역 상태용 외부 스토어 | Internal API - external store for global state */
|
|
65
|
+
_externalStore?: FieldStore<T>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* useForm 훅의 반환 타입 | useForm hook return type
|
|
69
|
+
*/
|
|
70
|
+
export interface UseFormReturn<T extends Record<string, any>> {
|
|
71
|
+
/** 개별 필드 값 구독 함수 | Individual field value subscription function */
|
|
72
|
+
useFormValue: (fieldName: keyof T | string) => any;
|
|
73
|
+
/** 폼 변경 핸들러 (MUI 컴포넌트용) | Form change handler (for MUI components) */
|
|
74
|
+
handleFormChange: (event: FormChangeEvent) => void;
|
|
75
|
+
/** DatePicker 변경 핸들러 | DatePicker change handler */
|
|
76
|
+
handleDatePickerChange: DatePickerChangeHandler;
|
|
77
|
+
/** 모든 폼 값 가져오기 | Get all form values */
|
|
78
|
+
getFormValues: () => T;
|
|
79
|
+
/** 특정 필드 값 가져오기 | Get specific field value */
|
|
80
|
+
getFormValue: (fieldName: keyof T | string) => any;
|
|
81
|
+
/** 특정 필드 값 설정 | Set specific field value */
|
|
82
|
+
setFormValue: (fieldName: keyof T | string, value: any) => void;
|
|
83
|
+
/** 모든 폼 값 설정 | Set all form values */
|
|
84
|
+
setFormValues: (values: Partial<T>) => void;
|
|
85
|
+
/** 초기값 재설정 | Reset initial values */
|
|
86
|
+
setInitialFormValues: (newInitialValues: T) => void;
|
|
87
|
+
/** 폼 리셋 | Reset form */
|
|
88
|
+
resetForm: () => void;
|
|
89
|
+
/** 폼 제출 | Submit form */
|
|
90
|
+
submit: () => Promise<boolean>;
|
|
91
|
+
/** 폼 검증 | Validate form */
|
|
92
|
+
validateForm: () => Promise<boolean>;
|
|
93
|
+
/** 수정 여부 | Modified status */
|
|
94
|
+
isModified: boolean;
|
|
95
|
+
/** 제출 중 여부 | Submitting status */
|
|
96
|
+
isSubmitting: boolean;
|
|
97
|
+
/** 검증 중 여부 | Validating status */
|
|
98
|
+
isValidating: boolean;
|
|
99
|
+
/** 호환성을 위한 values 객체 (비권장) | Values object for compatibility (not recommended) */
|
|
100
|
+
values: T;
|
|
101
|
+
/** 내부 스토어 직접 접근 | Direct access to internal store */
|
|
102
|
+
_store: FieldStore<T>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 폼 상태 타입 | Form state type
|
|
106
|
+
*/
|
|
107
|
+
export type FormState = "idle" | "submitting" | "validating" | "error" | "success";
|
|
108
|
+
/**
|
|
109
|
+
* 폼 검증 결과 타입 | Form validation result type
|
|
110
|
+
*/
|
|
111
|
+
export interface FormValidationResult {
|
|
112
|
+
/** 검증 성공 여부 | Validation success status */
|
|
113
|
+
isValid: boolean;
|
|
114
|
+
/** 에러 메시지 (필드별) | Error messages (by field) */
|
|
115
|
+
errors?: Record<string, string>;
|
|
116
|
+
/** 전체 에러 메시지 | Overall error message */
|
|
117
|
+
message?: string;
|
|
118
|
+
}
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../types/form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,KAAK,iBAAiB,CAAC,CAAC,GAAG,MAAM,IAAI;IACjC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC;CACvC,CAAC;AACF,KAAK,0BAA0B,CAAC,CAAC,IAAI,GAAG,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,eAAe,GACrB,KAAK,CAAC,WAAW,CACb,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAC7D,GACD,iBAAiB,GACjB,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,GAClC;IACI,MAAM,EAAE;Q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+
* Forma - 기본 폼 관련 타입 정의 | Basic form-related type definitions
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../types/form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* globalForm.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 전역 폼 상태 관리 관련 TypeScript 타입 정의 | Global form state management related TypeScript type definitions
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
import { FieldStore } from "../core/FieldStore";
|
|
29
|
+
import { UseFormReturn } from "./form";
|
|
30
|
+
/**
|
|
31
|
+
* 전역 폼 컨텍스트 제공자의 Props 타입 | Props type for global form context provider
|
|
32
|
+
*/
|
|
33
|
+
export interface GlobalFormProviderProps {
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* useGlobalForm 훅의 Props 타입 | useGlobalForm hook Props type
|
|
38
|
+
* 글로벌 폼은 데이터 공유에만 집중 | Global form focuses only on data sharing
|
|
39
|
+
*/
|
|
40
|
+
export interface UseGlobalFormProps<T extends Record<string, any>> {
|
|
41
|
+
/** 전역에서 폼을 식별하는 고유 ID | Unique ID to identify form globally */
|
|
42
|
+
formId: string;
|
|
43
|
+
/** 컴포넌트 언마운트 시 자동 정리 여부 | Auto cleanup on component unmount */
|
|
44
|
+
autoCleanup?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* useGlobalForm 훅의 반환 타입 | useGlobalForm hook return type
|
|
48
|
+
* useForm의 모든 기능에 글로벌 폼 전용 기능 추가 | All useForm features plus global form specific features
|
|
49
|
+
*/
|
|
50
|
+
export interface UseGlobalFormReturn<T extends Record<string, any>> extends UseFormReturn<T> {
|
|
51
|
+
/** 글로벌 폼 ID | Global form ID */
|
|
52
|
+
formId: string;
|
|
53
|
+
/** 글로벌 스토어 직접 접근 | Direct access to global store */
|
|
54
|
+
_store: FieldStore<T>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 전역 폼 스토어 맵의 타입 | Type for global form store map
|
|
58
|
+
* Key: formId (string)
|
|
59
|
+
* Value: FieldStore 인스턴스
|
|
60
|
+
*/
|
|
61
|
+
export type GlobalFormStoreMap = Map<string, FieldStore<any>>;
|
|
62
|
+
/**
|
|
63
|
+
* 전역 폼 메타데이터
|
|
64
|
+
* 폼의 상태 정보를 추적하는데 사용
|
|
65
|
+
*/
|
|
66
|
+
export interface GlobalFormMetadata {
|
|
67
|
+
/** 폼 ID */
|
|
68
|
+
id: string;
|
|
69
|
+
/** 생성된 시간 */
|
|
70
|
+
createdAt: Date;
|
|
71
|
+
/** 마지막 수정 시간 */
|
|
72
|
+
lastModified: Date;
|
|
73
|
+
/** 현재 이 폼을 사용 중인 컴포넌트 수 */
|
|
74
|
+
activeComponents: number;
|
|
75
|
+
/** 자동 정리 설정 여부 */
|
|
76
|
+
autoCleanup: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 폼 생명주기 이벤트 타입
|
|
80
|
+
*/
|
|
81
|
+
export type GlobalFormLifecycleEvent = "created" | "accessed" | "modified" | "destroyed";
|
|
82
|
+
/**
|
|
83
|
+
* 폼 생명주기 이벤트 핸들러 타입
|
|
84
|
+
*/
|
|
85
|
+
export type GlobalFormLifecycleHandler = (formId: string, event: GlobalFormLifecycleEvent, metadata?: Partial<GlobalFormMetadata>) => void;
|
|
86
|
+
/**
|
|
87
|
+
* 전역 폼 설정 옵션
|
|
88
|
+
*/
|
|
89
|
+
export interface GlobalFormConfig {
|
|
90
|
+
/** 최대 동시 활성 폼 수 (기본값: 50) */
|
|
91
|
+
maxActiveForms?: number;
|
|
92
|
+
/** 자동 정리 활성화 여부 (기본값: true) */
|
|
93
|
+
enableAutoCleanup?: boolean;
|
|
94
|
+
/** 디버그 모드 활성화 여부 (기본값: development 환경에서만 true) */
|
|
95
|
+
debugMode?: boolean;
|
|
96
|
+
/** 생명주기 이벤트 핸들러 */
|
|
97
|
+
onLifecycleEvent?: GlobalFormLifecycleHandler;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 전역 폼 통계 정보
|
|
101
|
+
*/
|
|
102
|
+
export interface GlobalFormStats {
|
|
103
|
+
/** 현재 활성 폼 수 */
|
|
104
|
+
activeForms: number;
|
|
105
|
+
/** 지금까지 생성된 총 폼 수 */
|
|
106
|
+
totalFormsCreated: number;
|
|
107
|
+
/** 지금까지 정리된 총 폼 수 */
|
|
108
|
+
totalFormsDestroyed: number;
|
|
109
|
+
/** 메모리 사용량 (추정치) */
|
|
110
|
+
estimatedMemoryUsage: string;
|
|
111
|
+
/** 가장 오래된 폼의 생성 시간 */
|
|
112
|
+
oldestFormCreatedAt?: Date;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 전역 폼 훅의 반환 타입에서 추가된 속성들
|
|
116
|
+
*/
|
|
117
|
+
export interface GlobalFormExtensions {
|
|
118
|
+
/** 전역 폼 ID */
|
|
119
|
+
formId: string;
|
|
120
|
+
/** 전역 폼 상태 수동 정리 함수 */
|
|
121
|
+
clearGlobalForm: () => void;
|
|
122
|
+
/** 전역 폼 여부를 나타내는 플래그 */
|
|
123
|
+
isGlobalForm: true;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 폼이 전역 폼인지 구분하는 타입 가드용 인터페이스
|
|
127
|
+
*/
|
|
128
|
+
export interface GlobalFormIdentifier {
|
|
129
|
+
isGlobalForm: true;
|
|
130
|
+
formId: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 로컬 폼과 전역 폼을 구분하는 Union 타입
|
|
134
|
+
*/
|
|
135
|
+
export type FormType = "local" | "global";
|
|
136
|
+
/**
|
|
137
|
+
* 폼 사용량 추적을 위한 타입
|
|
138
|
+
*/
|
|
139
|
+
export interface FormUsageTracker {
|
|
140
|
+
/** 폼 ID */
|
|
141
|
+
formId: string;
|
|
142
|
+
/** 폼을 사용하는 컴포넌트들의 참조 */
|
|
143
|
+
componentRefs: Set<string>;
|
|
144
|
+
/** 마지막 접근 시간 */
|
|
145
|
+
lastAccessTime: Date;
|
|
146
|
+
/** 총 접근 횟수 */
|
|
147
|
+
accessCount: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 전역 폼 에러 타입
|
|
151
|
+
*/
|
|
152
|
+
export declare class GlobalFormError extends Error {
|
|
153
|
+
formId?: string | undefined;
|
|
154
|
+
operation?: string | undefined;
|
|
155
|
+
constructor(message: string, formId?: string | undefined, operation?: string | undefined);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 전역 폼 경고 타입
|
|
159
|
+
*/
|
|
160
|
+
export interface GlobalFormWarning {
|
|
161
|
+
type: "memory_usage" | "stale_form" | "excessive_forms" | "cleanup_failure";
|
|
162
|
+
message: string;
|
|
163
|
+
formId?: string;
|
|
164
|
+
severity: "low" | "medium" | "high";
|
|
165
|
+
timestamp: Date;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 전역 폼 디버그 정보
|
|
169
|
+
*/
|
|
170
|
+
export interface GlobalFormDebugInfo {
|
|
171
|
+
/** 모든 활성 폼의 메타데이터 */
|
|
172
|
+
activeForms: Record<string, GlobalFormMetadata>;
|
|
173
|
+
/** 성능 통계 */
|
|
174
|
+
stats: GlobalFormStats;
|
|
175
|
+
/** 최근 경고들 */
|
|
176
|
+
recentWarnings: GlobalFormWarning[];
|
|
177
|
+
/** 메모리 사용량 상세 정보 */
|
|
178
|
+
memoryBreakdown: {
|
|
179
|
+
formStores: number;
|
|
180
|
+
fieldValues: number;
|
|
181
|
+
listeners: number;
|
|
182
|
+
metadata: number;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 전역 폼 상태 스냅샷
|
|
187
|
+
* 디버깅이나 테스트 용도로 현재 상태를 캡처
|
|
188
|
+
*/
|
|
189
|
+
export interface GlobalFormSnapshot {
|
|
190
|
+
/** 스냅샷 생성 시간 */
|
|
191
|
+
timestamp: Date;
|
|
192
|
+
/** 모든 폼의 현재 값들 */
|
|
193
|
+
formValues: Record<string, any>;
|
|
194
|
+
/** 폼 메타데이터들 */
|
|
195
|
+
metadata: Record<string, GlobalFormMetadata>;
|
|
196
|
+
/** 스냅샷 생성 이유 */
|
|
197
|
+
reason: "manual" | "auto_cleanup" | "memory_limit" | "test";
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 개발 도구를 위한 전역 폼 인터페이스
|
|
201
|
+
* 브라우저 개발자 도구에서 전역 폼 상태를 검사할 때 사용
|
|
202
|
+
*/
|
|
203
|
+
export interface GlobalFormDevTools {
|
|
204
|
+
/** 현재 활성 폼 목록 조회 */
|
|
205
|
+
getActiveForms(): string[];
|
|
206
|
+
/** 특정 폼의 상세 정보 조회 */
|
|
207
|
+
getFormDetails(formId: string): GlobalFormMetadata | null;
|
|
208
|
+
/** 폼 값 조회 */
|
|
209
|
+
getFormValues(formId: string): any;
|
|
210
|
+
/** 폼 값 강제 설정 (디버깅용) */
|
|
211
|
+
setFormValues(formId: string, values: any): void;
|
|
212
|
+
/** 폼 강제 정리 */
|
|
213
|
+
destroyForm(formId: string): boolean;
|
|
214
|
+
/** 모든 폼 정리 */
|
|
215
|
+
destroyAllForms(): number;
|
|
216
|
+
/** 성능 통계 조회 */
|
|
217
|
+
getStats(): GlobalFormStats;
|
|
218
|
+
/** 디버그 정보 조회 */
|
|
219
|
+
getDebugInfo(): GlobalFormDebugInfo;
|
|
220
|
+
/** 상태 스냅샷 생성 */
|
|
221
|
+
createSnapshot(reason?: string): GlobalFormSnapshot;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 전역 폼 이벤트 타입
|
|
225
|
+
*/
|
|
226
|
+
export type GlobalFormEvent = {
|
|
227
|
+
type: GlobalFormLifecycleEvent;
|
|
228
|
+
formId: string;
|
|
229
|
+
timestamp: Date;
|
|
230
|
+
data?: any;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* 전역 폼 이벤트 리스너 타입
|
|
234
|
+
*/
|
|
235
|
+
export type GlobalFormEventListener = (event: GlobalFormEvent) => void;
|
|
236
|
+
/**
|
|
237
|
+
* 전역 폼 미들웨어 타입
|
|
238
|
+
* 폼 생명주기에 커스텀 로직을 추가할 때 사용
|
|
239
|
+
*/
|
|
240
|
+
export interface GlobalFormMiddleware {
|
|
241
|
+
name: string;
|
|
242
|
+
onFormCreate?: (formId: string, initialValues: any) => void;
|
|
243
|
+
onFormAccess?: (formId: string) => void;
|
|
244
|
+
onFormUpdate?: (formId: string, field: string, value: any) => void;
|
|
245
|
+
onFormDestroy?: (formId: string) => void;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 전역 폼 Provider에 확장된 Props
|
|
249
|
+
*/
|
|
250
|
+
export interface ExtendedGlobalFormProviderProps extends GlobalFormProviderProps {
|
|
251
|
+
/** 전역 폼 설정 */
|
|
252
|
+
config?: GlobalFormConfig;
|
|
253
|
+
/** 미들웨어 목록 */
|
|
254
|
+
middleware?: GlobalFormMiddleware[];
|
|
255
|
+
/** 개발 도구 활성화 여부 */
|
|
256
|
+
enableDevTools?: boolean;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 글로벌 폼 컨텍스트 타입 / Global form context type
|
|
260
|
+
*/
|
|
261
|
+
export interface GlobalFormContextType {
|
|
262
|
+
getOrCreateStore: <T extends Record<string, any>>(formId: string) => FieldStore<T>;
|
|
263
|
+
registerStore: <T extends Record<string, any>>(formId: string, store: FieldStore<T>) => void;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=globalForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalForm.d.ts","sourceRoot":"","sources":["../../../types/globalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC7D,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAC9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
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* globalForm.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 전역 폼 상태 관리 관련 TypeScript 타입 정의 | Global form state management related TypeScript type definitions
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 전역 폼 에러 타입
|
|
30
|
+
*/
|
|
31
|
+
export class GlobalFormError extends Error {
|
|
32
|
+
constructor(message, formId, operation) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.formId = formId;
|
|
35
|
+
this.operation = operation;
|
|
36
|
+
this.name = "GlobalFormError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=globalForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalForm.js","sourceRoot":"","sources":["../../../types/globalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAkJH;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,YACI,OAAe,EACR,MAAe,EACf,SAAkB;QAEzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,WAAM,GAAN,MAAM,CAAS;QACf,cAAS,GAAT,SAAS,CAAS;QAGzB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 타입 정의들 내보내기
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
export type { FormChangeEvent, DatePickerChangeHandler, UseFormProps, UseFormReturn, FormState, FormValidationResult, } from "./form";
|
|
29
|
+
export type { GlobalFormProviderProps, UseGlobalFormProps, GlobalFormStoreMap, GlobalFormMetadata, GlobalFormLifecycleEvent, GlobalFormLifecycleHandler, GlobalFormConfig, GlobalFormStats, GlobalFormExtensions, GlobalFormIdentifier, FormType, FormUsageTracker, GlobalFormWarning, GlobalFormDebugInfo, GlobalFormSnapshot, GlobalFormDevTools, GlobalFormEvent, GlobalFormEventListener, GlobalFormMiddleware, ExtendedGlobalFormProviderProps, } from "./globalForm";
|
|
30
|
+
export { GlobalFormError } from "./globalForm";
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,YAAY,EACR,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,oBAAoB,GACvB,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACR,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,+BAA+B,GAClC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 타입 정의들 내보내기
|
|
5
|
+
*
|
|
6
|
+
* @license MIT License
|
|
7
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
8
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
* in the Software without restriction, including without limitation the rights
|
|
13
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
* furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
* copies or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
* SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
// 에러 클래스
|
|
29
|
+
export { GlobalFormError } from "./globalForm";
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAoCH,SAAS;AACT,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dotNotation.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - Dot notation 관련 유틸리티 함수들 | Dot notation utility functions
|
|
5
|
+
* 중첩 객체의 값을 안전하게 가져오고 설정하는 기능 제공 | Provides safe getting and setting of nested object values
|
|
6
|
+
*
|
|
7
|
+
* @license MIT License
|
|
8
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
9
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
* in the Software without restriction, including without limitation the rights
|
|
14
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
* furnished to do so, subject to the following conditions:
|
|
17
|
+
*
|
|
18
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
* copies or substantial portions of the Software.
|
|
20
|
+
*
|
|
21
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
* SOFTWARE.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* dot notation으로 중첩 객체의 값을 가져오는 함수 | Function to get nested object values using dot notation
|
|
31
|
+
* @param obj 대상 객체 | Target object
|
|
32
|
+
* @param path dot notation 경로 (예: "user.profile.name") | Dot notation path (e.g., "user.profile.name")
|
|
33
|
+
* @returns 해당 경로의 값 또는 undefined | Value at the path or undefined
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const data = { user: { profile: { name: 'John' } } };
|
|
38
|
+
* const name = getNestedValue(data, 'user.profile.name'); // 'John'
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function getNestedValue(obj: any, path: string): any;
|
|
42
|
+
/**
|
|
43
|
+
* dot notation으로 중첩 객체의 값을 설정하는 함수 | Function to set nested object values using dot notation
|
|
44
|
+
* 불변성을 유지하면서 새로운 객체를 반환 | Returns a new object while maintaining immutability
|
|
45
|
+
* @param obj 대상 객체 | Target object
|
|
46
|
+
* @param path dot notation 경로 | Dot notation path
|
|
47
|
+
* @param value 설정할 값 | Value to set
|
|
48
|
+
* @returns 새로운 객체 | New object
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const data = { user: { profile: { name: 'John' } } };
|
|
53
|
+
* const newData = setNestedValue(data, 'user.profile.name', 'Jane');
|
|
54
|
+
* // { user: { profile: { name: 'Jane' } } }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function setNestedValue(obj: any, path: string, value: any): any;
|
|
58
|
+
//# sourceMappingURL=dotNotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotNotation.d.ts","sourceRoot":"","sources":["../../../utils/dotNotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAgB1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAqCtE"}
|