cogsbox-state 0.5.398 → 0.5.400

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cogsbox-state",
3
- "version": "0.5.398",
3
+ "version": "0.5.400",
4
4
  "description": "React state management library with form controls and server sync",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
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,19 @@ function createProxyHandler<T>(
2371
2371
  const setter = rebuildStateShape(item, finalPath, meta);
2372
2372
  const itemComponentId = `${componentId}-${path.join(".")}-${originalIndex}`;
2373
2373
 
2374
- // Get the validation wrapper from formElements
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: validationWrapper ? (
2394
- // Automatically wrap with validation wrapper
2395
- <ValidationWrapper
2396
- formOpts={undefined}
2397
- path={finalPath}
2398
- validationKey={options?.validation?.key || ""}
2399
- stateKey={stateKey}
2400
- validIndices={meta?.validIndices}
2401
- >
2402
- {childContent}
2403
- </ValidationWrapper>
2404
- ) : (
2405
- childContent
2379
+ children: callbackfn(
2380
+ item,
2381
+ setter,
2382
+ { localIndex, originalIndex },
2383
+ arrayToMap as any,
2384
+ rebuildStateShape(arrayToMap as any, path, meta)
2406
2385
  ),
2407
2386
  });
2408
-
2409
- return wrappedContent;
2410
2387
  });
2411
2388
  };
2412
2389
  }