@ehfuse/forma 1.4.2 → 1.4.5
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/dist/contexts/{GlobalFormContext.d.ts → GlobalFormaContext.d.ts} +12 -12
- package/dist/contexts/GlobalFormaContext.d.ts.map +1 -0
- package/dist/contexts/{GlobalFormContext.js → GlobalFormaContext.js} +42 -16
- package/dist/contexts/GlobalFormaContext.js.map +1 -0
- package/dist/esm/contexts/{GlobalFormContext.d.ts → GlobalFormaContext.d.ts} +12 -12
- package/dist/esm/contexts/GlobalFormaContext.d.ts.map +1 -0
- package/dist/esm/contexts/{GlobalFormContext.js → GlobalFormaContext.js} +40 -14
- package/dist/esm/contexts/GlobalFormaContext.js.map +1 -0
- package/dist/esm/hooks/useForm.js +11 -2
- package/dist/esm/hooks/useForm.js.map +1 -1
- package/dist/esm/hooks/useFormaState.d.ts +2 -0
- package/dist/esm/hooks/useFormaState.d.ts.map +1 -1
- package/dist/esm/hooks/useFormaState.js +14 -15
- package/dist/esm/hooks/useFormaState.js.map +1 -1
- package/dist/esm/hooks/useGlobalForm.js +2 -2
- package/dist/esm/hooks/useGlobalForm.js.map +1 -1
- package/dist/esm/hooks/useGlobalFormaState.js +2 -2
- package/dist/esm/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/esm/hooks/useRegisterGlobalForm.js +2 -2
- package/dist/esm/hooks/useRegisterGlobalForm.js.map +1 -1
- package/dist/esm/hooks/useRegisterGlobalFormaState.d.ts +55 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.d.ts.map +1 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.js +64 -0
- package/dist/esm/hooks/useRegisterGlobalFormaState.js.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.d.ts +68 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.d.ts.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.js +88 -0
- package/dist/esm/hooks/useUnregisterGlobalForm.js.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.d.ts +69 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.d.ts.map +1 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.js +89 -0
- package/dist/esm/hooks/useUnregisterGlobalFormaState.js.map +1 -0
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/globalForm.d.ts +56 -7
- package/dist/esm/types/globalForm.d.ts.map +1 -1
- package/dist/esm/types/globalForm.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/hooks/useForm.js +10 -1
- package/dist/hooks/useForm.js.map +1 -1
- package/dist/hooks/useFormaState.d.ts +2 -0
- package/dist/hooks/useFormaState.d.ts.map +1 -1
- package/dist/hooks/useFormaState.js +14 -15
- package/dist/hooks/useFormaState.js.map +1 -1
- package/dist/hooks/useGlobalForm.js +2 -2
- package/dist/hooks/useGlobalForm.js.map +1 -1
- package/dist/hooks/useGlobalFormaState.js +2 -2
- package/dist/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/hooks/useRegisterGlobalForm.js +2 -2
- package/dist/hooks/useRegisterGlobalForm.js.map +1 -1
- package/dist/hooks/useRegisterGlobalFormaState.d.ts +55 -0
- package/dist/hooks/useRegisterGlobalFormaState.d.ts.map +1 -0
- package/dist/hooks/useRegisterGlobalFormaState.js +67 -0
- package/dist/hooks/useRegisterGlobalFormaState.js.map +1 -0
- package/dist/hooks/useUnregisterGlobalForm.d.ts +68 -0
- package/dist/hooks/useUnregisterGlobalForm.d.ts.map +1 -0
- package/dist/hooks/useUnregisterGlobalForm.js +91 -0
- package/dist/hooks/useUnregisterGlobalForm.js.map +1 -0
- package/dist/hooks/useUnregisterGlobalFormaState.d.ts +69 -0
- package/dist/hooks/useUnregisterGlobalFormaState.d.ts.map +1 -0
- package/dist/hooks/useUnregisterGlobalFormaState.js +92 -0
- package/dist/hooks/useUnregisterGlobalFormaState.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/types/globalForm.d.ts +56 -7
- package/dist/types/globalForm.d.ts.map +1 -1
- package/dist/types/globalForm.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/contexts/GlobalFormContext.d.ts.map +0 -1
- package/dist/contexts/GlobalFormContext.js.map +0 -1
- package/dist/esm/contexts/GlobalFormContext.d.ts.map +0 -1
- package/dist/esm/contexts/GlobalFormContext.js.map +0 -1
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
* SOFTWARE.
|
|
27
27
|
*/
|
|
28
28
|
export type { FormChangeEvent, DatePickerChangeHandler, UseFormProps, UseFormReturn, FormState, FormValidationResult, } from "./form";
|
|
29
|
-
export type {
|
|
29
|
+
export type { GlobalFormaProviderProps, UseGlobalFormProps, UseRegisterGlobalFormProps, UseRegisterGlobalFormReturn, UseRegisterGlobalFormaStateProps, UseRegisterGlobalFormaStateReturn, UseUnregisterGlobalFormReturn, UseUnregisterGlobalFormaStateReturn, GlobalFormStoreMap, GlobalFormMetadata, GlobalFormLifecycleEvent, GlobalFormLifecycleHandler, GlobalFormConfig, GlobalFormStats, GlobalFormExtensions, GlobalFormIdentifier, FormType, FormUsageTracker, GlobalFormWarning, GlobalFormDebugInfo, GlobalFormSnapshot, GlobalFormDevTools, GlobalFormEvent, GlobalFormEventListener, GlobalFormMiddleware, ExtendedGlobalFormaProviderProps, } from "./globalForm";
|
|
30
30
|
export { GlobalFormError } from "./globalForm";
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,gCAAgC,EAChC,iCAAiC,EACjC,6BAA6B,EAC7B,mCAAmC,EACnC,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,gCAAgC,GACnC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA0CH,SAAS;AACT,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/hooks/useForm.js
CHANGED
|
@@ -35,8 +35,16 @@ const utils_1 = require("../utils");
|
|
|
35
35
|
const react_1 = require("react");
|
|
36
36
|
function useForm(props = {}) {
|
|
37
37
|
const { initialValues = {}, onSubmit, onValidate, onComplete, _externalStore, } = props;
|
|
38
|
+
// 초기값 안정화: 첫 번째 렌더링에서만 초기값을 고정
|
|
39
|
+
// Stabilize initial values: fix initial values only on first render
|
|
40
|
+
const stableInitialValues = (0, react_1.useRef)(null);
|
|
41
|
+
if (!stableInitialValues.current) {
|
|
42
|
+
stableInitialValues.current = initialValues;
|
|
43
|
+
}
|
|
38
44
|
// useFormaState를 기반으로 사용 / Use useFormaState as foundation
|
|
39
|
-
const fieldState = (0, useFormaState_1.useFormaState)(
|
|
45
|
+
const fieldState = (0, useFormaState_1.useFormaState)(stableInitialValues.current, {
|
|
46
|
+
_externalStore,
|
|
47
|
+
});
|
|
40
48
|
// 폼 특정 상태 관리 / Form-specific state management
|
|
41
49
|
const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
|
|
42
50
|
const [isValidating, setIsValidating] = (0, react_1.useState)(false);
|
|
@@ -121,6 +129,7 @@ function useForm(props = {}) {
|
|
|
121
129
|
* 초기값 재설정 / Reset initial values
|
|
122
130
|
*/
|
|
123
131
|
const setInitialFormValues = (0, react_1.useCallback)((newInitialValues) => {
|
|
132
|
+
stableInitialValues.current = newInitialValues;
|
|
124
133
|
fieldState._store.setInitialValues(newInitialValues);
|
|
125
134
|
}, [fieldState._store]);
|
|
126
135
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../hooks/useForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAsDH,
|
|
1
|
+
{"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../hooks/useForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAsDH,0BA8RC;AA3UD,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uE;QACrF,aAAa,EAAE,oCAAoC;QAEnD,oBAAoB;QACpB,YAAY,EAAE,kCAAkC;QAChD,aAAa,EAAE,2BAA2B;QAC1C,oBAAoB,EAAE,iCAAiC;QAEvD,2BAA2B;QAC3B,gBAAgB,EAAE,2EAA2E;QAC7F,sBAAsB,EAAE,wDAAwD;QAEhF,sBAAsB;QACtB,MAAM,EAAE,qBAAqB;QAC7B,SAAS,EAAE,qBAAqB;QAChC,YAAY,EAAE,uBAAuB;QAErC,sBAAsB;QACtB,MAAM,EAAE,UAAU,CAAC,SAAS,EAAE,EAAE,8EAA8E;QAE9G,yBAAyB;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,qCAAqC;KACnE,CAAC,EACF;QACI,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,aAAa;QACb,oBAAoB;QACpB,gBAAgB;QAChB,sBAAsB;QACtB,MAAM;QACN,SAAS;QACT,YAAY;QACZ,UAAU,CAAC,MAAM,EAAE,iBAAiB;KACvC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -42,6 +42,8 @@ export interface UseFormaStateReturn<T extends Record<string, any>> {
|
|
|
42
42
|
setValues: (values: Partial<T>) => void;
|
|
43
43
|
/** Reset to initial values | 초기값으로 재설정 */
|
|
44
44
|
reset: () => void;
|
|
45
|
+
/** Set new initial values (for dynamic initialization) | 새 초기값 설정 (동적 초기화용) */
|
|
46
|
+
setInitialValues: (newInitialValues: T) => void;
|
|
45
47
|
/** Handle standard input change events | 표준 입력 변경 이벤트 처리 */
|
|
46
48
|
handleChange: (event: FormChangeEvent) => void;
|
|
47
49
|
/** Check if a field exists | 필드 존재 여부 확인 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormaState.d.ts","sourceRoot":"","sources":["../../hooks/useFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,M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AI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC,sEAAsE;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IAEhC,oDAAoD;IACpD,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IAEzD,sFAAsF;IACtF,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACzB;AA0BD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EACxC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EACtB,IAAI,EAAE,MAAM,GACb,CAAC,CAEH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,wBAAgB,aAAa,CACzB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrD,aAAa,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAGhF,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvD,aAAa,EAAE,CAAC,EAChB,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAClC,mBAAmB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -47,6 +47,12 @@ function useFieldSubscription(store, path) {
|
|
|
47
47
|
}
|
|
48
48
|
function useFormaState(initialValues = {}, options = {}) {
|
|
49
49
|
const { onChange, deepEquals = false, _externalStore } = options;
|
|
50
|
+
// 초기값 안정화: 첫 번째 렌더링에서만 초기값을 고정
|
|
51
|
+
// Stabilize initial values: fix initial values only on first render
|
|
52
|
+
const stableInitialValues = (0, react_1.useRef)(null);
|
|
53
|
+
if (!stableInitialValues.current) {
|
|
54
|
+
stableInitialValues.current = initialValues;
|
|
55
|
+
}
|
|
50
56
|
// Create or use external field store instance (persists across renders)
|
|
51
57
|
// 필드 스토어 인스턴스 생성 또는 외부 스토어 사용 (렌더링 간 유지)
|
|
52
58
|
const storeRef = (0, react_1.useRef)(null);
|
|
@@ -54,7 +60,7 @@ function useFormaState(initialValues = {}, options = {}) {
|
|
|
54
60
|
storeRef.current = _externalStore;
|
|
55
61
|
}
|
|
56
62
|
else if (!storeRef.current) {
|
|
57
|
-
storeRef.current = new FieldStore_1.FieldStore(
|
|
63
|
+
storeRef.current = new FieldStore_1.FieldStore(stableInitialValues.current);
|
|
58
64
|
// Set up global change listener if provided
|
|
59
65
|
// 글로벌 변경 리스너 설정 (제공된 경우)
|
|
60
66
|
if (onChange) {
|
|
@@ -64,20 +70,6 @@ function useFormaState(initialValues = {}, options = {}) {
|
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
const store = storeRef.current;
|
|
67
|
-
// Update initial values when they change (only for non-external stores)
|
|
68
|
-
// 초기값이 변경되면 업데이트 (외부 스토어가 아닌 경우에만)
|
|
69
|
-
const initialValuesRef = (0, react_1.useRef)(initialValues);
|
|
70
|
-
const initialValuesStringRef = (0, react_1.useRef)(JSON.stringify(initialValues));
|
|
71
|
-
(0, react_1.useEffect)(() => {
|
|
72
|
-
const currentInitialValuesString = JSON.stringify(initialValues);
|
|
73
|
-
if (!_externalStore &&
|
|
74
|
-
store &&
|
|
75
|
-
initialValuesStringRef.current !== currentInitialValuesString) {
|
|
76
|
-
store.setInitialValues(initialValues);
|
|
77
|
-
initialValuesRef.current = initialValues;
|
|
78
|
-
initialValuesStringRef.current = currentInitialValuesString;
|
|
79
|
-
}
|
|
80
|
-
}, [initialValues, _externalStore]); // store 의존성 제거
|
|
81
73
|
// Subscribe to a specific field value with dot notation
|
|
82
74
|
// dot notation으로 특정 필드 값 구독
|
|
83
75
|
const useValue = (0, react_1.useCallback)((path) => {
|
|
@@ -108,6 +100,12 @@ function useFormaState(initialValues = {}, options = {}) {
|
|
|
108
100
|
const reset = (0, react_1.useCallback)(() => {
|
|
109
101
|
store.reset();
|
|
110
102
|
}, []); // store 의존성 제거
|
|
103
|
+
// Set new initial values (for dynamic initialization)
|
|
104
|
+
// 새 초기값 설정 (동적 초기화용)
|
|
105
|
+
const setInitialValues = (0, react_1.useCallback)((newInitialValues) => {
|
|
106
|
+
stableInitialValues.current = newInitialValues;
|
|
107
|
+
store.setInitialValues(newInitialValues);
|
|
108
|
+
}, []); // store 의존성 제거
|
|
111
109
|
// Handle standard input change events
|
|
112
110
|
// 표준 입력 변경 이벤트 처리
|
|
113
111
|
const handleChange = (0, react_1.useCallback)((event) => {
|
|
@@ -142,6 +140,7 @@ function useFormaState(initialValues = {}, options = {}) {
|
|
|
142
140
|
getValues,
|
|
143
141
|
setValues,
|
|
144
142
|
reset,
|
|
143
|
+
setInitialValues,
|
|
145
144
|
handleChange,
|
|
146
145
|
hasField: (0, react_1.useCallback)((path) => {
|
|
147
146
|
return store.hasField(path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormaState.js","sourceRoot":"","sources":["../../hooks/useFormaState.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;
|
|
1
|
+
{"version":3,"file":"useFormaState.js","sourceRoot":"","sources":["../../hooks/useFormaState.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAyGH,oDAKC;AA4CD,sCAuJC;AA/SD,iCAA0E;AAC1E,mDAAgD;AAChD,oCAAmE;AAqEnE;;;;;;;GAOG;AACH,SAAS,aAAa,CAAI,KAAsB,EAAE,SAAiB;IAC/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,6BAA6B;QAC7B,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAA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O;QACH,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,SAAS;QACT,KAAK;QACL,gBAAgB;QAChB,YAAY;QACZ,QAAQ,EAAE,IAAA,mBAAW,EACjB,CAAC,IAAY,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,EACD,EAAE,CAAC,eAAe;SACrB;QACD,WAAW,EAAE,IAAA,mBAAW,EACpB,CAAC,IAAY,EAAE,EAAE;YACb,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,EACD,EAAE,CAAC,eAAe;SACrB;QACD,QAAQ,EAAE,IAAA,mBAAW,EACjB,CAAC,IAAY,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,EACD,EAAE,CAAC,eAAe;SACrB;QACD,SAAS,EAAE,IAAA,mBAAW,EAClB,CAAC,QAA6B,EAAE,EAAE;YAC9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC,EACD,EAAE,CAAC,eAAe;SACrB;QACD,MAAM,EAAE,KAAK;KAChB,CAAC;AACN,CAAC"}
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.useGlobalForm = useGlobalForm;
|
|
33
33
|
const react_1 = require("react");
|
|
34
34
|
const useForm_1 = require("./useForm");
|
|
35
|
-
const
|
|
35
|
+
const GlobalFormaContext_1 = require("../contexts/GlobalFormaContext");
|
|
36
36
|
/**
|
|
37
37
|
* 글로벌 폼 상태 관리 훅 / Global form state management hook
|
|
38
38
|
*
|
|
@@ -47,7 +47,7 @@ const GlobalFormContext_1 = require("../contexts/GlobalFormContext");
|
|
|
47
47
|
* @returns 글로벌 폼 관리 API 객체 / Global form management API object
|
|
48
48
|
*/
|
|
49
49
|
function useGlobalForm({ formId, }) {
|
|
50
|
-
const { getOrCreateStore } = (0, react_1.useContext)(
|
|
50
|
+
const { getOrCreateStore } = (0, react_1.useContext)(GlobalFormaContext_1.GlobalFormaContext);
|
|
51
51
|
// 글로벌 스토어 가져오기 또는 생성 / Get or create global store
|
|
52
52
|
const store = getOrCreateStore(formId);
|
|
53
53
|
// useForm에 외부 스토어 전달 (빈 초기값으로) / Pass external store to useForm (with empty initial values)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalForm.js","sourceRoot":"","sources":["../../hooks/useGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAoBH,sCAmBC;AArCD,iCAAmC;AACnC,uCAAoC;AAEpC,
|
|
1
|
+
{"version":3,"file":"useGlobalForm.js","sourceRoot":"","sources":["../../hooks/useGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAoBH,sCAmBC;AArCD,iCAAmC;AACnC,uCAAoC;AAEpC,uEAAoE;AAEpE;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAAgC,EACzD,MAAM,GACc;IACpB,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,kBAAU,EAAC,uCAAkB,CAAC,CAAC;IAE5D,kDAAkD;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAI,MAAM,CAAC,CAAC;IAE1C,4FAA4F;IAC5F,MAAM,IAAI,GAAG,IAAA,iBAAO,EAAI;QACpB,aAAa,EAAE,EAAO;QACtB,cAAc,EAAE,KAAK;KACxB,CAAC,CAAC;IAEH,OAAO;QACH,GAAG,IAAI;QACP,MAAM,EAAE,qDAAqD;QAC7D,MAAM,EAAE,KAAK,EAAE,iDAAiD;KACzC,CAAC;AAChC,CAAC"}
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.useGlobalFormaState = useGlobalFormaState;
|
|
33
33
|
const react_1 = require("react");
|
|
34
34
|
const useFormaState_1 = require("./useFormaState");
|
|
35
|
-
const
|
|
35
|
+
const GlobalFormaContext_1 = require("../contexts/GlobalFormaContext");
|
|
36
36
|
/**
|
|
37
37
|
* 글로벌 FormaState 관리 훅 / Global FormaState management hook
|
|
38
38
|
*
|
|
@@ -107,7 +107,7 @@ const GlobalFormContext_1 = require("../contexts/GlobalFormContext");
|
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
109
|
function useGlobalFormaState({ stateId, autoCleanup = true, }) {
|
|
110
|
-
const { getOrCreateStore } = (0, react_1.useContext)(
|
|
110
|
+
const { getOrCreateStore } = (0, react_1.useContext)(GlobalFormaContext_1.GlobalFormaContext);
|
|
111
111
|
// 글로벌 스토어 가져오기 또는 생성 / Get or create global store
|
|
112
112
|
const store = getOrCreateStore(stateId);
|
|
113
113
|
// useFormaState에 외부 스토어 전달 (빈 초기값으로) / Pass external store to useFormaState (with empty initial values)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalFormaState.js","sourceRoot":"","sources":["../../hooks/useGlobalFormaState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAmFH,kDAmBC;AApGD,iCAAmC;AACnC,mDAAgD;AAKhD,
|
|
1
|
+
{"version":3,"file":"useGlobalFormaState.js","sourceRoot":"","sources":["../../hooks/useGlobalFormaState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAmFH,kDAmBC;AApGD,iCAAmC;AACnC,mDAAgD;AAKhD,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,SAAgB,mBAAmB,CAAgC,EAC/D,OAAO,EACP,WAAW,GAAG,IAAI,GACQ;IAC1B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,kBAAU,EAAC,uCAAkB,CAAC,CAAC;IAE5D,kDAAkD;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAI,OAAO,CAAC,CAAC;IAE3C,wGAAwG;IACxG,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAI,EAAO,EAAE;QACzC,cAAc,EAAE,KAAK;KACxB,CAAC,CAAC;IAEH,OAAO;QACH,GAAG,UAAU;QACb,OAAO,EAAE,oEAAoE;QAC7E,MAAM,EAAE,KAAK,EAAE,gFAAgF;KAClE,CAAC;AACtC,CAAC"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.useRegisterGlobalForm = useRegisterGlobalForm;
|
|
33
33
|
const react_1 = require("react");
|
|
34
|
-
const
|
|
34
|
+
const GlobalFormaContext_1 = require("../contexts/GlobalFormaContext");
|
|
35
35
|
/**
|
|
36
36
|
* 기존 useForm을 글로벌 폼으로 등록하는 훅 | Hook to register existing useForm as global form
|
|
37
37
|
*
|
|
@@ -56,7 +56,7 @@ const GlobalFormContext_1 = require("../contexts/GlobalFormContext");
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
function useRegisterGlobalForm(formId, form) {
|
|
59
|
-
const { registerStore } = (0, react_1.useContext)(
|
|
59
|
+
const { registerStore } = (0, react_1.useContext)(GlobalFormaContext_1.GlobalFormaContext);
|
|
60
60
|
(0, react_1.useEffect)(() => {
|
|
61
61
|
// useForm의 내부 store를 글로벌에 등록 | Register useForm's internal store globally
|
|
62
62
|
if (form._store) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRegisterGlobalForm.js","sourceRoot":"","sources":["../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AA6BH,sDAYC;AAvCD,iCAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalForm.js","sourceRoot":"","sources":["../../hooks/useRegisterGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AA6BH,sDAYC;AAvCD,iCAA8C;AAE9C,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,qBAAqB,CACjC,MAAc,EACd,IAAsB;IAEtB,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,kBAAU,EAAC,uCAAkB,CAAC,CAAC;IAEzD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,0EAA0E;QAC1E,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRegisterGlobalFormaState.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
5
|
+
* 기존에 만든 로컬 FormaState를 글로벌 상태로 공유할 수 있게 해주는 유틸리티
|
|
6
|
+
* Utility to enable sharing existing local FormaState as global state
|
|
7
|
+
*
|
|
8
|
+
* @license MIT License
|
|
9
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
10
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
import { UseFormaStateReturn } from "./useFormaState";
|
|
31
|
+
/**
|
|
32
|
+
* 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
33
|
+
*
|
|
34
|
+
* 이미 만들어진 로컬 FormaState를 글로벌 상태로 공유하고 싶을 때 사용합니다.
|
|
35
|
+
* Use this when you want to share an already created local FormaState as global state.
|
|
36
|
+
*
|
|
37
|
+
* @template T FormaState 데이터의 타입 | FormaState data type
|
|
38
|
+
* @param stateId 글로벌 상태 식별자 | Global state identifier
|
|
39
|
+
* @param formaState 등록할 useFormaState 인스턴스 | useFormaState instance to register
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* function MyComponent() {
|
|
44
|
+
* const formaState = useFormaState({ name: '', email: '', settings: { theme: 'light' } });
|
|
45
|
+
*
|
|
46
|
+
* // 로컬 FormaState를 글로벌로 등록
|
|
47
|
+
* useRegisterGlobalFormaState('my-state-id', formaState);
|
|
48
|
+
*
|
|
49
|
+
* // 이제 다른 컴포넌트에서 useGlobalFormaState({ stateId: 'my-state-id' })로 접근 가능
|
|
50
|
+
* return <div>...</div>;
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function useRegisterGlobalFormaState<T extends Record<string, any>>(stateId: string, formaState: UseFormaStateReturn<T>): void;
|
|
55
|
+
//# sourceMappingURL=useRegisterGlobalFormaState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalFormaState.d.ts","sourceRoot":"","sources":["../../hooks/useRegisterGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrE,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACnC,IAAI,CASN"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* useRegisterGlobalFormaState.ts
|
|
4
|
+
*
|
|
5
|
+
* Forma - 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
6
|
+
* 기존에 만든 로컬 FormaState를 글로벌 상태로 공유할 수 있게 해주는 유틸리티
|
|
7
|
+
* Utility to enable sharing existing local FormaState as global state
|
|
8
|
+
*
|
|
9
|
+
* @license MIT License
|
|
10
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
11
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
* furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
* copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
* SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.useRegisterGlobalFormaState = useRegisterGlobalFormaState;
|
|
33
|
+
const react_1 = require("react");
|
|
34
|
+
const GlobalFormaContext_1 = require("../contexts/GlobalFormaContext");
|
|
35
|
+
/**
|
|
36
|
+
* 기존 useFormaState를 글로벌 상태로 등록하는 훅 | Hook to register existing useFormaState as global state
|
|
37
|
+
*
|
|
38
|
+
* 이미 만들어진 로컬 FormaState를 글로벌 상태로 공유하고 싶을 때 사용합니다.
|
|
39
|
+
* Use this when you want to share an already created local FormaState as global state.
|
|
40
|
+
*
|
|
41
|
+
* @template T FormaState 데이터의 타입 | FormaState data type
|
|
42
|
+
* @param stateId 글로벌 상태 식별자 | Global state identifier
|
|
43
|
+
* @param formaState 등록할 useFormaState 인스턴스 | useFormaState instance to register
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* function MyComponent() {
|
|
48
|
+
* const formaState = useFormaState({ name: '', email: '', settings: { theme: 'light' } });
|
|
49
|
+
*
|
|
50
|
+
* // 로컬 FormaState를 글로벌로 등록
|
|
51
|
+
* useRegisterGlobalFormaState('my-state-id', formaState);
|
|
52
|
+
*
|
|
53
|
+
* // 이제 다른 컴포넌트에서 useGlobalFormaState({ stateId: 'my-state-id' })로 접근 가능
|
|
54
|
+
* return <div>...</div>;
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function useRegisterGlobalFormaState(stateId, formaState) {
|
|
59
|
+
const { registerStore } = (0, react_1.useContext)(GlobalFormaContext_1.GlobalFormaContext);
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
// useFormaState의 내부 store를 글로벌에 등록 | Register useFormaState's internal store globally
|
|
62
|
+
if (formaState._store) {
|
|
63
|
+
registerStore(stateId, formaState._store);
|
|
64
|
+
}
|
|
65
|
+
}, [stateId, formaState._store, registerStore]);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=useRegisterGlobalFormaState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRegisterGlobalFormaState.js","sourceRoot":"","sources":["../../hooks/useRegisterGlobalFormaState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AA6BH,kEAYC;AAvCD,iCAA8C;AAE9C,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,2BAA2B,CACvC,OAAe,EACf,UAAkC;IAElC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,kBAAU,EAAC,uCAAkB,CAAC,CAAC;IAEzD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,sFAAsF;QACtF,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;YACpB,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useUnregisterGlobalForm.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 글로벌 폼 등록 해제 훅 | Hook to unregister global form
|
|
5
|
+
* 등록된 글로벌 폼을 메모리에서 제거하는 유틸리티
|
|
6
|
+
* Utility to remove registered global form from memory
|
|
7
|
+
*
|
|
8
|
+
* @license MIT License
|
|
9
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
10
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* 글로벌 폼 등록 해제 훅 | Hook to unregister global form
|
|
32
|
+
*
|
|
33
|
+
* 등록된 글로벌 폼을 메모리에서 제거합니다.
|
|
34
|
+
* Remove registered global form from memory.
|
|
35
|
+
*
|
|
36
|
+
* @returns 폼 등록 해제 함수들 | Form unregistration functions
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* function MyComponent() {
|
|
41
|
+
* const { unregisterForm, clearForms } = useUnregisterGlobalForm();
|
|
42
|
+
*
|
|
43
|
+
* const handleCleanup = () => {
|
|
44
|
+
* // 특정 폼 제거
|
|
45
|
+
* const success = unregisterForm('my-form-id');
|
|
46
|
+
* console.log(`Form unregistered: ${success}`);
|
|
47
|
+
* };
|
|
48
|
+
*
|
|
49
|
+
* const handleReset = () => {
|
|
50
|
+
* // 모든 폼 제거
|
|
51
|
+
* clearForms();
|
|
52
|
+
* console.log('All forms cleared');
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* return (
|
|
56
|
+
* <div>
|
|
57
|
+
* <button onClick={handleCleanup}>Remove Form</button>
|
|
58
|
+
* <button onClick={handleReset}>Clear All</button>
|
|
59
|
+
* </div>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function useUnregisterGlobalForm(): {
|
|
65
|
+
unregisterForm: (formId: string) => boolean;
|
|
66
|
+
clearForms: () => void;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=useUnregisterGlobalForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnregisterGlobalForm.d.ts","sourceRoot":"","sources":["../../hooks/useUnregisterGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB;6BASH,MAAM,KAAG,OAAO;sBAOzB,IAAI;EAQ9B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* useUnregisterGlobalForm.ts
|
|
4
|
+
*
|
|
5
|
+
* Forma - 글로벌 폼 등록 해제 훅 | Hook to unregister global form
|
|
6
|
+
* 등록된 글로벌 폼을 메모리에서 제거하는 유틸리티
|
|
7
|
+
* Utility to remove registered global form from memory
|
|
8
|
+
*
|
|
9
|
+
* @license MIT License
|
|
10
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
11
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
* furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
* copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
* SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.useUnregisterGlobalForm = useUnregisterGlobalForm;
|
|
33
|
+
const react_1 = require("react");
|
|
34
|
+
const GlobalFormaContext_1 = require("../contexts/GlobalFormaContext");
|
|
35
|
+
/**
|
|
36
|
+
* 글로벌 폼 등록 해제 훅 | Hook to unregister global form
|
|
37
|
+
*
|
|
38
|
+
* 등록된 글로벌 폼을 메모리에서 제거합니다.
|
|
39
|
+
* Remove registered global form from memory.
|
|
40
|
+
*
|
|
41
|
+
* @returns 폼 등록 해제 함수들 | Form unregistration functions
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* function MyComponent() {
|
|
46
|
+
* const { unregisterForm, clearForms } = useUnregisterGlobalForm();
|
|
47
|
+
*
|
|
48
|
+
* const handleCleanup = () => {
|
|
49
|
+
* // 특정 폼 제거
|
|
50
|
+
* const success = unregisterForm('my-form-id');
|
|
51
|
+
* console.log(`Form unregistered: ${success}`);
|
|
52
|
+
* };
|
|
53
|
+
*
|
|
54
|
+
* const handleReset = () => {
|
|
55
|
+
* // 모든 폼 제거
|
|
56
|
+
* clearForms();
|
|
57
|
+
* console.log('All forms cleared');
|
|
58
|
+
* };
|
|
59
|
+
*
|
|
60
|
+
* return (
|
|
61
|
+
* <div>
|
|
62
|
+
* <button onClick={handleCleanup}>Remove Form</button>
|
|
63
|
+
* <button onClick={handleReset}>Clear All</button>
|
|
64
|
+
* </div>
|
|
65
|
+
* );
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
function useUnregisterGlobalForm() {
|
|
70
|
+
const { unregisterStore, clearStores } = (0, react_1.useContext)(GlobalFormaContext_1.GlobalFormaContext);
|
|
71
|
+
/**
|
|
72
|
+
* 특정 formId의 글로벌 폼을 등록 해제합니다 | Unregister specific global form
|
|
73
|
+
*
|
|
74
|
+
* @param formId 제거할 폼 식별자 | Form identifier to remove
|
|
75
|
+
* @returns 제거 성공 여부 | Whether removal was successful
|
|
76
|
+
*/
|
|
77
|
+
const unregisterForm = (formId) => {
|
|
78
|
+
return unregisterStore(formId);
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* 모든 글로벌 폼을 제거합니다 | Clear all global forms
|
|
82
|
+
*/
|
|
83
|
+
const clearForms = () => {
|
|
84
|
+
clearStores();
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
unregisterForm,
|
|
88
|
+
clearForms,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=useUnregisterGlobalForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnregisterGlobalForm.js","sourceRoot":"","sources":["../../hooks/useUnregisterGlobalForm.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;AAuCH,0DAwBC;AA7DD,iCAAmC;AACnC,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,uBAAuB;IACnC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,EAAC,uCAAkB,CAAC,CAAC;IAExE;;;;;OAKG;IACH,MAAM,cAAc,GAAG,CAAC,MAAc,EAAW,EAAE;QAC/C,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF;;OAEG;IACH,MAAM,UAAU,GAAG,GAAS,EAAE;QAC1B,WAAW,EAAE,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO;QACH,cAAc;QACd,UAAU;KACb,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useUnregisterGlobalFormaState.ts
|
|
3
|
+
*
|
|
4
|
+
* Forma - 글로벌 FormaState 등록 해제 훅 | H /**
|
|
5
|
+
|
|
6
|
+
* 등록된 글로벌 FormaState를 메모리에서 제거하는 유틸리티
|
|
7
|
+
* Utility to remove registered global FormaState from memory
|
|
8
|
+
*
|
|
9
|
+
* @license MIT License
|
|
10
|
+
* @copyright 2025 KIM YOUNG JIN (Kim Young Jin)
|
|
11
|
+
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
* furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
* copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
* SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* 글로벌 FormaState 등록 해제 훅 | Hook to unregister global FormaState
|
|
33
|
+
*
|
|
34
|
+
* 등록된 글로벌 FormaState를 메모리에서 제거합니다.
|
|
35
|
+
* Remove registered global FormaState from memory.
|
|
36
|
+
*
|
|
37
|
+
* @returns FormaState 등록 해제 함수들 | FormaState unregistration functions
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* function MyComponent() {
|
|
42
|
+
* const { unregisterState, clearStates } = useUnregisterGlobalFormaState();
|
|
43
|
+
*
|
|
44
|
+
* const handleCleanup = () => {
|
|
45
|
+
* // 특정 상태 제거
|
|
46
|
+
* const success = unregisterState('my-state-id');
|
|
47
|
+
* console.log(`State unregistered: ${success}`);
|
|
48
|
+
* };
|
|
49
|
+
*
|
|
50
|
+
* const handleReset = () => {
|
|
51
|
+
* // 모든 상태 제거
|
|
52
|
+
* clearStates();
|
|
53
|
+
* console.log('All states cleared');
|
|
54
|
+
* };
|
|
55
|
+
*
|
|
56
|
+
* return (
|
|
57
|
+
* <div>
|
|
58
|
+
* <button onClick={handleCleanup}>Remove State</button>
|
|
59
|
+
* <button onClick={handleReset}>Clear All</button>
|
|
60
|
+
* </div>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function useUnregisterGlobalFormaState(): {
|
|
66
|
+
unregisterState: (stateId: string) => boolean;
|
|
67
|
+
clearStates: () => void;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=useUnregisterGlobalFormaState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnregisterGlobalFormaState.d.ts","sourceRoot":"","sources":["../../hooks/useUnregisterGlobalFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,6BAA6B;+BASP,MAAM,KAAG,OAAO;uBAO1B,IAAI;EAQ/B"}
|