@ehfuse/forma 1.4.6 → 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/dist/contexts/GlobalFormaContext.d.ts.map +1 -1
- package/dist/contexts/GlobalFormaContext.js +134 -1
- package/dist/contexts/GlobalFormaContext.js.map +1 -1
- package/dist/esm/contexts/GlobalFormaContext.d.ts.map +1 -1
- package/dist/esm/contexts/GlobalFormaContext.js +134 -1
- package/dist/esm/contexts/GlobalFormaContext.js.map +1 -1
- package/dist/esm/hooks/useFormaState.d.ts.map +1 -1
- package/dist/esm/hooks/useFormaState.js +26 -12
- package/dist/esm/hooks/useFormaState.js.map +1 -1
- package/dist/esm/hooks/useGlobalForm.d.ts +1 -1
- package/dist/esm/hooks/useGlobalForm.d.ts.map +1 -1
- package/dist/esm/hooks/useGlobalForm.js +50 -5
- package/dist/esm/hooks/useGlobalForm.js.map +1 -1
- package/dist/esm/hooks/useGlobalFormaState.d.ts +1 -1
- package/dist/esm/hooks/useGlobalFormaState.d.ts.map +1 -1
- package/dist/esm/hooks/useGlobalFormaState.js +60 -5
- package/dist/esm/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/esm/types/globalForm.d.ts +10 -0
- package/dist/esm/types/globalForm.d.ts.map +1 -1
- package/dist/esm/types/globalForm.js.map +1 -1
- package/dist/hooks/useFormaState.d.ts.map +1 -1
- package/dist/hooks/useFormaState.js +25 -11
- package/dist/hooks/useFormaState.js.map +1 -1
- package/dist/hooks/useGlobalForm.d.ts +1 -1
- package/dist/hooks/useGlobalForm.d.ts.map +1 -1
- package/dist/hooks/useGlobalForm.js +49 -4
- package/dist/hooks/useGlobalForm.js.map +1 -1
- package/dist/hooks/useGlobalFormaState.d.ts +1 -1
- package/dist/hooks/useGlobalFormaState.d.ts.map +1 -1
- package/dist/hooks/useGlobalFormaState.js +59 -4
- package/dist/hooks/useGlobalFormaState.js.map +1 -1
- package/dist/types/globalForm.d.ts +10 -0
- package/dist/types/globalForm.d.ts.map +1 -1
- package/dist/types/globalForm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalFormaContext.d.ts","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.d.ts","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,iDAoC7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAwOxE"}
|
|
@@ -49,6 +49,15 @@ exports.GlobalFormaContext = (0, react_1.createContext)({
|
|
|
49
49
|
clearStores: () => {
|
|
50
50
|
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
51
51
|
},
|
|
52
|
+
incrementRef: () => {
|
|
53
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
54
|
+
},
|
|
55
|
+
decrementRef: () => {
|
|
56
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
57
|
+
},
|
|
58
|
+
validateAndStoreAutoCleanupSetting: () => {
|
|
59
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
60
|
+
},
|
|
52
61
|
});
|
|
53
62
|
/**
|
|
54
63
|
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
@@ -81,6 +90,12 @@ exports.GlobalFormaContext = (0, react_1.createContext)({
|
|
|
81
90
|
function GlobalFormaProvider({ children }) {
|
|
82
91
|
// formId별 FieldStore 인스턴스들을 관리하는 Map | Map managing FieldStore instances by formId
|
|
83
92
|
const storesRef = (0, react_1.useRef)(new Map());
|
|
93
|
+
// formId별 참조 카운트를 관리하는 Map | Map managing reference count by formId
|
|
94
|
+
const refCountsRef = (0, react_1.useRef)(new Map());
|
|
95
|
+
// formId별 autoCleanup 컴포넌트 참조 카운트를 관리하는 Map | Map managing autoCleanup component reference count by formId
|
|
96
|
+
const autoCleanupRefCountsRef = (0, react_1.useRef)(new Map());
|
|
97
|
+
// formId별 autoCleanup 설정을 추적하는 Map | Map tracking autoCleanup settings by formId
|
|
98
|
+
const autoCleanupSettingsRef = (0, react_1.useRef)(new Map());
|
|
84
99
|
/**
|
|
85
100
|
* formId에 해당하는 FieldStore를 가져오거나 새로 생성합니다. | Get or create FieldStore for the given formId.
|
|
86
101
|
*
|
|
@@ -91,12 +106,30 @@ function GlobalFormaProvider({ children }) {
|
|
|
91
106
|
const stores = storesRef.current;
|
|
92
107
|
if (!stores.has(formId)) {
|
|
93
108
|
// 새로운 스토어를 빈 객체로 생성 | Create new store with empty object
|
|
109
|
+
console.log(`Creating NEW store for formId: ${formId}`);
|
|
94
110
|
const newStore = new FieldStore_1.FieldStore({});
|
|
95
111
|
stores.set(formId, newStore);
|
|
96
112
|
return newStore;
|
|
97
113
|
}
|
|
114
|
+
console.log(`Using EXISTING store for formId: ${formId}`);
|
|
98
115
|
return stores.get(formId);
|
|
99
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* autoCleanup 설정의 일관성을 검증하고 설정을 저장합니다. | Validate and store autoCleanup setting consistency.
|
|
119
|
+
*
|
|
120
|
+
* @param formId 폼 식별자 | Form identifier
|
|
121
|
+
* @param autoCleanup 현재 autoCleanup 설정 | Current autoCleanup setting
|
|
122
|
+
*/
|
|
123
|
+
const validateAndStoreAutoCleanupSetting = (formId, autoCleanup) => {
|
|
124
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
125
|
+
const existingSetting = autoCleanupSettings.get(formId);
|
|
126
|
+
if (existingSetting !== undefined && existingSetting !== autoCleanup) {
|
|
127
|
+
console.warn(`⚠️ Conflicting autoCleanup settings for stateId "${formId}": ` +
|
|
128
|
+
`existing=${existingSetting}, new=${autoCleanup}. ` +
|
|
129
|
+
`All components using the same stateId should have consistent autoCleanup settings.`);
|
|
130
|
+
}
|
|
131
|
+
autoCleanupSettings.set(formId, autoCleanup);
|
|
132
|
+
};
|
|
100
133
|
/**
|
|
101
134
|
* 기존 FieldStore를 글로벌 폼에 등록합니다. | Register existing FieldStore to global form.
|
|
102
135
|
*
|
|
@@ -109,13 +142,27 @@ function GlobalFormaProvider({ children }) {
|
|
|
109
142
|
};
|
|
110
143
|
/**
|
|
111
144
|
* 글로벌 스토어에서 특정 formId의 FieldStore를 제거합니다. | Remove specific FieldStore from global store.
|
|
145
|
+
* 참조 카운트를 무시하고 강제로 제거합니다. | Force remove ignoring reference count.
|
|
112
146
|
*
|
|
113
147
|
* @param formId 제거할 폼 식별자 | Form identifier to remove
|
|
114
148
|
* @returns 제거 성공 여부 | Whether removal was successful
|
|
115
149
|
*/
|
|
116
150
|
const unregisterStore = (formId) => {
|
|
117
151
|
const stores = storesRef.current;
|
|
118
|
-
|
|
152
|
+
const refCounts = refCountsRef.current;
|
|
153
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
154
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
155
|
+
const store = stores.get(formId);
|
|
156
|
+
// 스토어가 존재하면 리소스 정리 후 제거 | Clean up resources before removal if store exists
|
|
157
|
+
if (store) {
|
|
158
|
+
store.destroy();
|
|
159
|
+
stores.delete(formId);
|
|
160
|
+
refCounts.delete(formId); // 참조 카운트도 함께 제거 | Remove reference count as well
|
|
161
|
+
autoCleanupRefCounts.delete(formId); // autoCleanup 참조 카운트도 제거 | Remove autoCleanup reference count as well
|
|
162
|
+
autoCleanupSettings.delete(formId); // autoCleanup 설정도 제거 | Remove autoCleanup settings as well
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
119
166
|
};
|
|
120
167
|
/**
|
|
121
168
|
* 모든 글로벌 스토어를 제거합니다. | Clear all global stores.
|
|
@@ -123,13 +170,99 @@ function GlobalFormaProvider({ children }) {
|
|
|
123
170
|
*/
|
|
124
171
|
const clearStores = () => {
|
|
125
172
|
const stores = storesRef.current;
|
|
173
|
+
const refCounts = refCountsRef.current;
|
|
174
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
175
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
176
|
+
// 모든 스토어의 리소스 정리 후 제거 | Clean up all store resources before clearing
|
|
177
|
+
stores.forEach((store) => {
|
|
178
|
+
store.destroy();
|
|
179
|
+
});
|
|
126
180
|
stores.clear();
|
|
181
|
+
refCounts.clear();
|
|
182
|
+
autoCleanupRefCounts.clear();
|
|
183
|
+
autoCleanupSettings.clear();
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* 스토어 사용 참조를 증가시킵니다 | Increment store usage reference
|
|
187
|
+
*
|
|
188
|
+
* @param formId 폼 식별자 | Form identifier
|
|
189
|
+
* @param autoCleanup autoCleanup 설정 | autoCleanup setting
|
|
190
|
+
*/
|
|
191
|
+
const incrementRef = (formId, autoCleanup) => {
|
|
192
|
+
const refCounts = refCountsRef.current;
|
|
193
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
194
|
+
// 전체 참조 카운트 증가 (모든 컴포넌트)
|
|
195
|
+
const currentCount = refCounts.get(formId) || 0;
|
|
196
|
+
const newCount = currentCount + 1;
|
|
197
|
+
refCounts.set(formId, newCount);
|
|
198
|
+
// autoCleanup 참조 카운트 증가 (autoCleanup: true인 컴포넌트만)
|
|
199
|
+
if (autoCleanup) {
|
|
200
|
+
const currentAutoCleanupCount = autoCleanupRefCounts.get(formId) || 0;
|
|
201
|
+
const newAutoCleanupCount = currentAutoCleanupCount + 1;
|
|
202
|
+
autoCleanupRefCounts.set(formId, newAutoCleanupCount);
|
|
203
|
+
console.log(`📈 Increment ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=${currentAutoCleanupCount}->${newAutoCleanupCount}`);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
console.log(`📈 Increment ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=unchanged (permanent ref)`);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* 스토어 사용 참조를 감소시키고, autoCleanup 참조가 0이 되면 자동 정리합니다 | Decrement store usage reference and auto cleanup when autoCleanup refs reach 0
|
|
211
|
+
*
|
|
212
|
+
* @param formId 폼 식별자 | Form identifier
|
|
213
|
+
* @param autoCleanup autoCleanup 설정 | autoCleanup setting
|
|
214
|
+
*/
|
|
215
|
+
const decrementRef = (formId, autoCleanup) => {
|
|
216
|
+
const refCounts = refCountsRef.current;
|
|
217
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
218
|
+
const stores = storesRef.current;
|
|
219
|
+
// 전체 참조 카운트가 없는 경우 (이미 수동으로 제거됨) 무시 | Ignore if no reference count (already manually removed)
|
|
220
|
+
if (!refCounts.has(formId)) {
|
|
221
|
+
console.log(`⚠️ No ref count found for ${formId} - already removed`);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const currentCount = refCounts.get(formId) || 0;
|
|
225
|
+
const currentAutoCleanupCount = autoCleanupRefCounts.get(formId) || 0;
|
|
226
|
+
// 전체 참조 카운트 감소
|
|
227
|
+
const newCount = Math.max(0, currentCount - 1);
|
|
228
|
+
refCounts.set(formId, newCount);
|
|
229
|
+
if (autoCleanup) {
|
|
230
|
+
// autoCleanup 참조 카운트 감소
|
|
231
|
+
const newAutoCleanupCount = Math.max(0, currentAutoCleanupCount - 1);
|
|
232
|
+
autoCleanupRefCounts.set(formId, newAutoCleanupCount);
|
|
233
|
+
console.log(`📉 Decrement ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=${currentAutoCleanupCount}->${newAutoCleanupCount}`);
|
|
234
|
+
// autoCleanup 참조가 0이 되면 스토어 정리 (autoCleanup: false 컴포넌트가 있어도)
|
|
235
|
+
if (newAutoCleanupCount === 0) {
|
|
236
|
+
const store = stores.get(formId);
|
|
237
|
+
if (store) {
|
|
238
|
+
console.log(`🗑️ Destroying store for ${formId} - all autoCleanup components removed (autoCleanup refs: ${currentAutoCleanupCount}->0, total refs: ${newCount})`);
|
|
239
|
+
store.destroy();
|
|
240
|
+
stores.delete(formId);
|
|
241
|
+
refCounts.delete(formId);
|
|
242
|
+
autoCleanupRefCounts.delete(formId);
|
|
243
|
+
autoCleanupSettingsRef.current.delete(formId);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
console.log(`📉 Decrement ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=unchanged (permanent ref removed)`);
|
|
249
|
+
}
|
|
250
|
+
// 전체 참조가 0이 되면 카운트 정리 (스토어는 이미 정리되었거나 영구 참조만 남음)
|
|
251
|
+
if (newCount === 0) {
|
|
252
|
+
refCounts.delete(formId);
|
|
253
|
+
if (autoCleanupRefCounts.get(formId) === 0) {
|
|
254
|
+
autoCleanupRefCounts.delete(formId);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
127
257
|
};
|
|
128
258
|
const contextValue = {
|
|
129
259
|
getOrCreateStore,
|
|
130
260
|
registerStore,
|
|
131
261
|
unregisterStore,
|
|
132
262
|
clearStores,
|
|
263
|
+
incrementRef,
|
|
264
|
+
decrementRef,
|
|
265
|
+
validateAndStoreAutoCleanupSetting,
|
|
133
266
|
};
|
|
134
267
|
return ((0, jsx_runtime_1.jsx)(exports.GlobalFormaContext.Provider, { value: contextValue, children: children }));
|
|
135
268
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";;;AAsGA,kDAwOC;;AA9UD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iCAAyD;AACzD,mDAAgD;AAGhD;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAyB;IACpE,gBAAgB,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,YAAY,EAAE,GAAG,EAAE;QACf,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,YAAY,EAAE,GAAG,EAAE;QACf,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,kCAAkC,EAAE,GAAG,EAAE;QACrC,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAA2B;IACrE,mFAAmF;IACnF,MAAM,SAAS,GAAG,IAAA,cAA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E,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.d.ts","sourceRoot":"","sources":["../../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAyB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,iDAoC7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAwOxE"}
|
|
@@ -45,6 +45,15 @@ export const GlobalFormaContext = createContext({
|
|
|
45
45
|
clearStores: () => {
|
|
46
46
|
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
47
47
|
},
|
|
48
|
+
incrementRef: () => {
|
|
49
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
50
|
+
},
|
|
51
|
+
decrementRef: () => {
|
|
52
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
53
|
+
},
|
|
54
|
+
validateAndStoreAutoCleanupSetting: () => {
|
|
55
|
+
throw new Error("GlobalFormaContext must be used within GlobalFormaProvider");
|
|
56
|
+
},
|
|
48
57
|
});
|
|
49
58
|
/**
|
|
50
59
|
* 글로벌 Forma 상태 관리 Provider | Global Forma state management provider
|
|
@@ -77,6 +86,12 @@ export const GlobalFormaContext = createContext({
|
|
|
77
86
|
export function GlobalFormaProvider({ children }) {
|
|
78
87
|
// formId별 FieldStore 인스턴스들을 관리하는 Map | Map managing FieldStore instances by formId
|
|
79
88
|
const storesRef = useRef(new Map());
|
|
89
|
+
// formId별 참조 카운트를 관리하는 Map | Map managing reference count by formId
|
|
90
|
+
const refCountsRef = useRef(new Map());
|
|
91
|
+
// formId별 autoCleanup 컴포넌트 참조 카운트를 관리하는 Map | Map managing autoCleanup component reference count by formId
|
|
92
|
+
const autoCleanupRefCountsRef = useRef(new Map());
|
|
93
|
+
// formId별 autoCleanup 설정을 추적하는 Map | Map tracking autoCleanup settings by formId
|
|
94
|
+
const autoCleanupSettingsRef = useRef(new Map());
|
|
80
95
|
/**
|
|
81
96
|
* formId에 해당하는 FieldStore를 가져오거나 새로 생성합니다. | Get or create FieldStore for the given formId.
|
|
82
97
|
*
|
|
@@ -87,12 +102,30 @@ export function GlobalFormaProvider({ children }) {
|
|
|
87
102
|
const stores = storesRef.current;
|
|
88
103
|
if (!stores.has(formId)) {
|
|
89
104
|
// 새로운 스토어를 빈 객체로 생성 | Create new store with empty object
|
|
105
|
+
console.log(`Creating NEW store for formId: ${formId}`);
|
|
90
106
|
const newStore = new FieldStore({});
|
|
91
107
|
stores.set(formId, newStore);
|
|
92
108
|
return newStore;
|
|
93
109
|
}
|
|
110
|
+
console.log(`Using EXISTING store for formId: ${formId}`);
|
|
94
111
|
return stores.get(formId);
|
|
95
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* autoCleanup 설정의 일관성을 검증하고 설정을 저장합니다. | Validate and store autoCleanup setting consistency.
|
|
115
|
+
*
|
|
116
|
+
* @param formId 폼 식별자 | Form identifier
|
|
117
|
+
* @param autoCleanup 현재 autoCleanup 설정 | Current autoCleanup setting
|
|
118
|
+
*/
|
|
119
|
+
const validateAndStoreAutoCleanupSetting = (formId, autoCleanup) => {
|
|
120
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
121
|
+
const existingSetting = autoCleanupSettings.get(formId);
|
|
122
|
+
if (existingSetting !== undefined && existingSetting !== autoCleanup) {
|
|
123
|
+
console.warn(`⚠️ Conflicting autoCleanup settings for stateId "${formId}": ` +
|
|
124
|
+
`existing=${existingSetting}, new=${autoCleanup}. ` +
|
|
125
|
+
`All components using the same stateId should have consistent autoCleanup settings.`);
|
|
126
|
+
}
|
|
127
|
+
autoCleanupSettings.set(formId, autoCleanup);
|
|
128
|
+
};
|
|
96
129
|
/**
|
|
97
130
|
* 기존 FieldStore를 글로벌 폼에 등록합니다. | Register existing FieldStore to global form.
|
|
98
131
|
*
|
|
@@ -105,13 +138,27 @@ export function GlobalFormaProvider({ children }) {
|
|
|
105
138
|
};
|
|
106
139
|
/**
|
|
107
140
|
* 글로벌 스토어에서 특정 formId의 FieldStore를 제거합니다. | Remove specific FieldStore from global store.
|
|
141
|
+
* 참조 카운트를 무시하고 강제로 제거합니다. | Force remove ignoring reference count.
|
|
108
142
|
*
|
|
109
143
|
* @param formId 제거할 폼 식별자 | Form identifier to remove
|
|
110
144
|
* @returns 제거 성공 여부 | Whether removal was successful
|
|
111
145
|
*/
|
|
112
146
|
const unregisterStore = (formId) => {
|
|
113
147
|
const stores = storesRef.current;
|
|
114
|
-
|
|
148
|
+
const refCounts = refCountsRef.current;
|
|
149
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
150
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
151
|
+
const store = stores.get(formId);
|
|
152
|
+
// 스토어가 존재하면 리소스 정리 후 제거 | Clean up resources before removal if store exists
|
|
153
|
+
if (store) {
|
|
154
|
+
store.destroy();
|
|
155
|
+
stores.delete(formId);
|
|
156
|
+
refCounts.delete(formId); // 참조 카운트도 함께 제거 | Remove reference count as well
|
|
157
|
+
autoCleanupRefCounts.delete(formId); // autoCleanup 참조 카운트도 제거 | Remove autoCleanup reference count as well
|
|
158
|
+
autoCleanupSettings.delete(formId); // autoCleanup 설정도 제거 | Remove autoCleanup settings as well
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
115
162
|
};
|
|
116
163
|
/**
|
|
117
164
|
* 모든 글로벌 스토어를 제거합니다. | Clear all global stores.
|
|
@@ -119,13 +166,99 @@ export function GlobalFormaProvider({ children }) {
|
|
|
119
166
|
*/
|
|
120
167
|
const clearStores = () => {
|
|
121
168
|
const stores = storesRef.current;
|
|
169
|
+
const refCounts = refCountsRef.current;
|
|
170
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
171
|
+
const autoCleanupSettings = autoCleanupSettingsRef.current;
|
|
172
|
+
// 모든 스토어의 리소스 정리 후 제거 | Clean up all store resources before clearing
|
|
173
|
+
stores.forEach((store) => {
|
|
174
|
+
store.destroy();
|
|
175
|
+
});
|
|
122
176
|
stores.clear();
|
|
177
|
+
refCounts.clear();
|
|
178
|
+
autoCleanupRefCounts.clear();
|
|
179
|
+
autoCleanupSettings.clear();
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* 스토어 사용 참조를 증가시킵니다 | Increment store usage reference
|
|
183
|
+
*
|
|
184
|
+
* @param formId 폼 식별자 | Form identifier
|
|
185
|
+
* @param autoCleanup autoCleanup 설정 | autoCleanup setting
|
|
186
|
+
*/
|
|
187
|
+
const incrementRef = (formId, autoCleanup) => {
|
|
188
|
+
const refCounts = refCountsRef.current;
|
|
189
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
190
|
+
// 전체 참조 카운트 증가 (모든 컴포넌트)
|
|
191
|
+
const currentCount = refCounts.get(formId) || 0;
|
|
192
|
+
const newCount = currentCount + 1;
|
|
193
|
+
refCounts.set(formId, newCount);
|
|
194
|
+
// autoCleanup 참조 카운트 증가 (autoCleanup: true인 컴포넌트만)
|
|
195
|
+
if (autoCleanup) {
|
|
196
|
+
const currentAutoCleanupCount = autoCleanupRefCounts.get(formId) || 0;
|
|
197
|
+
const newAutoCleanupCount = currentAutoCleanupCount + 1;
|
|
198
|
+
autoCleanupRefCounts.set(formId, newAutoCleanupCount);
|
|
199
|
+
console.log(`📈 Increment ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=${currentAutoCleanupCount}->${newAutoCleanupCount}`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
console.log(`📈 Increment ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=unchanged (permanent ref)`);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* 스토어 사용 참조를 감소시키고, autoCleanup 참조가 0이 되면 자동 정리합니다 | Decrement store usage reference and auto cleanup when autoCleanup refs reach 0
|
|
207
|
+
*
|
|
208
|
+
* @param formId 폼 식별자 | Form identifier
|
|
209
|
+
* @param autoCleanup autoCleanup 설정 | autoCleanup setting
|
|
210
|
+
*/
|
|
211
|
+
const decrementRef = (formId, autoCleanup) => {
|
|
212
|
+
const refCounts = refCountsRef.current;
|
|
213
|
+
const autoCleanupRefCounts = autoCleanupRefCountsRef.current;
|
|
214
|
+
const stores = storesRef.current;
|
|
215
|
+
// 전체 참조 카운트가 없는 경우 (이미 수동으로 제거됨) 무시 | Ignore if no reference count (already manually removed)
|
|
216
|
+
if (!refCounts.has(formId)) {
|
|
217
|
+
console.log(`⚠️ No ref count found for ${formId} - already removed`);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const currentCount = refCounts.get(formId) || 0;
|
|
221
|
+
const currentAutoCleanupCount = autoCleanupRefCounts.get(formId) || 0;
|
|
222
|
+
// 전체 참조 카운트 감소
|
|
223
|
+
const newCount = Math.max(0, currentCount - 1);
|
|
224
|
+
refCounts.set(formId, newCount);
|
|
225
|
+
if (autoCleanup) {
|
|
226
|
+
// autoCleanup 참조 카운트 감소
|
|
227
|
+
const newAutoCleanupCount = Math.max(0, currentAutoCleanupCount - 1);
|
|
228
|
+
autoCleanupRefCounts.set(formId, newAutoCleanupCount);
|
|
229
|
+
console.log(`📉 Decrement ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=${currentAutoCleanupCount}->${newAutoCleanupCount}`);
|
|
230
|
+
// autoCleanup 참조가 0이 되면 스토어 정리 (autoCleanup: false 컴포넌트가 있어도)
|
|
231
|
+
if (newAutoCleanupCount === 0) {
|
|
232
|
+
const store = stores.get(formId);
|
|
233
|
+
if (store) {
|
|
234
|
+
console.log(`🗑️ Destroying store for ${formId} - all autoCleanup components removed (autoCleanup refs: ${currentAutoCleanupCount}->0, total refs: ${newCount})`);
|
|
235
|
+
store.destroy();
|
|
236
|
+
stores.delete(formId);
|
|
237
|
+
refCounts.delete(formId);
|
|
238
|
+
autoCleanupRefCounts.delete(formId);
|
|
239
|
+
autoCleanupSettingsRef.current.delete(formId);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
console.log(`📉 Decrement ref for ${formId}: total=${currentCount}->${newCount}, autoCleanup=unchanged (permanent ref removed)`);
|
|
245
|
+
}
|
|
246
|
+
// 전체 참조가 0이 되면 카운트 정리 (스토어는 이미 정리되었거나 영구 참조만 남음)
|
|
247
|
+
if (newCount === 0) {
|
|
248
|
+
refCounts.delete(formId);
|
|
249
|
+
if (autoCleanupRefCounts.get(formId) === 0) {
|
|
250
|
+
autoCleanupRefCounts.delete(formId);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
123
253
|
};
|
|
124
254
|
const contextValue = {
|
|
125
255
|
getOrCreateStore,
|
|
126
256
|
registerStore,
|
|
127
257
|
unregisterStore,
|
|
128
258
|
clearStores,
|
|
259
|
+
incrementRef,
|
|
260
|
+
decrementRef,
|
|
261
|
+
validateAndStoreAutoCleanupSetting,
|
|
129
262
|
};
|
|
130
263
|
return (_jsx(GlobalFormaContext.Provider, { value: contextValue, children: children }));
|
|
131
264
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAyB;IACpE,gBAAgB,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAA2B;IACrE,mFAAmF;IACnF,MAAM,SAAS,GAAG,MAAM,CAA+B,IAAI,GAAG,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalFormaContext.js","sourceRoot":"","sources":["../../../contexts/GlobalFormaContext.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAyB;IACpE,gBAAgB,EAAE,GAAG,EAAE;QACnB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CACX,4DAA4D,CAC/D,CAAC;IACN,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,MAAM,IAAI,KA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AA2B;QACzC,gBAAgB;QAChB,aAAa;QACb,eAAe;QACf,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,kCAAkC;KACrC,CAAC;IAEF,OAAO,CACH,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CACjC,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormaState.d.ts","sourceRoot":"","sources":["../../../hooks/useFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"useFormaState.d.ts","sourceRoot":"","sources":["../../../hooks/useFormaState.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC/D,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAE/B,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,mFAAmF;IACnF,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC9D,gFAAgF;IAChF,QAAQ,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,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a,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"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @author KIM YOUNG JIN (ehfuse@gmail.com)
|
|
8
8
|
* @license MIT License
|
|
9
9
|
*/
|
|
10
|
-
import { useRef, useCallback, useState, useEffect } from "react";
|
|
10
|
+
import { useRef, useCallback, useState, useEffect, useReducer, } from "react";
|
|
11
11
|
import { FieldStore } from "../core/FieldStore";
|
|
12
12
|
import { devWarn } from "../utils";
|
|
13
13
|
/**
|
|
@@ -20,14 +20,20 @@ import { devWarn } from "../utils";
|
|
|
20
20
|
*/
|
|
21
21
|
function useFieldValue(store, fieldName) {
|
|
22
22
|
const [value, setValue] = useState(() => store.getValue(fieldName));
|
|
23
|
+
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
23
24
|
useEffect(() => {
|
|
25
|
+
// 초기값 강제 동기화
|
|
26
|
+
const currentValue = store.getValue(fieldName);
|
|
27
|
+
setValue(currentValue);
|
|
24
28
|
// 구독 설정 / Setup subscription
|
|
25
29
|
const unsubscribe = store.subscribe(fieldName, () => {
|
|
26
30
|
const newValue = store.getValue(fieldName);
|
|
27
31
|
setValue(newValue);
|
|
32
|
+
// useReducer를 사용한 강제 리렌더링
|
|
33
|
+
forceUpdate();
|
|
28
34
|
});
|
|
29
35
|
return unsubscribe;
|
|
30
|
-
}, [fieldName]); //
|
|
36
|
+
}, [fieldName, store]); // 깔끔한 의존성 배열
|
|
31
37
|
return value;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
@@ -54,6 +60,14 @@ export function useFormaState(initialValues = {}, options = {}) {
|
|
|
54
60
|
const storeRef = useRef(null);
|
|
55
61
|
if (_externalStore) {
|
|
56
62
|
storeRef.current = _externalStore;
|
|
63
|
+
// 외부 스토어 사용 시 초기값이 비어있으면 설정
|
|
64
|
+
const currentValues = _externalStore.getValues();
|
|
65
|
+
if (Object.keys(currentValues).length === 0 &&
|
|
66
|
+
Object.keys(initialValues).length > 0) {
|
|
67
|
+
Object.keys(initialValues).forEach((key) => {
|
|
68
|
+
_externalStore.setValue(key, initialValues[key]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
else if (!storeRef.current) {
|
|
59
73
|
storeRef.current = new FieldStore(stableInitialValues.current);
|
|
@@ -70,38 +84,38 @@ export function useFormaState(initialValues = {}, options = {}) {
|
|
|
70
84
|
// dot notation으로 특정 필드 값 구독
|
|
71
85
|
const useValue = useCallback((path) => {
|
|
72
86
|
return useFieldValue(store, path);
|
|
73
|
-
}, [] // store 의존성
|
|
87
|
+
}, [store] // store 의존성 추가 - 외부 스토어 사용 시 중요
|
|
74
88
|
);
|
|
75
89
|
// Set a specific field value with dot notation
|
|
76
90
|
// dot notation으로 특정 필드 값 설정
|
|
77
91
|
const setValue = useCallback((path, value) => {
|
|
78
92
|
store.setValue(path, value);
|
|
79
|
-
}, [] // store 의존성
|
|
93
|
+
}, [store] // store 의존성 추가
|
|
80
94
|
);
|
|
81
95
|
// Get all current values (non-reactive)
|
|
82
96
|
// 모든 현재 값 가져오기 (반응형 아님)
|
|
83
97
|
const getValues = useCallback(() => {
|
|
84
98
|
return store.getValues();
|
|
85
|
-
}, []); // store 의존성
|
|
99
|
+
}, [store]); // store 의존성 추가
|
|
86
100
|
// Set all values at once
|
|
87
101
|
// 모든 값을 한 번에 설정
|
|
88
102
|
const setValues = useCallback((values) => {
|
|
89
103
|
const currentValues = store.getValues();
|
|
90
104
|
const newValues = { ...currentValues, ...values };
|
|
91
105
|
store.setValues(newValues);
|
|
92
|
-
}, [] // store 의존성
|
|
106
|
+
}, [store] // store 의존성 추가
|
|
93
107
|
);
|
|
94
108
|
// Reset to initial values
|
|
95
109
|
// 초기값으로 재설정
|
|
96
110
|
const reset = useCallback(() => {
|
|
97
111
|
store.reset();
|
|
98
|
-
}, []); // store 의존성
|
|
112
|
+
}, [store]); // store 의존성 추가
|
|
99
113
|
// Set new initial values (for dynamic initialization)
|
|
100
114
|
// 새 초기값 설정 (동적 초기화용)
|
|
101
115
|
const setInitialValues = useCallback((newInitialValues) => {
|
|
102
116
|
stableInitialValues.current = newInitialValues;
|
|
103
117
|
store.setInitialValues(newInitialValues);
|
|
104
|
-
}, []); // store 의존성
|
|
118
|
+
}, [store]); // store 의존성 추가
|
|
105
119
|
// Handle standard input change events
|
|
106
120
|
// 표준 입력 변경 이벤트 처리
|
|
107
121
|
const handleChange = useCallback((event) => {
|
|
@@ -140,19 +154,19 @@ export function useFormaState(initialValues = {}, options = {}) {
|
|
|
140
154
|
handleChange,
|
|
141
155
|
hasField: useCallback((path) => {
|
|
142
156
|
return store.hasField(path);
|
|
143
|
-
}, [] // store 의존성
|
|
157
|
+
}, [store] // store 의존성 추가
|
|
144
158
|
),
|
|
145
159
|
removeField: useCallback((path) => {
|
|
146
160
|
store.removeField(path);
|
|
147
|
-
}, [] // store 의존성
|
|
161
|
+
}, [store] // store 의존성 추가
|
|
148
162
|
),
|
|
149
163
|
getValue: useCallback((path) => {
|
|
150
164
|
return store.getValue(path);
|
|
151
|
-
}, [] // store 의존성
|
|
165
|
+
}, [store] // store 의존성 추가
|
|
152
166
|
),
|
|
153
167
|
subscribe: useCallback((callback) => {
|
|
154
168
|
return store.subscribeToAll(callback);
|
|
155
|
-
}, [] // store 의존성
|
|
169
|
+
}, [store] // store 의존성 추가
|
|
156
170
|
),
|
|
157
171
|
_store: store,
|
|
158
172
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormaState.js","sourceRoot":"","sources":["../../../hooks/useFormaState.ts"],"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C/B,CAAC;QAED,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACnC,CAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;IAEF,OAAO;QACH,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,SAAS;QACT,KAAK;QACL,gBAAgB;QAChB,YAAY;QACZ,QAAQ,EAAE,WAAW,CACjB,CAAC,IAAY,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,EACD,CAAC,KAAK,CAAC,CAAC,eAAe;SAC1B;QACD,WAAW,EAAE,WAAW,CACpB,CAAC,IAAY,EAAE,EAAE;YACb,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,EACD,CAAC,KAAK,CAAC,CAAC,eAAe;SAC1B;QACD,QAAQ,EAAE,WAAW,CACjB,CAAC,IAAY,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,EACD,CAAC,KAAK,CAAC,CAAC,eAAe;SAC1B;QACD,SAAS,EAAE,WAAW,CAClB,CAAC,QAA6B,EAAE,EAAE;YAC9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC,EACD,CAAC,KAAK,CAAC,CAAC,eAAe;SAC1B;QACD,MAAM,EAAE,KAAK;KAChB,CAAC;AACN,CAAC"}
|
|
@@ -41,5 +41,5 @@ import { UseGlobalFormProps, UseGlobalFormReturn } from "../types/globalForm";
|
|
|
41
41
|
* @param props 글로벌 폼 설정 옵션 / Global form configuration options
|
|
42
42
|
* @returns 글로벌 폼 관리 API 객체 / Global form management API object
|
|
43
43
|
*/
|
|
44
|
-
export declare function useGlobalForm<T extends Record<string, any>>({ formId, }: UseGlobalFormProps<T>): UseGlobalFormReturn<T>;
|
|
44
|
+
export declare function useGlobalForm<T extends Record<string, any>>({ formId, initialValues, autoCleanup, }: UseGlobalFormProps<T>): UseGlobalFormReturn<T>;
|
|
45
45
|
//# sourceMappingURL=useGlobalForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalForm.d.ts","sourceRoot":"","sources":["../../../hooks/useGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG9E;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACzD,MAAM,
|
|
1
|
+
{"version":3,"file":"useGlobalForm.d.ts","sourceRoot":"","sources":["../../../hooks/useGlobalForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG9E;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACzD,MAAM,EACN,aAAa,EACb,WAAkB,GACrB,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CA2EhD"}
|