@sanity/assist 4.4.7 → 5.0.0
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/index.esm.js +3 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/helpers/conditionalMembers.test.ts +43 -0
- package/src/helpers/conditionalMembers.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -1363,8 +1363,9 @@ function conditionalState(memberState) {
|
|
|
1363
1363
|
return {
|
|
1364
1364
|
path: sanity.pathToString(memberState.path),
|
|
1365
1365
|
readOnly: !!memberState.readOnly,
|
|
1366
|
+
// Use actual form state readOnly value
|
|
1366
1367
|
hidden: !1,
|
|
1367
|
-
//
|
|
1368
|
+
// If it's in form state members, it's not hidden
|
|
1368
1369
|
conditional: isConditional(memberState.schemaType)
|
|
1369
1370
|
};
|
|
1370
1371
|
}
|
|
@@ -1399,7 +1400,7 @@ function extractConditionalPaths(node, maxDepth2) {
|
|
|
1399
1400
|
), innerFields = extractConditionalPaths(member.fieldSet, maxDepth2).map((f) => ({
|
|
1400
1401
|
...f,
|
|
1401
1402
|
// if fieldset is conditional, visible fields must also be considered conditional
|
|
1402
|
-
conditional: conditionalFieldset
|
|
1403
|
+
conditional: conditionalFieldset || f.conditional
|
|
1403
1404
|
}));
|
|
1404
1405
|
return [...acc, ...innerFields];
|
|
1405
1406
|
}
|