cogsbox-state 0.5.398 → 0.5.399
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/CogsState.jsx +425 -433
- package/dist/CogsState.jsx.map +1 -1
- package/dist/Functions.jsx +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +16 -32
package/dist/Functions.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as V, Fragment as M } from "react/jsx-runtime";
|
|
|
2
2
|
import "./CogsState.jsx";
|
|
3
3
|
import { getNestedValue as N, isFunction as U, updateNestedProperty as T } from "./utility.js";
|
|
4
4
|
import I, { useRef as b, useState as z, useEffect as R } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { formRefStore as O, getGlobalStore as d } from "./store.js";
|
|
6
6
|
import { validateZodPathFunc as W } from "./useValidateZodPath.js";
|
|
7
7
|
function j(n, e, t, r) {
|
|
8
8
|
n(
|
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -2345,7 +2345,7 @@ function createProxyHandler<T>(
|
|
|
2345
2345
|
callbackfn: (
|
|
2346
2346
|
value: InferArrayElement<T>,
|
|
2347
2347
|
setter: StateObject<InferArrayElement<T>>,
|
|
2348
|
-
index: number,
|
|
2348
|
+
index: { localIndex: number; originalIndex: number },
|
|
2349
2349
|
array: T,
|
|
2350
2350
|
arraySetter: StateObject<T>
|
|
2351
2351
|
) => any
|
|
@@ -2371,42 +2371,26 @@ function createProxyHandler<T>(
|
|
|
2371
2371
|
const setter = rebuildStateShape(item, finalPath, meta);
|
|
2372
2372
|
const itemComponentId = `${componentId}-${path.join(".")}-${originalIndex}`;
|
|
2373
2373
|
|
|
2374
|
-
|
|
2375
|
-
const options = getGlobalStore
|
|
2376
|
-
.getState()
|
|
2377
|
-
.getInitialOptions(stateKey);
|
|
2378
|
-
const validationWrapper = options?.formElements?.validation;
|
|
2379
|
-
|
|
2380
|
-
const childContent = callbackfn(
|
|
2381
|
-
item,
|
|
2382
|
-
setter,
|
|
2383
|
-
originalIndex, // Use originalIndex here
|
|
2384
|
-
arrayToMap as any,
|
|
2385
|
-
rebuildStateShape(arrayToMap as any, path, meta)
|
|
2386
|
-
);
|
|
2387
|
-
|
|
2388
|
-
const wrappedContent = createElement(CogsItemWrapper, {
|
|
2374
|
+
return createElement(CogsItemWrapper, {
|
|
2389
2375
|
key: originalIndex,
|
|
2390
2376
|
stateKey,
|
|
2391
2377
|
itemComponentId,
|
|
2392
2378
|
itemPath: finalPath,
|
|
2393
|
-
children:
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
),
|
|
2379
|
+
children: createElement(FormControlComponent, {
|
|
2380
|
+
setState: effectiveSetState as any,
|
|
2381
|
+
stateKey: stateKey,
|
|
2382
|
+
path: finalPath,
|
|
2383
|
+
child: () =>
|
|
2384
|
+
callbackfn(
|
|
2385
|
+
item,
|
|
2386
|
+
setter,
|
|
2387
|
+
{ localIndex, originalIndex },
|
|
2388
|
+
arrayToMap as any,
|
|
2389
|
+
rebuildStateShape(arrayToMap as any, path, meta)
|
|
2390
|
+
),
|
|
2391
|
+
formOpts: undefined,
|
|
2392
|
+
}),
|
|
2407
2393
|
});
|
|
2408
|
-
|
|
2409
|
-
return wrappedContent;
|
|
2410
2394
|
});
|
|
2411
2395
|
};
|
|
2412
2396
|
}
|