@json-layout/core 0.16.1 → 0.16.2
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 +1 -1
- package/src/state/state-node.js +8 -0
package/package.json
CHANGED
package/src/state/state-node.js
CHANGED
|
@@ -319,6 +319,14 @@ export function createStateNode (
|
|
|
319
319
|
/** @type {number} */
|
|
320
320
|
const activeChildTreeIndex = fullKey in context.activeItems ? context.activeItems[fullKey] : skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[childTree.root.pointer](data))
|
|
321
321
|
if (activeChildTreeIndex !== -1) {
|
|
322
|
+
context.errors = context.errors?.filter(error => {
|
|
323
|
+
const originalError = error.params?.errors?.[0] ?? error
|
|
324
|
+
// if an item was selected, remove the oneOf error
|
|
325
|
+
if (originalError.schemaPath === skeleton.pointer && originalError.keyword === 'oneOf') return false
|
|
326
|
+
// also remove the errors from other children of the oneOf
|
|
327
|
+
if (!originalError.schemaPath.startsWith(skeleton.pointer + '/' + activeChildTreeIndex)) return false
|
|
328
|
+
return true
|
|
329
|
+
})
|
|
322
330
|
context.activeItems = produce(context.activeItems, draft => { draft[fullKey] = activeChildTreeIndex })
|
|
323
331
|
const activeChildKey = `${fullKey}/${activeChildTreeIndex}`
|
|
324
332
|
if (context.autofocusTarget === fullKey) context.autofocusTarget = activeChildKey
|